Opertators
This commit is contained in:
@@ -75,10 +75,7 @@ while_stmt = {
|
||||
}
|
||||
|
||||
for_stmt = {
|
||||
"for" ~ "(" ~ (var_decl_no_semicolon | expr_stmt | ";")
|
||||
~ expr? ~ ";"
|
||||
~ expr? ~ ")"
|
||||
~ statement
|
||||
"for" ~ "(" ~ (var_decl_no_semicolon | expr_stmt | ";") ~ expr? ~ ";" ~ expr? ~ ")" ~ statement
|
||||
}
|
||||
|
||||
// helper (same as var_decl but no trailing ;)
|
||||
@@ -100,6 +97,9 @@ primary = {
|
||||
postfix = {
|
||||
("." ~ identifier)
|
||||
| ("(" ~ (expr ~ ("," ~ expr)*)? ~ ")")
|
||||
| ("[" ~ expr ~ "]")
|
||||
| ("++" | "--")
|
||||
| (("+" | "-" | "*" | "/" | "%") ~ primary)
|
||||
}
|
||||
|
||||
expr = {
|
||||
|
||||
+1
-10
@@ -1,12 +1,3 @@
|
||||
import "fmt";
|
||||
|
||||
struct Point {
|
||||
x: int,
|
||||
y: int
|
||||
}
|
||||
|
||||
function add(a: int, b: int): int {
|
||||
if (x) {
|
||||
if (y) return 1;
|
||||
}
|
||||
itm.a + itm.b();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user