forked from GitHub/gf-core
54 lines
1.2 KiB
CFEngine3
54 lines
1.2 KiB
CFEngine3
entrypoints Grammars;
|
|
|
|
Grammars. Grammars ::= [Grammar];
|
|
|
|
Grammar. Grammar ::= "grammar" Ident [Flag] [Rule] "end" "grammar";
|
|
separator Grammar "";
|
|
|
|
StartCat. Flag ::= "startcat" Category;
|
|
terminator Flag ";";
|
|
|
|
Rule. Rule ::= Ident ":" Name Profile "." Category "->" [Symbol];
|
|
terminator Rule ";";
|
|
|
|
Profile. Profile ::= "[" [Ints] "]";
|
|
|
|
Ints. Ints ::= "[" [Integer] "]";
|
|
separator Ints ",";
|
|
separator Integer ",";
|
|
|
|
CatS. Symbol ::= Category;
|
|
TermS. Symbol ::= String;
|
|
|
|
-- separator Symbol "";
|
|
[]. [Symbol] ::= "." ;
|
|
(:[]). [Symbol] ::= Symbol ;
|
|
(:). [Symbol] ::= Symbol [Symbol] ;
|
|
|
|
Name. Name ::= SingleQuoteString ;
|
|
Category. Category ::= SingleQuoteString ;
|
|
|
|
token SingleQuoteString '\'' ((char - ["'\\"]) | ('\\' ["'\\"]))* '\'' ;
|
|
|
|
{-
|
|
Name. Name ::= [IdentParam] Category;
|
|
terminator IdentParam "/";
|
|
|
|
Category. Category ::= IdentParam "." Ident [Proj] ;
|
|
|
|
IdentParam. IdentParam ::= Ident "{" [Field] "}" ;
|
|
|
|
Field. Field ::= "." KeyValue ;
|
|
terminator Field ";" ;
|
|
|
|
Proj. Proj ::= "!" Param ;
|
|
separator Proj "" ;
|
|
|
|
KeyValue. KeyValue ::= Ident "=" Param ;
|
|
separator KeyValue ";" ;
|
|
|
|
ParamSimple. Param ::= Ident ;
|
|
ParamPatt. Param ::= Ident "(" [Param] ")" ;
|
|
ParamRec. Param ::= "{" [KeyValue] "}" ;
|
|
separator Param "," ;
|
|
-} |