Files
mgmt/lang/interpret_test/TestAstFunc2/lexer-parser0.txtar
James Shubin 9c1c587f7b
Some checks failed
/ Test (basic) on ubuntu-latest with golang 1.23 (push) Has been cancelled
/ Test (race) on ubuntu-latest with golang 1.23 (push) Has been cancelled
/ Test (shell) on ubuntu-latest with golang 1.23 (push) Has been cancelled
lang: parse, core: world: Add a collect package
This lets us look at the available resource data for collection, and to
filter it so we can decide what we want to collect on our machine.

Other types of collect functions could be added in the future.
2025-04-05 17:00:53 -04:00

17 lines
484 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 or COLLECT_IDENTIFIER` @5:2