summaryrefslogtreecommitdiff
path: root/parser
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2024-03-13 16:05:35 +0100
committerGitHub <noreply@github.com>2024-03-13 16:05:35 +0100
commitcd75db8c69365ac5c8e967f9a941b9fb128b0b00 (patch)
tree868788ae55507736784a1db73585d1536394c47e /parser
parent60170bad25f912e0ba44e4c0095b54f6e26e307e (diff)
parenta7f99d19978e5bf337be3e778f5376f346f69c4a (diff)
Merge pull request #5 from ajnavarro/fix/small-fixes
Fix: small README fixes and throw an error if expression not supported.
Diffstat (limited to 'parser')
-rw-r--r--parser/README.md2
-rw-r--r--parser/expr.go3
2 files changed, 4 insertions, 1 deletions
diff --git a/parser/README.md b/parser/README.md
index 118d9aa..b233248 100644
--- a/parser/README.md
+++ b/parser/README.md
@@ -13,7 +13,7 @@ The input of parser is a list of tokens produced by the scanner.
Multiple tokens are processed at once. The minimal set to get
meaningful results (not an error or nil) is a complete statement.
-The output of parser is also a list of tokens, to be consummed by
+The output of parser is also a list of tokens, to be consumed by
the compiler to produce bytecode. The output tokens set is identical
to the bytecode instructions set except that:
diff --git a/parser/expr.go b/parser/expr.go
index 91c093f..e4cef1a 100644
--- a/parser/expr.go
+++ b/parser/expr.go
@@ -1,6 +1,7 @@
package parser
import (
+ "fmt"
"log"
"strconv"
@@ -86,6 +87,8 @@ func (p *Parser) ParseExpr(in Tokens) (out Tokens, err error) {
out = append(out, t)
vl++
ops = append(ops, scanner.Token{Str: "index", Id: lang.Index, Pos: t.Pos})
+ default:
+ return nil, fmt.Errorf("expression not supported yet: %q", t.Str)
}
if len(selectors) > 0 {
out = append(out, selectors...)