mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-21 20:18:09 +03:00
[ABNF] Improve the grammar for operator calls.
Introduce the notion of postfix expression in the grammar, which will also go well with some expected upcoming extensions to Leo. This does not change the Leo language. It does not necessarily involve modifying the parser. It merely reorganizes some rules slightly.
This commit is contained in:
parent
846c976c63
commit
5539ce11a6
@ -233,20 +233,22 @@ primary-expression = identifier
|
||||
/ literal
|
||||
/ "(" expression ")"
|
||||
/ function-call
|
||||
/ operator-call
|
||||
|
||||
function-call = identifier function-arguments
|
||||
|
||||
operator-call = unary-operator-call / binary-operator-call
|
||||
|
||||
unary-operator-call = primary-expression "." identifier "(" ")"
|
||||
|
||||
binary-operator-call =
|
||||
primary-expression "." identifier "(" expression [ "," ] ")"
|
||||
|
||||
function-arguments = "(" [ expression *( "," expression ) [ "," ] ] ")"
|
||||
|
||||
unary-expression = primary-expression
|
||||
postfix-expression = primary-expression
|
||||
/ operator-call
|
||||
|
||||
operator-call = unary-operator-call / binary-operator-call
|
||||
|
||||
unary-operator-call = postfix-expression "." identifier "(" ")"
|
||||
|
||||
binary-operator-call =
|
||||
postfix-expression "." identifier "(" expression [ "," ] ")"
|
||||
|
||||
unary-expression = postfix-expression
|
||||
/ "!" unary-expression
|
||||
/ "-" unary-expression
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user