diff --git a/.project b/.project deleted file mode 100644 index 70e02e7..0000000 --- a/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - asl - - - - - - com.googlecode.goclipse.goBuilder - - - - - - com.googlecode.goclipse.core.goNature - - diff --git a/ToDo.md b/ToDo.md deleted file mode 100644 index e9acb4c..0000000 --- a/ToDo.md +++ /dev/null @@ -1,23 +0,0 @@ -# ToDo - -* ~~assign to returned values~~ -* ~~sqf: ... sqf whitespace~~ -* ~~solution for build in commands which do not require left values~~ -* ~~pretty/minified printing~~ -* ~~usage~~ -* ~~recursive compiling~~ -* ~~concurrent compiling~~ -* ~~inline buildin function call -> foo(a)(bar(x)(y));~~ -* ~~negative values e.g. -1, operator !~~ -* ~~tokenizer splits commands like "format" -> for, mat~~ -* ~~try ... catch~~ -* ~~better error reporting~~ - - ~~recover panic~~ - - ~~line, column~~ -* type check for functions - -## Special cases - -* ~~exitWith...~~ -* ~~waitUntil...~~ -* ~~!buildInFunc()()...~~ diff --git a/build b/build new file mode 100755 index 0000000..3c3c785 --- /dev/null +++ b/build @@ -0,0 +1,6 @@ +#!/bin/bash + +export GOROOT=/usr/local/go +export PATH=$PATH:$GOROOT/bin +export GOPATH=/home/marvin/Projekte/asl +go build -ldflags "-s -w" src/main/asl.go diff --git a/run b/run new file mode 100755 index 0000000..97c361c --- /dev/null +++ b/run @@ -0,0 +1,6 @@ +#!/bin/bash + +export GOROOT=/usr/local/go +export PATH=$PATH:$GOROOT/bin +export GOPATH=/home/marvin/Projekte/asl +go run src/main/asl.go $1 $2 diff --git a/run_tests b/run_tests new file mode 100755 index 0000000..416801c --- /dev/null +++ b/run_tests @@ -0,0 +1,6 @@ +#!/bin/bash + +export GOROOT=/usr/local/go +export PATH=$PATH:$GOROOT/bin +export GOPATH=/home/marvin/Projekte/asl +go test parser tokenizer types diff --git a/src/parser/parser_test.go b/src/parser/parser_test.go index 9f0c815..a76bf51 100644 --- a/src/parser/parser_test.go +++ b/src/parser/parser_test.go @@ -35,7 +35,7 @@ func TestParserIf(t *testing.T) { func TestParserWhile(t *testing.T) { got := getCompiled(t, "../../test/tokenizer_while.asl") - want := "while {true} do {\r\n};" + want := "while {true} do {\r\n};\r\n" equal(t, got, want) } @@ -195,6 +195,14 @@ func TestParserExpressionArray(t *testing.T) { equal(t, got, want) } +// bugfix: unary function parsing (e.g. "format") +func TestBugfixParserUnaryFunction(t *testing.T) { + got := getCompiled(t, "../../test/bugfix_unary_func_format.asl") + want := "format [\"%1 %2\", \"value1\", \"value2\"];\r\n[\"a\", \"b\", \"c\"] call someFunc;\r\n" + + equal(t, got, want) +} + func getCompiled(t *testing.T, file string) string { code, err := ioutil.ReadFile(file) diff --git a/test/bugfix_unary_func_format.asl b/test/bugfix_unary_func_format.asl new file mode 100644 index 0000000..a2bdfb8 --- /dev/null +++ b/test/bugfix_unary_func_format.asl @@ -0,0 +1,2 @@ +format("%1 %2", "value1", "value2"); // must result in format [...]; +someFunc("a", "b", "c"); // must result in ... call someFunc;