Reserved keyword foreach for future use and updates AST with previously added reserved keywords
This commit is contained in:
parent
3a25803346
commit
6c6d8236c4
|
@ -80,7 +80,7 @@ const reserved = to_table({
|
|||
"assert": TokenType.Assert, "or": TokenType.LogicalOr,
|
||||
"and": TokenType.LogicalAnd, "del": TokenType.Del,
|
||||
"async": TokenType.Async, "await": TokenType.Await,
|
||||
"dynamyc": TokenType.Dynamic
|
||||
"dynamyc": TokenType.Dynamic, "foreach": TokenType.Foreach
|
||||
})
|
||||
|
||||
type
|
||||
|
|
|
@ -30,9 +30,11 @@ type
|
|||
# Declarations
|
||||
classDecl = 0u8,
|
||||
funDecl,
|
||||
asyncFunDecl,
|
||||
varDecl,
|
||||
# Statements
|
||||
forStmt,
|
||||
foreachStmt,
|
||||
ifStmt,
|
||||
returnStmt,
|
||||
breakStmt,
|
||||
|
@ -44,6 +46,7 @@ type
|
|||
delStmt,
|
||||
fromStmt,
|
||||
importStmt,
|
||||
awaitStmt,
|
||||
# An expression followed by a semicolon
|
||||
exprStmt,
|
||||
# Expressions
|
||||
|
|
|
@ -36,7 +36,7 @@ type
|
|||
Continue, Var, Let, Const, Is,
|
||||
Return, Async, Class, Import, From,
|
||||
IsNot, Raise, Assert, Del, Await,
|
||||
Dynamic
|
||||
Dynamic, Foreach
|
||||
|
||||
# Basic types
|
||||
|
||||
|
|
|
@ -463,8 +463,8 @@ proc statement(self: Parser): ASTNode =
|
|||
of TokenType.Import:
|
||||
discard self.step()
|
||||
result = self.importStmt()
|
||||
of TokenType.Async, TokenType.Await, TokenType.Dynamic:
|
||||
discard # TODO: Reserved for future use
|
||||
of TokenType.Async, TokenType.Await, TokenType.Dynamic, TokenType.Foreach:
|
||||
discard self.step() # TODO: Reserved for future use
|
||||
of TokenType.LeftBrace:
|
||||
discard self.step()
|
||||
result = self.blockStmt()
|
||||
|
|
Loading…
Reference in New Issue