Skip to content

Commit

Permalink
Do not quote the "class" key
Browse files Browse the repository at this point in the history
Quoting reserved words in property names is not needed since dropping
support of IE < 9.
  • Loading branch information
dmajda committed Oct 5, 2016
1 parent fb26d64 commit b81afb1
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/compiler/asts.js
Expand Up @@ -65,7 +65,7 @@ let asts = {
return node.value !== "";
},

"class": consumesTrue,
class: consumesTrue,
any: consumesTrue
});

Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/passes/generate-bytecode.js
Expand Up @@ -567,7 +567,7 @@ function generateBytecode(ast) {
}
},

"class": function(node) {
class: function(node) {
let regexp = "/^["
+ (node.inverted ? "^" : "")
+ node.parts.map(part =>
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/passes/generate-js.js
Expand Up @@ -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])",
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/visitor.js
Expand Up @@ -56,7 +56,7 @@ let visitor = {
semantic_not: visitNop,
rule_ref: visitNop,
literal: visitNop,
"class": visitNop,
class: visitNop,
any: visitNop
};

Expand Down
2 changes: 1 addition & 1 deletion lib/parser.js
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/parser.spec.js
Expand Up @@ -156,7 +156,7 @@ describe("PEG.js grammar parser", function() {
semantic_not: stripLeaf,
rule_ref: stripLeaf,
literal: stripLeaf,
"class": stripLeaf,
class: stripLeaf,
any: stripLeaf
});

Expand Down

0 comments on commit b81afb1

Please sign in to comment.