/* A.7 Regular Exrpessions */ pattern: disjunction ; disjunction: alternative | alternative PIPE disjunction ; alternative: /* * SPEC: * -empty- *| alternative term */ (term)* ; term: assertion | atom | atom quantifier ; assertion: CAROT | DOLLAR | '\\b' /* double check this - looks like a space in the manual? */ | '\\B' /* double check this - looks like a space in the manual? */ ; quantifier: quantifierPrefix | quantifierPrefix QUESTION ; quantifierPrefix: ASTERISK | PLUS | QUESTION | LBRACE decimalDigits RBRACE | LBRACE decimalDigits COMMA RBRACE | LBRACE decimalDigits COMMA decimalDigits RBRACE ; atom: patternCharacter | DOT | BSLASH atomEscape | characterClass | LPAREN ((COLON|EQ|EXCLAMATION)? disjunction) RPAREN ; patternCharacter: sourceCharacter /* but not any of: ^ $ \ . * + ? ( ) [ ] { } | */ ; atomEscape: decimalEscape | characterEscape | characterClassEscape ; characterEscape: controlEscape | LOWER_C controlLetter | hexEscapeSequence | unicodeEscapeSequence | identityEscape ; controlEscape: CONTROL_ESCAPE_CHAR /* one of: fnrtv */ ; controlLetter: /* one of: a-z A-Z */ LOWER_ALPHA_CHAR | UPPER_ALPHA_CHAR ; identityEscape: sourceCharacter /* but not identifierPart */ ; characterClassEscape: 'd' | 'D' | 's' | 'S' | 'w' | 'W' ; decimalEscape: decimalIntegerLiteral /* lookahead not a member of decimalDigit */ ; characterClass: /* [ [lookahead not a member of {^}] ClassRanges ] | [ ^ classRanges ] */ ; classRanges: /* empty */ | nonemptyClassRanges ; nonemptyClassRanges: classAtom | classAtom nonemptyClassRangesNoDash | classAtom MINUS classAtom classRanges ; nonemptyClassRangesNoDash: classAtom | classAtomNoDash nonemptyClassRangesNoDash | classAtomNoDash MINUS classAtom classRanges ; classAtom: MINUS | classAtomNoDash ; classAtomNoDash: sourceCharacter /* but not one of: \ ] - */ | BSLASH classEscape ; classEscape: decimalEscape | LOWER_B | characterEscape | characterClassEscape ; LOWER_C : 'c'; inputElementRegExp: lineTerminator | whiteSpace | comment | token | regularExpressionLiteral ; CONTROL_ESCAPE_CHAR : 'f'|'n'|'r'|'t'|'v'; /* one of: fnrtv */