summaryrefslogtreecommitdiff
path: root/parser/parse.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2023-11-15 11:59:15 +0100
committerMarc Vertes <mvertes@free.fr>2023-11-15 11:59:15 +0100
commita4d7fb2da6a8390b818dae8d07391c7d76e365e9 (patch)
tree166d1ed4bb07337ead19fd4f7ebc8d79885e2cfd /parser/parse.go
parent2eab5877e1c634db872b595dd2414f4031ae4eb5 (diff)
parser: hande const declarations
Only symbols are produced, no bytecode is emitted. The constant expressions are evaluated at compile time using the stdlib package go/constant. The parser handles implicit repetition of the last non-empty expression list. The iota symbol is reset to 0 and incremented for each line of a const block. To be done in a next commit: type conversions.
Diffstat (limited to 'parser/parse.go')
-rw-r--r--parser/parse.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/parser/parse.go b/parser/parse.go
index 7de73b6..131e9c0 100644
--- a/parser/parse.go
+++ b/parser/parse.go
@@ -75,6 +75,8 @@ func (p *Parser) ParseStmt(in Tokens) (out Tokens, err error) {
return p.ParseBreak(in)
case lang.Continue:
return p.ParseContinue(in)
+ case lang.Const:
+ return p.ParseConst(in)
case lang.For:
return p.ParseFor(in)
case lang.Func: