diff options
| author | Marc Vertes <mvertes@free.fr> | 2026-01-06 19:02:29 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2026-01-06 19:02:29 +0100 |
| commit | bffc031ea83c7176aac3d3828de0060c6630140c (patch) | |
| tree | 32e30f3bec94884936c2cfc2d53d3ae496e13d61 /parser/type.go | |
| parent | f07fc0178831432b68f1b9bd6c96b257aa2e9abe (diff) | |
fix: correct and simplify parsing of expressions.
The expressions were parsed from right to left, and it was incorrect and
cumbersome. Now they are processed from left to right, with a simpler
and correct handling of precedence rules.
The vm function call syntax has been changed to set the function
before the input arguments on the stack, as to follow the declaring
order in languages.
Diffstat (limited to 'parser/type.go')
| -rw-r--r-- | parser/type.go | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/parser/type.go b/parser/type.go index 12bc06b..70ed4d1 100644 --- a/parser/type.go +++ b/parser/type.go @@ -197,17 +197,3 @@ func (p *Parser) hasFirstParam(in Tokens) bool { s, _, ok := p.Symbols.Get(in[0].Str, p.scope) return !ok || s.Kind != symbol.Type } - -// typeStartIndex returns the index of the start of type expression in tokens, or -1. -func (p *Parser) typeStartIndex(in Tokens) int { - index := len(in) - 1 - for i := index; i >= 0; i-- { - switch in[i].Tok { - case lang.Ident, lang.Struct, lang.Map, lang.Func, lang.Interface, lang.Mul, lang.BraceBlock, lang.BracketBlock, lang.ParenBlock: - index = i - default: - return index - } - } - return -1 -} |
