mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
More testing, fixes, ...
This commit is contained in:
@@ -1,35 +1,3 @@
|
|||||||
var _a = 1;
|
while true {
|
||||||
var _b = 2;
|
|
||||||
|
|
||||||
func myFunc(_x, _y) {
|
|
||||||
if _x < _y {
|
|
||||||
myFunc(_y, _x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if _a < _b {
|
|
||||||
if _b < _a {
|
|
||||||
myFunc(_a, _b+9-(2/2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_a+_b)/2 > 10 {
|
|
||||||
hint("a");
|
|
||||||
} else {
|
|
||||||
myFunc("multiple", "statements");
|
|
||||||
hint("b");
|
|
||||||
}
|
|
||||||
|
|
||||||
myFunc(_a, _b);
|
|
||||||
myFunc(_a, _b);
|
|
||||||
|
|
||||||
var _x = 3;
|
|
||||||
|
|
||||||
switch _x {
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
somefunc(2);
|
|
||||||
default:
|
|
||||||
somefunc(3);
|
|
||||||
_x = -1;
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,57 @@
|
|||||||
each array {
|
func foo(_out) {
|
||||||
foo(_x);
|
hint(_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func bar(_out) {
|
||||||
|
hint(reverse(_out));
|
||||||
|
}
|
||||||
|
|
||||||
|
func inlineFunction(_multiple, _parameters, _should, _work) {
|
||||||
|
_a = "Not working yet...";
|
||||||
|
}
|
||||||
|
|
||||||
|
var _array;
|
||||||
|
|
||||||
|
each array {
|
||||||
|
if _x > 200 {
|
||||||
|
foo(_x);
|
||||||
|
} else {
|
||||||
|
bar("nope", _x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _x = 123;
|
||||||
|
|
||||||
|
for var _i = 0; _i < 10; _i = _i+1; {
|
||||||
|
_x = _x+1;
|
||||||
|
_foo = "Foo";
|
||||||
|
_bar = "Bar";
|
||||||
|
fun(_foo, _bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch _x {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
somefunc(2);
|
||||||
|
default:
|
||||||
|
somefunc(3);
|
||||||
|
_x = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
func myFunc(_x, _y) {
|
||||||
|
if _x < _y {
|
||||||
|
myFunc(_y, _x);
|
||||||
|
hint("Rekursiv");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if _a < _b {
|
||||||
|
if _b < _a {
|
||||||
|
myFunc(_a, _b+9-(2/2));
|
||||||
|
myFunc(_a, _b);
|
||||||
|
myFunc(_a, _b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myFunc(_a, _b);
|
||||||
|
myFunc(_a, _b);
|
||||||
|
|||||||
Binary file not shown.
@@ -156,7 +156,7 @@ func parseForeach() {
|
|||||||
appendOut("{\n")
|
appendOut("{\n")
|
||||||
parseBlock()
|
parseBlock()
|
||||||
expect("}")
|
expect("}")
|
||||||
appendOut("} forEach ("+expr+");")
|
appendOut("} forEach ("+expr+");\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseFunction() {
|
func parseFunction() {
|
||||||
@@ -183,7 +183,7 @@ func parseFunctionParameter() {
|
|||||||
for !accept(")") {
|
for !accept(")") {
|
||||||
name := get().token
|
name := get().token
|
||||||
next()
|
next()
|
||||||
appendOut(name+" = this select "+strconv.FormatInt(i, 10)+";\n")
|
appendOut(name+" = _this select "+strconv.FormatInt(i, 10)+";\n")
|
||||||
i++
|
i++
|
||||||
|
|
||||||
if !accept(")") {
|
if !accept(")") {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package asl
|
package asl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -61,13 +60,6 @@ func Tokenize(code []byte) []Token {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TEST
|
|
||||||
fmt.Println("Tokens:")
|
|
||||||
for i := range tokens {
|
|
||||||
fmt.Println(tokens[i].token)
|
|
||||||
}
|
|
||||||
fmt.Println("---")
|
|
||||||
|
|
||||||
return tokens
|
return tokens
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user