diff --git a/src/parser.js b/src/parser.js index 14c1279..8b8c3ca 100644 --- a/src/parser.js +++ b/src/parser.js @@ -2875,7 +2875,7 @@ PEG.parser = (function(){ } if (result0 !== null) { result0 = (function(h1, h2) { - return String.fromCharCode(parseInt("0x" + h1 + h2)); + return String.fromCharCode(parseInt(h1 + h2, 16)); })(result0[1], result0[2]); } if (result0 === null) { @@ -2946,7 +2946,7 @@ PEG.parser = (function(){ } if (result0 !== null) { result0 = (function(h1, h2, h3, h4) { - return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4)); + return String.fromCharCode(parseInt(h1 + h2 + h3 + h4, 16)); })(result0[1], result0[2], result0[3], result0[4]); } if (result0 === null) { diff --git a/src/parser.pegjs b/src/parser.pegjs index 414c6c3..bdfb6b4 100644 --- a/src/parser.pegjs +++ b/src/parser.pegjs @@ -298,12 +298,12 @@ zeroEscapeSequence hexEscapeSequence = "\\x" h1:hexDigit h2:hexDigit { - return String.fromCharCode(parseInt("0x" + h1 + h2)); + return String.fromCharCode(parseInt(h1 + h2, 16)); } unicodeEscapeSequence = "\\u" h1:hexDigit h2:hexDigit h3:hexDigit h4:hexDigit { - return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4)); + return String.fromCharCode(parseInt(h1 + h2 + h3 + h4, 16)); } eolEscapeSequence