pascalabcnet/YMC/Components/AspectCore/ParserSources/Yacc.lp

28 lines
884 B
Plaintext

%CaseSensitive
%Extension "y"
Skip Begin "//"
Skip Begin "/*" End "*/"
Skip BeginEnd "'" EscapeSymbol "'"
Skip BeginEnd '\"' EscapeSymbol '\\'
Token LetterDigit [[:IsLetterOrDigit:]_]+
Token Sign [[:IsPunctuation:][:IsSymbol:]]
Rule @Action : "{" [Any|Action]* "}" //Áëîê êîäà, îãðàíè÷åííûé ôèãóðíûìè ñêîáêàìè
Rule @Program : #Section1 "%%" #Section2 "%%" #Section3 //Ñòàðòîâîå ïðàâèëî
Rule @Section1 : List0(S1Node) //Ñåêöèÿ 1 è åå ïîäóçëû
Rule S1Node : @"%{" @Any* @"%}"
| @"%" @AnyExcept("%%", "%", "{") @AnyExcept("%%", "%")*
| error
Rule @Section2 : List0(yRule) //Ñåêöèÿ 2 è åå ïîäóçëû
Rule yRule : @LetterDigit ":" List1(SubRule, "|") ";" //@LetterDigit ":" List1(SubRule, "|") ";"
| error
Rule SubRule : @List0(subRulePart)
Rule subRulePart : @AnyExcept("{", "|", ";")
| @Action
Rule @Section3 : Any*