diff --git a/lib/compiler/asts.js b/lib/compiler/asts.js index f76b6c4..cfb1f72 100644 --- a/lib/compiler/asts.js +++ b/lib/compiler/asts.js @@ -65,7 +65,7 @@ let asts = { return node.value !== ""; }, - "class": consumesTrue, + class: consumesTrue, any: consumesTrue }); diff --git a/lib/compiler/passes/generate-bytecode.js b/lib/compiler/passes/generate-bytecode.js index 63d0b44..fdebde4 100644 --- a/lib/compiler/passes/generate-bytecode.js +++ b/lib/compiler/passes/generate-bytecode.js @@ -567,7 +567,7 @@ function generateBytecode(ast) { } }, - "class": function(node) { + class: function(node) { let regexp = "/^[" + (node.inverted ? "^" : "") + node.parts.map(part => diff --git a/lib/compiler/passes/generate-js.js b/lib/compiler/passes/generate-js.js index 8f82e2a..f90b3ba 100644 --- a/lib/compiler/passes/generate-js.js +++ b/lib/compiler/passes/generate-js.js @@ -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])", diff --git a/lib/compiler/visitor.js b/lib/compiler/visitor.js index b51084d..9bcf186 100644 --- a/lib/compiler/visitor.js +++ b/lib/compiler/visitor.js @@ -56,7 +56,7 @@ let visitor = { semantic_not: visitNop, rule_ref: visitNop, literal: visitNop, - "class": visitNop, + class: visitNop, any: visitNop }; diff --git a/lib/parser.js b/lib/parser.js index 61c51cb..7c24457 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -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]) diff --git a/spec/unit/parser.spec.js b/spec/unit/parser.spec.js index 0dc6482..10a2859 100644 --- a/spec/unit/parser.spec.js +++ b/spec/unit/parser.spec.js @@ -156,7 +156,7 @@ describe("PEG.js grammar parser", function() { semantic_not: stripLeaf, rule_ref: stripLeaf, literal: stripLeaf, - "class": stripLeaf, + class: stripLeaf, any: stripLeaf });