Work around the fact that IE does not recognize "\v" in strings.

redux
David Majda 15 years ago
parent 6abda95a99
commit 7fc491412d

@ -230,7 +230,7 @@ SingleEscapeCharacter: ['"\\bfnrtv] {
.replace("n", "\n")
.replace("r", "\r")
.replace("t", "\t")
.replace("v", "\v")
.replace("v", "\x0B") // IE does not recognize "\v".
}
NonEscapeCharacter: (!EscapeCharacter / LineTerminator) SourceCharacter {

@ -2394,7 +2394,7 @@ PEG.grammarParser = (function(){
.replace("n", "\n")
.replace("r", "\r")
.replace("t", "\t")
.replace("v", "\v")
.replace("v", "\x0B") // IE does not recognize "\v".
}).apply(this, result234)
: null;

@ -166,7 +166,7 @@ simpleEscapeSequence: "\\" !(digit / "x" / "u" / eolChar) . {
.replace("n", "\n")
.replace("r", "\r")
.replace("t", "\t")
.replace("v", "\v")
.replace("v", "\x0B") // IE does not recognize "\v".
}
zeroEscapeSequence: "\\0" !digit { return "\0"; }

@ -327,7 +327,8 @@ with (PEG.Grammar) {
grammarParserParses('start: "\\n"', literalGrammar("\n"));
grammarParserParses('start: "\\r"', literalGrammar("\r"));
grammarParserParses('start: "\\t"', literalGrammar("\t"));
grammarParserParses('start: "\\v"', literalGrammar("\v"));
/* IE does not recognize "\v". */
grammarParserParses('start: "\\v"', literalGrammar("\x0B"));
grammarParserParses('start: "\\a"', literalGrammar("a"));
});
@ -430,7 +431,8 @@ with (PEG.Grammar) {
/* Canonical whitespace is " ". */
test("parses whitespace", function() {
grammarParserParses('start:\t"abcd"', simpleGrammar);
grammarParserParses('start:\v"abcd"', simpleGrammar);
/* IE does not recognize "\v". */
grammarParserParses('start:\x0B"abcd"', simpleGrammar);
grammarParserParses('start:\f"abcd"', simpleGrammar);
grammarParserParses('start: "abcd"', simpleGrammar);
grammarParserParses('start:\u00A0"abcd"', simpleGrammar);

Loading…
Cancel
Save