Using term based expressions: grammar

This commit is contained in:
2026-05-17 02:18:09 +02:00
parent 6a0011c009
commit 675e357297
+4 -12
View File
@@ -475,17 +475,12 @@ index_px = {
"[" ~ expr ~ "]" "[" ~ expr ~ "]"
} }
binary_px = {
bin_op ~ expr
}
postfix = { postfix = {
field_px field_px
| call_px | call_px
| macro_call_px | macro_call_px
| struct_px | struct_px
| index_px | index_px
| binary_px
} }
// ------------------------------------------------------ // ------------------------------------------------------
@@ -520,10 +515,6 @@ prefix = {
| not_px | not_px
} }
prefix_list = {
prefix*
}
// ------------------------------------------------------ // ------------------------------------------------------
// OPERATORS // OPERATORS
// ------------------------------------------------------ // ------------------------------------------------------
@@ -548,6 +539,7 @@ bin_op = {
// EXPRESSIONS // EXPRESSIONS
// ------------------------------------------------------ // ------------------------------------------------------
expr = { expr = { term ~ (bin_op ~ term)* }
prefix_list ~ primary ~ postfix*
} // A term is anything that acts as a single unit in an operation
term = _{ prefix* ~ primary ~ postfix* }