Skip to content

Commit

Permalink
refacror grammar: rename expr to literal-expr and expr2 to expr
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Gramer <[email protected]>
  • Loading branch information
vgramer committed Jan 22, 2021
1 parent a0ddb2b commit dea6eb8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/grammar/Rego.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ module ::= package (import| rule)*
package ::= "package" ref
import ::= "import" ref ( "as" var )?
rule ::= "default"? rule-head rule-body*
rule-head ::= var ( "(" rule-args? ")" )? ("[" term "]" )? ( ( ":=" | "=" ) expr2 )?
rule-head ::= var ( "(" rule-args? ")" )? ("[" term "]" )? ( ( ":=" | "=" ) expr )?
rule-args ::= term ( "," term )*
rule-body ::= else-expr | query-block
else-expr ::= else "=" expr2 query-block? | else "="? query-block
else-expr ::= else "=" expr query-block? | else "="? query-block
query-block ::= "{" query "}"
query ::= ( literal |';' )+
literal ::= ( some-decl | expr | "not" expr ) with-modifier*
literal ::= ( some-decl | literal-expr | "not" literal-expr ) with-modifier*
with-modifier ::= "with" term "as" term
some-decl ::= "some" var ( "," var )*
expr ::= expr2 ((':=' | '=') expr2)?
expr2 ::= expr-infix | (expr-call ref-arg*) | term
expr-call ::= var ref-arg-dot* "(" ( expr2 ( "," expr2 )* )? ")"
literal-expr ::= expr ((':=' | '=') expr)?
expr ::= expr-infix | (expr-call ref-arg*) | term
expr-call ::= var ref-arg-dot* "(" ( expr ( "," expr )* )? ")"
expr-infix ::= factor-expr (infix-operator factor-expr)*
factor-expr ::= ("(" expr-infix ")") | term
term ::= ref | var | scalar | array | object | set | array-compr | object-compr | set-compr
Expand All @@ -92,14 +92,14 @@ arith-operator ::= "+" | "-" | "*" | "/" | "%"
bin-operator ::= "&" | "|"
ref ::= ( expr-call | array | object | set | array-compr | object-compr | set-compr |var ) ref-arg*
ref-arg ::= ref-arg-dot | ref-arg-brack
ref-arg-brack ::= "[" ( expr2 | "_" ) "]"
ref-arg-brack ::= "[" ( expr | "_" ) "]"
ref-arg-dot ::= "." var
var ::= ASCII_LETTER
scalar ::= string | NUMBER | TRUE | FALSE | NULL
string ::= STRING_TOKEN| RAW_STRING
array ::= '[' expr2? ( ',' expr2 )* ','? ']'
array ::= '[' expr? ( ',' expr )* ','? ']'
object ::= '{' object-item? ( ',' object-item )* ','? '}'
object-item ::= ( scalar | ref | var ) ":" expr2
object-item ::= ( scalar | ref | var ) ":" expr
set ::= empty-set | non-empty-set
non-empty-set ::= "{" term ( "," term )* ','? "}"
empty-set ::= "set(" ")"
Expand Down

0 comments on commit dea6eb8

Please sign in to comment.