diff --git a/examples/css.pegjs b/examples/css.pegjs index 798f3d5..45e21b9 100644 --- a/examples/css.pegjs +++ b/examples/css.pegjs @@ -298,7 +298,7 @@ nonascii unicode = "\\" digits:$(h h? h? h? h? h?) ("\r\n" / [ \t\r\n\f])? { - return String.fromCharCode(parseInt("0x" + digits)); + return String.fromCharCode(parseInt(digits, 16)); } escape diff --git a/examples/javascript.pegjs b/examples/javascript.pegjs index 13206ad..0da7c28 100644 --- a/examples/javascript.pegjs +++ b/examples/javascript.pegjs @@ -231,7 +231,7 @@ SignedInteger = [-+]? DecimalDigits HexIntegerLiteral - = "0" [xX] digits:$HexDigit+ { return parseInt("0x" + digits); } + = "0" [xX] digits:$HexDigit+ { return parseInt(digits, 16); } HexDigit = [0-9a-fA-F] @@ -292,12 +292,12 @@ EscapeCharacter HexEscapeSequence = "x" digits:$(HexDigit HexDigit) { - return String.fromCharCode(parseInt("0x" + digits)); + return String.fromCharCode(parseInt(digits, 16)); } UnicodeEscapeSequence = "u" digits:$(HexDigit HexDigit HexDigit HexDigit) { - return String.fromCharCode(parseInt("0x" + digits)); + return String.fromCharCode(parseInt(digits, 16)); } RegularExpressionLiteral "regular expression" diff --git a/examples/json.pegjs b/examples/json.pegjs index 43b2314..0729c4a 100644 --- a/examples/json.pegjs +++ b/examples/json.pegjs @@ -65,7 +65,7 @@ char / "\\r" { return "\r"; } / "\\t" { return "\t"; } / "\\u" digits:$(hexDigit hexDigit hexDigit hexDigit) { - return String.fromCharCode(parseInt("0x" + digits)); + return String.fromCharCode(parseInt(digits, 16)); } number "number"