From 362f7c9c45598b429c92e67756f41b690043e0c4 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 22 Mar 2024 16:59:25 +0100 Subject: feat: add initial support for import, provide minimal fmt (#6) The `import` statement is now parsed. It only provides minimal support for the `fmt` package (only `Println` symbol is defined). This should be sufficient to pass a few tests. Full support of package namespaces, source and binary imports will be supported later, based on this work. --- parser/expr.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'parser/expr.go') diff --git a/parser/expr.go b/parser/expr.go index 73b860e..4145240 100644 --- a/parser/expr.go +++ b/parser/expr.go @@ -83,17 +83,7 @@ func (p *Parser) ParseExpr(in Tokens) (out Tokens, err error) { // func call: push args and func address then call out = append(out, t) vl++ - if t2 := in[i-1]; t2.Id == lang.Ident { - if s, sc, ok := p.getSym(t2.Str, p.scope); ok { - log.Println("callExpr:", t2.Str, p.scope, s, ok, sc) - if s.kind == symValue { - // Store the number of input parameters in the token Beg field. - ops = append(ops, scanner.Token{Id: lang.CallX, Pos: t.Pos, Beg: p.numItems(t.Block(), lang.Comma)}) - break - } - } - } - ops = append(ops, scanner.Token{Id: lang.Call, Pos: t.Pos}) + ops = append(ops, scanner.Token{Id: lang.Call, Pos: t.Pos, Beg: p.numItems(t.Block(), lang.Comma)}) case lang.BracketBlock: out = append(out, t) vl++ -- cgit v1.2.3