diff --git a/in/simple.asl b/in/simple.asl index c168559..f5a6680 100644 --- a/in/simple.asl +++ b/in/simple.asl @@ -1 +1 @@ -var inline_code = code(""); +var inline_code = code("var a = 1;var b = 2;if a < b {foo();}"); diff --git a/src/asl/parser.go b/src/asl/parser.go index 8315e1b..090e4c4 100644 --- a/src/asl/parser.go +++ b/src/asl/parser.go @@ -297,7 +297,8 @@ func (c *Compiler) parseInlineCode() string { output := "{}" if len(code) > 2 { - //output = "{"+Parse(Tokenize([]byte(code[1:len(code)-1])), pretty)+"}" + compiler := Compiler{} + output = "{"+compiler.Parse(Tokenize([]byte(code[1:len(code)-1])), false)+"}" } c.expect(")") diff --git a/src/asl/parser_test.go b/src/asl/parser_test.go index a02137e..c470f9a 100644 --- a/src/asl/parser_test.go +++ b/src/asl/parser_test.go @@ -146,6 +146,13 @@ func TestParserFunctionParams(t *testing.T) { equal(t, got, want) } +func TestParserInlineCode(t *testing.T) { + got := getCompiled(t, "test/parser_code.asl") + want := "inline_code = {a = 1;b = 2;if (a