EBNF Rule: Character Class
EBNF

Prev:EBNF Rule: Not
Next:EBNF Foreign Rules


Character class matching can be done using a range of characters defined in square brackets. Multiple ranges can be included in a single character class definition. The syntax for the range is a start character, followed by a minus (-) followed by an end character. For example [a-zA-Z]. To include the minus (-) character in the class, make it the first or the last one: [-0-9] or [a-z-]. The AST resulting from the match is an integer of the character code for the character that matched.

Examples
USING: prettyprint peg.ebnf ; "123" EBNF[[ rule=[0-9]+ ]] .
V{ 49 50 51 }