Skip to content

Commit

Permalink
[YLC] implementing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Cr0a3 committed Oct 27, 2024
1 parent 9f9670e commit 7fb8098
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/IR/parser/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,18 @@ impl IrLexer {

'"' => ty = Some(self.scan_string()?),

';' => {
let ref_line = self.line_no;

loop {
self.advance()?;

if self.line_no != ref_line {
break;
}
}
}

'.' => {
self.advance()?;
if let '.' = self.peek().unwrap() {} else {
Expand Down
11 changes: 11 additions & 0 deletions tests/tools/ylc/comments.yl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# RUN:
cargo run -p ylc -- -in=%s -o=out.o

# IN:
; abc
; defgh
define i32 @add(i32 %a, i32 %b) {
entry:
%ret = add i32 %a, %b
ret i32 %ret
}

0 comments on commit 7fb8098

Please sign in to comment.