summaryrefslogtreecommitdiff
path: root/lang/spec.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2026-01-07 12:09:20 +0100
committerMarc Vertes <mvertes@free.fr>2026-01-07 12:09:20 +0100
commitca80eeaa812b49afea75d3084d0c62770e4a8d18 (patch)
tree4670f02b9cb187485d229197d3c74c5cc46e9cfd /lang/spec.go
parent5ad2f3a0af1204bfe364ec165ecbd742c5ac1872 (diff)
fix: set 'HasInit' token property in language definition
Diffstat (limited to 'lang/spec.go')
-rw-r--r--lang/spec.go16
1 files changed, 4 insertions, 12 deletions
diff --git a/lang/spec.go b/lang/spec.go
index 37017e7..b8539e3 100644
--- a/lang/spec.go
+++ b/lang/spec.go
@@ -35,9 +35,10 @@ const (
// TokenProp represent token properties for parsing.
type TokenProp struct {
Token
- SkipSemi bool // automatic semicolon insertion after newline
- Precedence int // operator precedence
- Associativity
+ SkipSemi bool // automatic semicolon insertion after newline
+ Precedence int // operator precedence
+ Associativity //
+ HasInit bool // true if may have an init clause
}
// Spec represents the language specification for scanning.
@@ -52,12 +53,3 @@ type Spec struct {
NumUnder bool // true if a number can contain _ character
// TokenProps map[string]TokenProp // token properties
}
-
-// HasInit stores if a statement may contain a simple init statement.
-var HasInit = map[Token]bool{
- Case: true,
- For: true,
- If: true,
- Select: true,
- Switch: true,
-}