diff --git a/lang/src/ast.asm b/lang/src/ast.asm index fe86cac..5343dec 100644 --- a/lang/src/ast.asm +++ b/lang/src/ast.asm @@ -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 diff --git a/lang/src/tokeniser.asm b/lang/src/tokeniser.asm index 21afb01..40eea1a 100644 --- a/lang/src/tokeniser.asm +++ b/lang/src/tokeniser.asm @@ -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