%start ParolLs %title "Parol grammar" %comment "Parol's own grammar enhanced with comment processing" %line_comment "//" %block_comment "/\*" "\*/" %user_type OwnedToken = crate::parol_ls_grammar::OwnedToken %% /* 0 */ ParolLs: Prolog GrammarDefinition; /* 1 */ Prolog: StartDeclaration PrologList /* Vec */ PrologList0 /* Vec */; /* 2 */ PrologList0 /* Vec::Push */: ScannerState PrologList0; /* 3 */ PrologList0 /* Vec::New */: ; /* 4 */ PrologList /* Vec::Push */: Declaration PrologList; /* 5 */ PrologList /* Vec::New */: ; /* 6 */ StartDeclaration: "%start" : OwnedToken Identifier; /* 7 */ Declaration: "%title" : OwnedToken String; /* 8 */ Declaration: "%comment" : OwnedToken String; /* 9 */ Declaration: "%user_type" : OwnedToken Identifier "=" : OwnedToken UserTypeName; /* 10 */ Declaration: '%grammar_type' : OwnedToken LiteralString; /* 11 */ Declaration: ScannerDirectives; /* 12 */ ScannerDirectives: "%line_comment" : OwnedToken TokenLiteral; /* 13 */ ScannerDirectives: "%block_comment" : OwnedToken TokenLiteral TokenLiteral; /* 14 */ ScannerDirectives: "%auto_newline_off" : OwnedToken; /* 15 */ ScannerDirectives: "%auto_ws_off" : OwnedToken; /* 16 */ ScannerDirectives: '%on' : OwnedToken IdentifierList '%enter' : OwnedToken Identifier; /* 17 */ GrammarDefinition: "%%" : OwnedToken Production GrammarDefinitionList /* Vec */; /* 18 */ GrammarDefinitionList /* Vec::Push */: Production GrammarDefinitionList; /* 19 */ GrammarDefinitionList /* Vec::New */: ; /* 20 */ DoubleColon: "::" : OwnedToken; /* 21 */ ProductionLHS: Identifier ":" : OwnedToken; /* 22 */ Production: ProductionLHS Alternations ";" : OwnedToken; /* 23 */ Alternations: Alternation AlternationsList /* Vec */; /* 24 */ AlternationsList /* Vec::Push */: '|' : OwnedToken Alternation AlternationsList; /* 25 */ AlternationsList /* Vec::New */: ; /* 26 */ Alternation: AlternationList /* Vec */; /* 27 */ AlternationList /* Vec::Push */: Factor AlternationList; /* 28 */ AlternationList /* Vec::New */: ; /* 29 */ Factor: Group; /* 30 */ Factor: Repeat; /* 31 */ Factor: Optional; /* 32 */ Factor: Symbol; /* 33 */ Symbol: NonTerminal; /* 34 */ Symbol: SimpleToken; /* 35 */ Symbol: TokenWithStates; /* 36 */ Symbol: ScannerSwitch; /* 37 */ TokenLiteral: String; /* 38 */ TokenLiteral: LiteralString; /* 39 */ TokenLiteral: Regex; /* 40 */ SimpleToken: TokenLiteral SimpleTokenOpt /* Option */; /* 41 */ SimpleTokenOpt /* Option::Some */: ASTControl; /* 42 */ SimpleTokenOpt /* Option::None */: ; /* 43 */ TokenWithStates: "<" : OwnedToken IdentifierList ">" : OwnedToken TokenLiteral TokenWithStatesOpt /* Option */; /* 44 */ TokenWithStatesOpt /* Option::Some */: ASTControl; /* 45 */ TokenWithStatesOpt /* Option::None */: ; /* 46 */ Group: '(' : OwnedToken Alternations ')' : OwnedToken; /* 47 */ Optional: '[' : OwnedToken Alternations ']' : OwnedToken; /* 48 */ Repeat: '{' : OwnedToken Alternations '}' : OwnedToken; /* 49 */ NonTerminal: Identifier NonTerminalOpt /* Option */; /* 50 */ NonTerminalOpt /* Option::Some */: ASTControl; /* 51 */ NonTerminalOpt /* Option::None */: ; /* 52 */ Identifier: /[a-zA-Z_][a-zA-Z0-9_]*/ : OwnedToken; /* 53 */ String: /"(\\.|[^\\])*?"/ : OwnedToken; /* 54 */ LiteralString: /'(\\'|[^'])*?'/ : OwnedToken; /* 55 */ ScannerState: "%scanner" : OwnedToken Identifier '{' : OwnedToken ScannerStateList /* Vec */ '}' : OwnedToken; /* 56 */ ScannerStateList /* Vec::Push */: ScannerDirectives ScannerStateList; /* 57 */ ScannerStateList /* Vec::New */: ; /* 58 */ IdentifierList: Identifier IdentifierListList /* Vec */; /* 59 */ IdentifierListList /* Vec::Push */: "," : OwnedToken Identifier IdentifierListList; /* 60 */ IdentifierListList /* Vec::New */: ; /* 61 */ ScannerSwitch: "%sc" : OwnedToken '(' : OwnedToken ScannerSwitchOpt /* Option */ ')' : OwnedToken; /* 62 */ ScannerSwitch: "%push" : OwnedToken '(' : OwnedToken Identifier ')' : OwnedToken; /* 63 */ ScannerSwitch: "%pop" : OwnedToken '(' : OwnedToken ')' : OwnedToken; /* 64 */ ScannerSwitchOpt /* Option::Some */: Identifier; /* 65 */ ScannerSwitchOpt /* Option::None */: ; /* 66 */ ASTControl: CutOperator; /* 67 */ ASTControl: UserTypeDeclaration; /* 68 */ CutOperator: '^' : OwnedToken; /* 69 */ UserTypeDeclaration: ":" : OwnedToken UserTypeName; /* 70 */ UserTypeName: Identifier UserTypeNameList /* Vec */; /* 71 */ UserTypeNameList /* Vec::Push */: DoubleColon Identifier UserTypeNameList; /* 72 */ UserTypeNameList /* Vec::New */: ; /* 73 */ Regex: /\u{2f}(\\.|[^\\])*?\u{2f}/ : OwnedToken;