Fix KQL handling of carriage return (#32150)

This commit is contained in:
Lukas Olson 2019-02-28 12:39:49 -07:00
parent bfe22d830b
commit f021fa7896
2 changed files with 55 additions and 54 deletions

View file

@ -208,30 +208,31 @@ module.exports = (function() {
peg$c44 = function() { return '\t'; },
peg$c45 = "\\r",
peg$c46 = { type: "literal", value: "\\r", description: "\"\\\\r\"" },
peg$c47 = "\\n",
peg$c48 = { type: "literal", value: "\\n", description: "\"\\\\n\"" },
peg$c49 = function() { return '\n'; },
peg$c50 = function(keyword) { return keyword; },
peg$c51 = /^[\\():<>"*]/,
peg$c52 = { type: "class", value: "[\\\\():<>\"*]", description: "[\\\\():<>\"*]" },
peg$c53 = "<=",
peg$c54 = { type: "literal", value: "<=", description: "\"<=\"" },
peg$c55 = function() { return 'lte'; },
peg$c56 = ">=",
peg$c57 = { type: "literal", value: ">=", description: "\">=\"" },
peg$c58 = function() { return 'gte'; },
peg$c59 = "<",
peg$c60 = { type: "literal", value: "<", description: "\"<\"" },
peg$c61 = function() { return 'lt'; },
peg$c62 = ">",
peg$c63 = { type: "literal", value: ">", description: "\">\"" },
peg$c64 = function() { return 'gt'; },
peg$c65 = /^[ \t\r\n]/,
peg$c66 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" },
peg$c67 = function() { return parseCursor; },
peg$c68 = "@kuery-cursor@",
peg$c69 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" },
peg$c70 = function() { return cursorSymbol; },
peg$c47 = function() { return '\r'; },
peg$c48 = "\\n",
peg$c49 = { type: "literal", value: "\\n", description: "\"\\\\n\"" },
peg$c50 = function() { return '\n'; },
peg$c51 = function(keyword) { return keyword; },
peg$c52 = /^[\\():<>"*]/,
peg$c53 = { type: "class", value: "[\\\\():<>\"*]", description: "[\\\\():<>\"*]" },
peg$c54 = "<=",
peg$c55 = { type: "literal", value: "<=", description: "\"<=\"" },
peg$c56 = function() { return 'lte'; },
peg$c57 = ">=",
peg$c58 = { type: "literal", value: ">=", description: "\">=\"" },
peg$c59 = function() { return 'gte'; },
peg$c60 = "<",
peg$c61 = { type: "literal", value: "<", description: "\"<\"" },
peg$c62 = function() { return 'lt'; },
peg$c63 = ">",
peg$c64 = { type: "literal", value: ">", description: "\">\"" },
peg$c65 = function() { return 'gt'; },
peg$c66 = /^[ \t\r\n]/,
peg$c67 = { type: "class", value: "[\\ \\t\\r\\n]", description: "[\\ \\t\\r\\n]" },
peg$c68 = function() { return parseCursor; },
peg$c69 = "@kuery-cursor@",
peg$c70 = { type: "literal", value: "@kuery-cursor@", description: "\"@kuery-cursor@\"" },
peg$c71 = function() { return cursorSymbol; },
peg$currPos = 0,
peg$savedPos = 0,
@ -1477,21 +1478,21 @@ module.exports = (function() {
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c44();
s1 = peg$c47();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c47) {
s1 = peg$c47;
if (input.substr(peg$currPos, 2) === peg$c48) {
s1 = peg$c48;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c48); }
if (peg$silentFails === 0) { peg$fail(peg$c49); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c49();
s1 = peg$c50();
}
s0 = s1;
}
@ -1568,7 +1569,7 @@ module.exports = (function() {
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s2);
s1 = peg$c51(s2);
s0 = s1;
} else {
peg$currPos = s0;
@ -1599,12 +1600,12 @@ module.exports = (function() {
function peg$parseSpecialCharacter() {
var s0;
if (peg$c51.test(input.charAt(peg$currPos))) {
if (peg$c52.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c52); }
if (peg$silentFails === 0) { peg$fail(peg$c53); }
}
return s0;
@ -1614,58 +1615,58 @@ module.exports = (function() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c53) {
s1 = peg$c53;
if (input.substr(peg$currPos, 2) === peg$c54) {
s1 = peg$c54;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c54); }
if (peg$silentFails === 0) { peg$fail(peg$c55); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c55();
s1 = peg$c56();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c56) {
s1 = peg$c56;
if (input.substr(peg$currPos, 2) === peg$c57) {
s1 = peg$c57;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c57); }
if (peg$silentFails === 0) { peg$fail(peg$c58); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c58();
s1 = peg$c59();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 60) {
s1 = peg$c59;
s1 = peg$c60;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c60); }
if (peg$silentFails === 0) { peg$fail(peg$c61); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c61();
s1 = peg$c62();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 62) {
s1 = peg$c62;
s1 = peg$c63;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c63); }
if (peg$silentFails === 0) { peg$fail(peg$c64); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c64();
s1 = peg$c65();
}
s0 = s1;
}
@ -1678,12 +1679,12 @@ module.exports = (function() {
function peg$parseSpace() {
var s0;
if (peg$c65.test(input.charAt(peg$currPos))) {
if (peg$c66.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c66); }
if (peg$silentFails === 0) { peg$fail(peg$c67); }
}
return s0;
@ -1694,23 +1695,23 @@ module.exports = (function() {
s0 = peg$currPos;
peg$savedPos = peg$currPos;
s1 = peg$c67();
s1 = peg$c68();
if (s1) {
s1 = void 0;
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 14) === peg$c68) {
s2 = peg$c68;
if (input.substr(peg$currPos, 14) === peg$c69) {
s2 = peg$c69;
peg$currPos += 14;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c69); }
if (peg$silentFails === 0) { peg$fail(peg$c70); }
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c70();
s1 = peg$c71();
s0 = s1;
} else {
peg$currPos = s0;

View file

@ -252,7 +252,7 @@ OptionalSpace
EscapedWhitespace
= '\\t' { return '\t'; }
/ '\\r' { return '\t'; }
/ '\\r' { return '\r'; }
/ '\\n' { return '\n'; }
EscapedSpecialCharacter