mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Issue #2.
This commit is contained in:
@@ -420,6 +420,12 @@ func parseIdentifier() string {
|
||||
name := get().token
|
||||
next()
|
||||
output = "(" + parseFunctionCall(false, name) + ")"
|
||||
} else if seek("[") {
|
||||
output += "("+get().token
|
||||
next()
|
||||
expect("[")
|
||||
output += " select "+parseExpression(false)+")"
|
||||
expect("]")
|
||||
} else if accept("!") || accept("-") {
|
||||
output = get().token
|
||||
next()
|
||||
|
||||
@@ -129,6 +129,13 @@ func TestParserWaitUntil(t *testing.T) {
|
||||
equal(t, got, want)
|
||||
}
|
||||
|
||||
func TestParserArray(t *testing.T) {
|
||||
got := getCompiled(t, "test/parser_array.asl")
|
||||
want := "x = [1,2,3];\ny = (x select 1);\n"
|
||||
|
||||
equal(t, got, want)
|
||||
}
|
||||
|
||||
func getCompiled(t *testing.T, file string) string {
|
||||
code, err := ioutil.ReadFile(file)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user