Improving operators and suffix

This commit is contained in:
2026-05-21 07:05:58 +02:00
parent b28591f9e6
commit 0878b9f0b9
7 changed files with 43 additions and 72 deletions
+29 -32
View File
@@ -343,7 +343,7 @@ block = {
}
statement = _{
((expr | basic_stmt_left_recurse) ~ semicolon)
(expr ~ semicolon)
}
// ------------------------------------------------------
@@ -357,12 +357,6 @@ basic_stmt = {
| var_decl_statement
}
basic_stmt_left_recurse = {
increment_statement
| decrement_statement
| assign_statement
}
return_stmt = {
"return" ~ expr?
}
@@ -379,31 +373,6 @@ var_decl_statement = {
var_decl ~ ("=" ~ expr)?
}
increment_statement = {
expr ~ "++"
}
decrement_statement = {
expr ~ "--"
}
compound_assign = {
"="
| "+="
| "-="
| "/="
| "%="
| "&="
| "|="
| "^="
| "<<="
| ">>="
}
assign_statement = {
expr ~ compound_assign ~ expr ~ semicolon
}
// ------------------------------------------------------
// CONDITIONALS
// ------------------------------------------------------
@@ -536,6 +505,31 @@ try_px = {
"?"
}
increment = {
"++"
}
decrement = {
"--"
}
compound_assign = {
"="
| "+="
| "-="
| "/="
| "%="
| "&="
| "|="
| "^="
| "<<="
| ">>="
}
assign = {
compound_assign ~ expr
}
postfix = {
field_px
| call_px
@@ -544,6 +538,9 @@ postfix = {
| index_px
| as_px
| try_px
| increment
| decrement
| assign
}
// ------------------------------------------------------