comments, skip empty semis in blocks

This commit is contained in:
janis 2025-10-31 13:17:47 +01:00
parent e79af01925
commit 1201a6c45a
Signed by: janis
SSH key fingerprint: SHA256:bB1qbbqmDXZNT0KKD5c2Dfjg53JGhj7B3CFcLIzSqq8
2 changed files with 11 additions and 1 deletions

View file

@ -658,6 +658,13 @@ parse_block:
call peek_expect_token
test rax, rax
jnz .done
; skip semicolons
mov dil, TOKEN_SEMI
call expect_token
test rax, rax
jnz .loop
mov rdi, [rsp + 56] ; Ast
call parse_statement
lea rdi, [rsp + 8] ; vec

View file

@ -547,7 +547,8 @@ expect_token:
add rsp, 0x30
pop rbp
ret
;; Returns the next token if it matches the expected token, else panics
;; dil: expected token
unwrap_token:
push rbp
@ -561,6 +562,7 @@ unwrap_token:
call panic
;; returns 0 if token not found, else returns lexeme (ptr, len)
;; doesn't advance the cursor
;; dil: expected token
peek_expect_token:
push rbp
@ -573,6 +575,7 @@ peek_expect_token:
pop rbp
ret
;; returns the next lexeme without advancing the cursor
;; rdi: out-struct pointer
peek_lexeme:
push rbp