Do not quote the "class" key

Quoting reserved words in property names is not needed since dropping
support of IE < 9.
redux
David Majda 8 years ago
parent fb26d6425b
commit b81afb1471

@ -65,7 +65,7 @@ let asts = {
return node.value !== "";
},
"class": consumesTrue,
class: consumesTrue,
any: consumesTrue
});

@ -567,7 +567,7 @@ function generateBytecode(ast) {
}
},
"class": function(node) {
class: function(node) {
let regexp = "/^["
+ (node.inverted ? "^" : "")
+ node.parts.map(part =>

@ -771,7 +771,7 @@ function generateJS(ast, options) {
" return \"\\\"\" + literalEscape(expectation.text) + \"\\\"\";",
" },",
"",
" \"class\": function(expectation) {",
" class: function(expectation) {",
" var escapedParts = expectation.parts.map(function(part) {",
" return Array.isArray(part)",
" ? classEscape(part[0]) + \"-\" + classEscape(part[1])",

@ -56,7 +56,7 @@ let visitor = {
semantic_not: visitNop,
rule_ref: visitNop,
literal: visitNop,
"class": visitNop,
class: visitNop,
any: visitNop
};

@ -32,7 +32,7 @@ peg$SyntaxError.buildMessage = function(expected, found) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function(expectation) {
class: function(expectation) {
var escapedParts = expectation.parts.map(function(part) {
return Array.isArray(part)
? classEscape(part[0]) + "-" + classEscape(part[1])

@ -156,7 +156,7 @@ describe("PEG.js grammar parser", function() {
semantic_not: stripLeaf,
rule_ref: stripLeaf,
literal: stripLeaf,
"class": stripLeaf,
class: stripLeaf,
any: stripLeaf
});

Loading…
Cancel
Save