comments, skip empty semis in blocks
This commit is contained in:
parent
e79af01925
commit
1201a6c45a
|
|
@ -658,6 +658,13 @@ parse_block:
|
||||||
call peek_expect_token
|
call peek_expect_token
|
||||||
test rax, rax
|
test rax, rax
|
||||||
jnz .done
|
jnz .done
|
||||||
|
|
||||||
|
; skip semicolons
|
||||||
|
mov dil, TOKEN_SEMI
|
||||||
|
call expect_token
|
||||||
|
test rax, rax
|
||||||
|
jnz .loop
|
||||||
|
|
||||||
mov rdi, [rsp + 56] ; Ast
|
mov rdi, [rsp + 56] ; Ast
|
||||||
call parse_statement
|
call parse_statement
|
||||||
lea rdi, [rsp + 8] ; vec
|
lea rdi, [rsp + 8] ; vec
|
||||||
|
|
|
||||||
|
|
@ -548,6 +548,7 @@ expect_token:
|
||||||
pop rbp
|
pop rbp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;; Returns the next token if it matches the expected token, else panics
|
||||||
;; dil: expected token
|
;; dil: expected token
|
||||||
unwrap_token:
|
unwrap_token:
|
||||||
push rbp
|
push rbp
|
||||||
|
|
@ -561,6 +562,7 @@ unwrap_token:
|
||||||
call panic
|
call panic
|
||||||
|
|
||||||
;; returns 0 if token not found, else returns lexeme (ptr, len)
|
;; returns 0 if token not found, else returns lexeme (ptr, len)
|
||||||
|
;; doesn't advance the cursor
|
||||||
;; dil: expected token
|
;; dil: expected token
|
||||||
peek_expect_token:
|
peek_expect_token:
|
||||||
push rbp
|
push rbp
|
||||||
|
|
@ -573,6 +575,7 @@ peek_expect_token:
|
||||||
pop rbp
|
pop rbp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
;; returns the next lexeme without advancing the cursor
|
||||||
;; rdi: out-struct pointer
|
;; rdi: out-struct pointer
|
||||||
peek_lexeme:
|
peek_lexeme:
|
||||||
push rbp
|
push rbp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue