Skip to content

Instantly share code, notes, and snippets.

@hakanai
Created August 4, 2011 06:59
Show Gist options
  • Select an option

  • Save hakanai/1124635 to your computer and use it in GitHub Desktop.

Select an option

Save hakanai/1124635 to your computer and use it in GitHub Desktop.
Grr
// What I would like to write:
UNQUOTED
: UnquotedStartChar UnquotedChar*
{but not matching WSLASH NUMBER}
;
// What it seems I actually have to write:
UNQUOTED
// something not starting with a w
: (EscapeSequence | ~(~UnquotedStartCharWithoutEscape|'W'|'w')) UnquotedChar*
// something starting with a w but the next character not being a slash, or not having the next character
| ('W'|'w') ( (EscapeSequence | ~(~UnquotedCharWithoutEscape|'/')) UnquotedChar* )?
// something starting with a wslash but the rest of the string having at least one non-digit, or not having anything
| WSLASH ( UnquotedChar* (EscapeSequence | ~(~UnquotedCharWithoutEscape|'0'..'9')) UnquotedChar* )?
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment