# -*- text -*-
# Parsing Expression Grammar 'TEMPLATE'.
# Generated for unknown, from file 'TEST'

PEG TEMPLATE (Grammar)

leaf: ALNUM         <- '<alnum>' WHITESPACE ;
leaf: ALPHA         <- '<alpha>' WHITESPACE ;
leaf: AND           <- '&' WHITESPACE ;
void: APOSTROPH     <- '\'' ;
leaf: ASCII         <- '<ascii>' WHITESPACE ;
      Attribute     <- (VOID / LEAF) COLON ;
      Char          <- CharSpecial / CharOctalFull / CharOctalPart / CharUnicode / CharUnescaped ;
leaf: CharOctalFull <- '\\' [0-2] [0-7] [0-7] ;
leaf: CharOctalPart <- '\\' [0-7] [0-7]? ;
leaf: CharSpecial   <- '\\' [nrt\'\"\[\]\\] ;
leaf: CharUnescaped <- !'\\' . ;
leaf: CharUnicode   <- '\\u' <xdigit> (<xdigit> (<xdigit> <xdigit>?)?)? ;
      Class         <- OPENB (!CLOSEB Range)* CLOSEB WHITESPACE ;
void: CLOSE         <- ')' WHITESPACE ;
void: CLOSEB        <- '\]' ;
void: COLON         <- ':' WHITESPACE ;
void: COMMENT       <- '#' (!EOL .)* EOL ;
leaf: CONTROL       <- '<control>' WHITESPACE ;
void: DAPOSTROPH    <- '\"' ;
leaf: DDIGIT        <- '<ddigit>' WHITESPACE ;
      Definition    <- Attribute? Identifier IS Expression SEMICOLON ;
leaf: DIGIT         <- '<digit>' WHITESPACE ;
leaf: DOT           <- '.' WHITESPACE ;
void: EOF           <- !. ;
void: EOL           <- [\n\r] ;
      Expression    <- Sequence (SLASH Sequence)* ;
void: Final         <- 'END' WHITESPACE SEMICOLON WHITESPACE ;
      Grammar       <- WHITESPACE Header Definition* Final EOF ;
leaf: GRAPH         <- '<graph>' WHITESPACE ;
      Header        <- PEG Identifier StartExpr ;
leaf: Ident         <- ([_:] / <alpha>) ([_:] / <alnum>)* ;
      Identifier    <- Ident WHITESPACE ;
void: IS            <- '<-' WHITESPACE ;
leaf: LEAF          <- 'leaf' WHITESPACE ;
      Literal       <- APOSTROPH (!APOSTROPH Char)* APOSTROPH WHITESPACE / DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
leaf: LOWER         <- '<lower>' WHITESPACE ;
leaf: NOT           <- '!' WHITESPACE ;
void: OPEN          <- '(' WHITESPACE ;
void: OPENB         <- '\[' ;
void: PEG           <- 'PEG' !([_:] / <alnum>) WHITESPACE ;
leaf: PLUS          <- '+' WHITESPACE ;
      Prefix        <- (AND / NOT)? Suffix ;
      Primary       <- ALNUM / ALPHA / ASCII / CONTROL / DDIGIT / DIGIT / GRAPH / LOWER / PRINTABLE / PUNCT / SPACE / UPPER / WORDCHAR / XDIGIT / Identifier / OPEN Expression CLOSE / Literal / Class / DOT ;
leaf: PRINTABLE     <- '<print>' WHITESPACE ;
leaf: PUNCT         <- '<punct>' WHITESPACE ;
leaf: QUESTION      <- '?' WHITESPACE ;
      Range         <- Char TO Char / Char ;
void: SEMICOLON     <- ';' WHITESPACE ;
      Sequence      <- Prefix+ ;
void: SLASH         <- '/' WHITESPACE ;
leaf: SPACE         <- '<space>' WHITESPACE ;
leaf: STAR          <- '*' WHITESPACE ;
      StartExpr     <- OPEN Expression CLOSE ;
      Suffix        <- Primary (QUESTION / STAR / PLUS)? ;
void: TO            <- '-' ;
leaf: UPPER         <- '<upper>' WHITESPACE ;
leaf: VOID          <- 'void' WHITESPACE ;
void: WHITESPACE    <- (<space> / COMMENT)* ;
leaf: WORDCHAR      <- '<wordchar>' WHITESPACE ;
leaf: XDIGIT        <- '<xdigit>' WHITESPACE ;

END;

#
#
