mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
moved for loop to separate Stmt and added continue
This commit is contained in:
parent
957783a926
commit
be28dad67e
6 changed files with 113 additions and 61 deletions
12
lib/lexer.ml
12
lib/lexer.ml
|
|
@ -14,7 +14,7 @@ open Error
|
|||
| String of string
|
||||
| Number of float
|
||||
|
||||
| And | Break | Class | Else | False | Fun | For | If | Nil | Or | Print | Return | Super | This | True
|
||||
| And | Break | Class | Continue | Else | False | Fun | For | If | Nil | Or | Print | Return | Super | This | True
|
||||
| Var | While
|
||||
|
||||
| Comment of string
|
||||
|
|
@ -29,11 +29,11 @@ let keywords =
|
|||
Hashtbl.add keywords s tt;
|
||||
keywords
|
||||
in
|
||||
keywords |> insert "and" And |> insert "break" Break |> insert "class" Class |> insert "else" Else
|
||||
|> insert "false" False |> insert "for" For |> insert "fun" Fun |> insert "if" If
|
||||
|> insert "nil" Nil |> insert "or" Or |> insert "print" Print |> insert "return" Return
|
||||
|> insert "super" Super |> insert "this" This |> insert "true" True |> insert "var" Var
|
||||
|> insert "while" While
|
||||
keywords |> insert "and" And |> insert "break" Break |> insert "class" Class
|
||||
|> insert "continue" Continue |> insert "else" Else |> insert "false" False |> insert "for" For
|
||||
|> insert "fun" Fun |> insert "if" If |> insert "nil" Nil |> insert "or" Or
|
||||
|> insert "print" Print |> insert "return" Return |> insert "super" Super |> insert "this" This
|
||||
|> insert "true" True |> insert "var" Var |> insert "while" While
|
||||
|
||||
type token = { token_type : token_type; pos : code_pos }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue