Files
mgmt/lang/interpret_test/TestAstFunc2/lexer-parser0.txtar
James Shubin f92f34dc54 lang: The in keyword can't be a variable name
At least for now until we figure out some fancier parser magic. (If
at all possible!)
2024-01-12 18:22:00 -05:00

17 lines
462 B
Plaintext

-- main.mcl --
import "fmt"
# unfortunately, for now `in` is a reserved keyword, see:
# https://github.com/purpleidea/mgmt/issues/728
$map = 55
$fn = func($in) { # in is a special keyword
13
}
test fmt.printf("%d", $fn(0)) {}
func fn($in) { # in is a special keyword
42 + $map
}
test fmt.printf("%d", $fn(0)) {}
test fmt.printf("%d", fn(0)) {}
-- OUTPUT --
# err: errLexParse: parser: `syntax error: unexpected IN, expecting MAP_IDENTIFIER or IDENTIFIER` @5:2