Using term based expressions: grammar
This commit is contained in:
+4
-12
@@ -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* }
|
||||||
|
|||||||
Reference in New Issue
Block a user