Added \uFEFF (BOM) to the definition of whitespace in the metagrammar.
The Rhino bug that prevented inclusion of \uFEFF among the whitespace characters is no longer relevant here because we compile character classes into regexps now, which avoids the infinite recursion.
This commit is contained in:
parent
383c5acaa6
commit
3291c70d97
|
@ -3212,13 +3212,13 @@ PEG.grammarParser = (function(){
|
|||
|
||||
var savedReportMatchFailures = context.reportMatchFailures;
|
||||
context.reportMatchFailures = false;
|
||||
if (this._input.substr(this._pos).match(/^[ - ]/) !== null) {
|
||||
if (this._input.substr(this._pos).match(/^[ - ]/) !== null) {
|
||||
var result301 = this._input[this._pos];
|
||||
this._pos++;
|
||||
} else {
|
||||
var result301 = null;
|
||||
if (context.reportMatchFailures) {
|
||||
this._matchFailed('[' + " - " + ']');
|
||||
this._matchFailed('[' + " - " + ']');
|
||||
}
|
||||
}
|
||||
context.reportMatchFailures = savedReportMatchFailures;
|
||||
|
|
|
@ -205,8 +205,5 @@ eol "end of line": "\n" / "\r\n" / "\r" / "\u2028" / "\u2029"
|
|||
|
||||
eolChar: [\n\r\u2028\u2029]
|
||||
|
||||
/*
|
||||
* Modelled after ECMA-262, 5th ed., 7.2. \uFEFF should be between the
|
||||
* characters too, but it causes infinite loop in Rhino.
|
||||
*/
|
||||
whitespace "whitespace": [ \t\v\f\u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]
|
||||
/* Modelled after ECMA-262, 5th ed., 7.2. */
|
||||
whitespace "whitespace": [ \t\v\f\u00A0\uFEFF\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]
|
||||
|
|
|
@ -434,6 +434,7 @@ with (PEG.Grammar) {
|
|||
grammarParserParses('start:\f"abcd"', simpleGrammar);
|
||||
grammarParserParses('start: "abcd"', simpleGrammar);
|
||||
grammarParserParses('start:\u00A0"abcd"', simpleGrammar);
|
||||
grammarParserParses('start:\uFEFF"abcd"', simpleGrammar);
|
||||
grammarParserParses('start:\u1680"abcd"', simpleGrammar);
|
||||
grammarParserParses('start:\u180E"abcd"', simpleGrammar);
|
||||
grammarParserParses('start:\u2000"abcd"', simpleGrammar);
|
||||
|
|
Loading…
Reference in a new issue