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

PEG TEMPLATE (Grammar)

leaf: ALNUM         <- '<' 'a' 'l' 'n' 'u' 'm' '>' WHITESPACE ;
leaf: ALPHA         <- '<' 'a' 'l' 'p' 'h' 'a' '>' WHITESPACE ;
leaf: AND           <- '&' WHITESPACE ;
void: APOSTROPH     <- '\'' ;
leaf: ASCII         <- '<' 'a' 's' 'c' 'i' 'i' '>' 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   <- '\\' ('n' / 'r' / 't' / '\'' / '\"' / '\[' / '\]' / '\\') ;
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       <- '<' 'c' 'o' 'n' 't' 'r' 'o' 'l' '>' WHITESPACE ;
void: DAPOSTROPH    <- '\"' ;
leaf: DDIGIT        <- '<' 'd' 'd' 'i' 'g' 'i' 't' '>' WHITESPACE ;
      Definition    <- Attribute? Identifier IS Expression SEMICOLON ;
leaf: DIGIT         <- '<' 'd' 'i' 'g' 'i' 't' '>' WHITESPACE ;
leaf: DOT           <- '.' WHITESPACE ;
void: EOF           <- !. ;
void: EOL           <- '\n' / '\r' ;
      Expression    <- Sequence (SLASH Sequence)* ;
void: Final         <- 'E' 'N' 'D' WHITESPACE SEMICOLON WHITESPACE ;
      Grammar       <- WHITESPACE Header Definition* Final EOF ;
leaf: GRAPH         <- '<' 'g' 'r' 'a' 'p' 'h' '>' WHITESPACE ;
      Header        <- PEG Identifier StartExpr ;
leaf: Ident         <- ('_' / ':' / <alpha>) ('_' / ':' / <alnum>)* ;
      Identifier    <- Ident WHITESPACE ;
void: IS            <- '<' '-' WHITESPACE ;
leaf: LEAF          <- 'l' 'e' 'a' 'f' WHITESPACE ;
      Literal       <- APOSTROPH (!APOSTROPH Char)* APOSTROPH WHITESPACE / DAPOSTROPH (!DAPOSTROPH Char)* DAPOSTROPH WHITESPACE ;
leaf: LOWER         <- '<' 'l' 'o' 'w' 'e' 'r' '>' WHITESPACE ;
leaf: NOT           <- '!' WHITESPACE ;
void: OPEN          <- '(' WHITESPACE ;
void: OPENB         <- '\[' ;
void: PEG           <- 'P' 'E' 'G' !('_' / ':' / <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     <- '<' 'p' 'r' 'i' 'n' 't' '>' WHITESPACE ;
leaf: PUNCT         <- '<' 'p' 'u' 'n' 'c' 't' '>' WHITESPACE ;
leaf: QUESTION      <- '?' WHITESPACE ;
      Range         <- Char TO Char / Char ;
void: SEMICOLON     <- ';' WHITESPACE ;
      Sequence      <- Prefix+ ;
void: SLASH         <- '/' WHITESPACE ;
leaf: SPACE         <- '<' 's' 'p' 'a' 'c' 'e' '>' WHITESPACE ;
leaf: STAR          <- '*' WHITESPACE ;
      StartExpr     <- OPEN Expression CLOSE ;
      Suffix        <- Primary (QUESTION / STAR / PLUS)? ;
void: TO            <- '-' ;
leaf: UPPER         <- '<' 'u' 'p' 'p' 'e' 'r' '>' WHITESPACE ;
leaf: VOID          <- 'v' 'o' 'i' 'd' WHITESPACE ;
void: WHITESPACE    <- (<space> / COMMENT)* ;
leaf: WORDCHAR      <- '<' 'w' 'o' 'r' 'd' 'c' 'h' 'a' 'r' '>' WHITESPACE ;
leaf: XDIGIT        <- '<' 'x' 'd' 'i' 'g' 'i' 't' '>' WHITESPACE ;

END;

#
#
