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)
|
||||
.recover_with(skip_then_retry_until([]));
|
||||
|
||||
let comment = just("--")
|
||||
.ignore_then(filter(|c| *c != '\n').repeated())
|
||||
.then_ignore(just('\n'));
|
||||
let comment = just("--").then(take_until(just('\n'))).padded();
|
||||
|
||||
token
|
||||
.padded_by(comment.repeated())
|
||||
|
|
|
@ -64,6 +64,7 @@ fn main() {
|
|||
for err in lex_error { diagnostics.add_lex_error(err); }
|
||||
for err in parse_error { diagnostics.add_parse_error(err); }
|
||||
|
||||
// Report syntax errors if any
|
||||
if diagnostics.has_error() {
|
||||
diagnostics.display(src);
|
||||
logif!(0, "Epic parsing fail");
|
||||
|
@ -77,6 +78,8 @@ fn main() {
|
|||
// Convert the AST to HIR
|
||||
let (ir, lowering_error) = ast_to_ir(ast);
|
||||
for err in lowering_error { diagnostics.add_lowering_error(err); }
|
||||
|
||||
// Report lowering errors if any
|
||||
if diagnostics.has_error() {
|
||||
diagnostics.display(src);
|
||||
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");
|
||||
file.write_all(codegen.emitted.as_bytes()).expect("Failed to write to file");
|
||||
|
||||
// End timer
|
||||
let duration = start.elapsed().as_millis();
|
||||
|
||||
logif!(0, format!("Compilation took {}ms", duration));
|
||||
logif!(0, format!("Wrote output to `{}`", output_path.display()));
|
||||
|
||||
// Compile the generate code
|
||||
let compiler = &config.compiler.compiler;
|
||||
Command::new(compiler)
|
||||
.arg(&output_path)
|
||||
.spawn()
|
||||
.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!(); }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue