mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
fix comment syntax
This commit is contained in:
parent
9fb5a8e715
commit
1079d53f05
|
@ -111,9 +111,7 @@ pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = Simple<char>> {
|
||||||
.or(keyword)
|
.or(keyword)
|
||||||
.recover_with(skip_then_retry_until([]));
|
.recover_with(skip_then_retry_until([]));
|
||||||
|
|
||||||
let comment = just("--")
|
let comment = just("--").then(take_until(just('\n'))).padded();
|
||||||
.ignore_then(filter(|c| *c != '\n').repeated())
|
|
||||||
.then_ignore(just('\n'));
|
|
||||||
|
|
||||||
token
|
token
|
||||||
.padded_by(comment.repeated())
|
.padded_by(comment.repeated())
|
||||||
|
|
|
@ -64,6 +64,7 @@ fn main() {
|
||||||
for err in lex_error { diagnostics.add_lex_error(err); }
|
for err in lex_error { diagnostics.add_lex_error(err); }
|
||||||
for err in parse_error { diagnostics.add_parse_error(err); }
|
for err in parse_error { diagnostics.add_parse_error(err); }
|
||||||
|
|
||||||
|
// Report syntax errors if any
|
||||||
if diagnostics.has_error() {
|
if diagnostics.has_error() {
|
||||||
diagnostics.display(src);
|
diagnostics.display(src);
|
||||||
logif!(0, "Epic parsing fail");
|
logif!(0, "Epic parsing fail");
|
||||||
|
@ -77,6 +78,8 @@ fn main() {
|
||||||
// Convert the AST to HIR
|
// Convert the AST to HIR
|
||||||
let (ir, lowering_error) = ast_to_ir(ast);
|
let (ir, lowering_error) = ast_to_ir(ast);
|
||||||
for err in lowering_error { diagnostics.add_lowering_error(err); }
|
for err in lowering_error { diagnostics.add_lowering_error(err); }
|
||||||
|
|
||||||
|
// Report lowering errors if any
|
||||||
if diagnostics.has_error() {
|
if diagnostics.has_error() {
|
||||||
diagnostics.display(src);
|
diagnostics.display(src);
|
||||||
logif!(0, "Epic Lowering(HIR) fail");
|
logif!(0, "Epic Lowering(HIR) fail");
|
||||||
|
@ -98,17 +101,18 @@ fn main() {
|
||||||
let mut file = fs::File::create(&output_path).expect("Failed to create file");
|
let mut file = fs::File::create(&output_path).expect("Failed to create file");
|
||||||
file.write_all(codegen.emitted.as_bytes()).expect("Failed to write to file");
|
file.write_all(codegen.emitted.as_bytes()).expect("Failed to write to file");
|
||||||
|
|
||||||
// End timer
|
// Compile the generate code
|
||||||
let duration = start.elapsed().as_millis();
|
|
||||||
|
|
||||||
logif!(0, format!("Compilation took {}ms", duration));
|
|
||||||
logif!(0, format!("Wrote output to `{}`", output_path.display()));
|
|
||||||
|
|
||||||
let compiler = &config.compiler.compiler;
|
let compiler = &config.compiler.compiler;
|
||||||
Command::new(compiler)
|
Command::new(compiler)
|
||||||
.arg(&output_path)
|
.arg(&output_path)
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("Failed to run compiler");
|
.expect("Failed to run compiler");
|
||||||
|
|
||||||
|
// End timer
|
||||||
|
let duration = start.elapsed().as_millis();
|
||||||
|
|
||||||
|
logif!(0, format!("Compilation took {}ms", duration));
|
||||||
|
logif!(0, format!("Wrote output to `{}`", output_path.display()));
|
||||||
},
|
},
|
||||||
None => { unreachable!(); }
|
None => { unreachable!(); }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue