dmajda/pegjs — pull request #78 by yyfrankyy (2012-04-24 17:05:00+00:00)
Title: parsing octl like string literal may cause exception.

there is a little bug in `example/javascript.pegjs`, since javascript support "OCTL: the C/Modula-3 octal notation" kind of string (`\XXX`), and this example only provided hex (\xXX) and unicode(\uXXXX) like escape parsing, parse exception maybe throw when parsing OCTL like string literal.

echo "'\341'" > testfile
pegjs javascript.pegjs
node -e "console.log(require('./javascript').parse(require('fs').readFileSync('./testfile').toString()))"

then this exception will be throw:

throw new this.SyntaxError(
^
SyntaxError: Expected "!", "(", "+", "++", "-", "--", ";", "[", "break", "continue", "debugger", "delete", "do", "false", "for", "function", "if", "new", "null", "return", "switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with", "{", "~", comment, end of line, identifier, number, regular expression, string or whitespace but "\"" found.

add `OCTLEscapeSequence` to `EscapeSequence` can fix this.