mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Fixed buildin function call problem, but found a new on in tokenizer
(e.g. "format" -> for, mat).
This commit is contained in:
3
ToDo.md
3
ToDo.md
@@ -8,5 +8,6 @@
|
||||
* ~~usage~~
|
||||
* recursive compiling
|
||||
* concurrent compiling
|
||||
* inline buildin function call -> foo(a)(bar(x)(y));
|
||||
* ~~inline buildin function call -> foo(a)(bar(x)(y));~~
|
||||
* ~~negative values e.g. -1, operator !~~
|
||||
* tokenizer splits commands like "format" -> for, mat
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
foo(player)("head");
|
||||
//diag_log format ["easyHC: found headless client with ID %1.", easyHCpresent];
|
||||
diag_log () (format(xy)("asdf", "hjkl"));
|
||||
|
||||
@@ -35,8 +35,6 @@ func parseBlock() {
|
||||
parseFunction()
|
||||
} else if accept("return") {
|
||||
parseReturn()
|
||||
} else if accept("sqf") {
|
||||
parseSqf()
|
||||
} else if accept("case") || accept("default") {
|
||||
return
|
||||
} else {
|
||||
@@ -234,19 +232,6 @@ func parseReturn() {
|
||||
appendOut(";", true)
|
||||
}
|
||||
|
||||
func parseSqf() {
|
||||
expect("sqf")
|
||||
expect(":")
|
||||
|
||||
for !accept("sqf") {
|
||||
appendOut(get().token, false)
|
||||
next()
|
||||
}
|
||||
|
||||
appendOut("", true)
|
||||
expect("sqf")
|
||||
}
|
||||
|
||||
// Everything that does not start with a keyword.
|
||||
func parseStatement() {
|
||||
// empty block
|
||||
@@ -301,7 +286,7 @@ func parseFunctionCall(out bool, name string) string {
|
||||
rightParams = "["+rightParams+"]"
|
||||
}
|
||||
|
||||
if leftParamCount > 1 {
|
||||
if leftParamCount > 0 {
|
||||
output = leftParams+" "+name+" "+rightParams
|
||||
} else {
|
||||
output = name+" "+rightParams
|
||||
|
||||
@@ -89,7 +89,7 @@ func TestParserFunctionCall(t *testing.T) {
|
||||
|
||||
func TestParserBuildinFunctionCall(t *testing.T) {
|
||||
got := getCompiled(t, "test/parser_buildin_func.asl")
|
||||
want := "_x = (setHit \"head\");\n"
|
||||
want := "_x = (([player, foo] getVar bar) setHit [\"head\", \"tail\"]);\n"
|
||||
|
||||
equal(t, got, want)
|
||||
}
|
||||
|
||||
@@ -41,8 +41,7 @@ var keywords = []string{
|
||||
"false",
|
||||
"case",
|
||||
"default",
|
||||
"return",
|
||||
"sqf"}
|
||||
"return"}
|
||||
|
||||
var whitespace = []byte{' ', '\n', '\t'}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
var _x = setHit(player)("head");
|
||||
var _x = setHit(getVar(player, foo)(bar))("head", "tail");
|
||||
|
||||
Reference in New Issue
Block a user