This commit is contained in:
Marvin Blum
2015-10-25 18:34:45 +01:00
parent 2788ea1397
commit bf283cb87a
12 changed files with 22 additions and 84 deletions

View File

@@ -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()

View File

@@ -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)