зеркало из https://github.com/mozilla/mozjexl.git
Fix issue with escaped quotes at the end of string
This commit is contained in:
Родитель
3c1cd5e2c8
Коммит
4ba03edcad
|
@ -8,8 +8,8 @@ var numericRegex = /^-?(?:(?:[0-9]*\.[0-9]+)|[0-9]+)$/,
|
|||
escEscRegex = /\\\\/,
|
||||
preOpRegexElems = [
|
||||
// Strings
|
||||
"'(?:(?:\\\\')?[^'])*'",
|
||||
'"(?:(?:\\\\")?[^"])*"',
|
||||
"'(?:(?:\\\\')|[^'])*'",
|
||||
'"(?:(?:\\\\")|[^"])*"',
|
||||
// Whitespace
|
||||
"\\s+",
|
||||
// Booleans
|
||||
|
|
|
@ -34,12 +34,24 @@ describe("Lexer", function() {
|
|||
elems.should.have.length(1);
|
||||
elems[0].should.equal(str);
|
||||
});
|
||||
it("should support escaping double-quotes at end of double-quote strings", function() {
|
||||
var str = '"\\""',
|
||||
elems = inst.getElements(str);
|
||||
elems.should.have.length(1);
|
||||
elems[0].should.equal(str);
|
||||
});
|
||||
it("should support escaping single-quotes", function() {
|
||||
var str = "'f\\'oo'",
|
||||
elems = inst.getElements(str);
|
||||
elems.should.have.length(1);
|
||||
elems[0].should.equal(str);
|
||||
});
|
||||
it("should support escaping single-quotes at end of single-quote strings", function() {
|
||||
var str = "'\\''",
|
||||
elems = inst.getElements(str);
|
||||
elems.should.have.length(1);
|
||||
elems[0].should.equal(str);
|
||||
});
|
||||
it("should count an identifier as one element", function() {
|
||||
var str = "alpha12345",
|
||||
elems = inst.getElements(str);
|
||||
|
|
Загрузка…
Ссылка в новой задаче