diff options
| author | Marc Vertes <mvertes@free.fr> | 2023-11-07 21:49:01 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2023-11-07 21:49:01 +0100 |
| commit | bb783f8f31797597ca0349434e236e6df923e14b (patch) | |
| tree | a0a04a3cae098366d692e892c89a7e9fe614452b /lang | |
| parent | 819826627f90aecdd1d91e24563fe2162061ccf2 (diff) | |
parser: implement switch statement
A VM instruction `EqualSet` has been added to preserve the left
operand on the stack in case of failure, to allow efficient
multiple tests on the same value.
Both the pattern 'if/else if' and the classical case clauses have
been implemented.
Diffstat (limited to 'lang')
| -rw-r--r-- | lang/token.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lang/token.go b/lang/token.go index 880f474..95a1be5 100644 --- a/lang/token.go +++ b/lang/token.go @@ -109,6 +109,7 @@ const ( JumpFalse JumpSetFalse JumpSetTrue + EqualSet ) func (t TokenId) IsKeyword() bool { return t >= Break && t <= Var } |
