Browse Source

Convert PEG.js code to strict mode

* Issues #323
redux
Arlo Breault 7 years ago
parent
commit
12c169e7b5
  1. 1
      .jshintrc
  2. 2
      Makefile
  3. 2
      benchmark/benchmarks.js
  4. 4
      benchmark/index.js
  5. 2
      benchmark/run
  6. 2
      benchmark/runner.js
  7. 2
      bin/pegjs
  8. 2
      lib/compiler.js
  9. 2
      lib/compiler/asts.js
  10. 2
      lib/compiler/javascript.js
  11. 2
      lib/compiler/opcodes.js
  12. 2
      lib/compiler/passes/generate-bytecode.js
  13. 2
      lib/compiler/passes/generate-javascript.js
  14. 2
      lib/compiler/passes/remove-proxy-rules.js
  15. 2
      lib/compiler/passes/report-infinite-loops.js
  16. 2
      lib/compiler/passes/report-left-recursion.js
  17. 2
      lib/compiler/passes/report-missing-rules.js
  18. 2
      lib/compiler/visitor.js
  19. 2
      lib/grammar-error.js
  20. 2
      lib/peg.js
  21. 2
      lib/utils/arrays.js
  22. 2
      lib/utils/classes.js
  23. 2
      lib/utils/objects.js
  24. 4
      spec/api/generated-parser-api.spec.js
  25. 4
      spec/api/pegjs-api.spec.js
  26. 4
      spec/api/plugin-api.spec.js
  27. 4
      spec/behavior/generated-parser-behavior.spec.js
  28. 2
      spec/helpers.js
  29. 4
      spec/unit/compiler/passes/generate-bytecode.spec.js
  30. 4
      spec/unit/compiler/passes/helpers.js
  31. 4
      spec/unit/compiler/passes/remove-proxy-rules.spec.js
  32. 4
      spec/unit/compiler/passes/report-infinite-loops.spec.js
  33. 4
      spec/unit/compiler/passes/report-left-recursion.spec.js
  34. 4
      spec/unit/compiler/passes/report-missing-rules.spec.js
  35. 4
      spec/unit/parser.spec.js

1
.jshintrc

@ -13,6 +13,7 @@
"node": true,
"noempty": true,
"nonew": true,
"strict": true,
"trailing": true,
"validthis": true,
"-W082": false

2
Makefile

@ -79,6 +79,8 @@ browser:
echo ' * Licensed under the MIT license.' >> $(BROWSER_FILE_DEV)
echo ' */' >> $(BROWSER_FILE_DEV)
echo 'var PEG = (function(undefined) {' >> $(BROWSER_FILE_DEV)
echo ' "use strict";' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' var modules = {' >> $(BROWSER_FILE_DEV)
echo ' define: function(name, factory) {' >> $(BROWSER_FILE_DEV)
echo ' var dir = name.replace(/(^|\/)[^/]+$$/, "$$1"),' >> $(BROWSER_FILE_DEV)

2
benchmark/benchmarks.js

@ -1,3 +1,5 @@
"use strict";
(function(root, factory) {
if (typeof module !== 'undefined' && module.exports) {
module.exports = factory();

4
benchmark/index.js

@ -1,6 +1,8 @@
/* jshint node:false */
/* global $, alert, benchmarks, document, Runner */
$("#run").click(function() {
"use strict";
/* Results Table Manipulation */
@ -132,5 +134,7 @@ $("#run").click(function() {
});
$(document).ready(function() {
"use strict";
$("#run").focus();
});

2
benchmark/run

@ -1,5 +1,7 @@
#!/usr/bin/env node
"use strict";
var util = require("util");
var fs = require("fs");
var PEG = require("../lib/peg");

2
benchmark/runner.js

@ -1,3 +1,5 @@
"use strict";
(function(root, factory) {
if (typeof module !== 'undefined' && module.exports) {
module.exports = factory;

2
bin/pegjs

@ -1,5 +1,7 @@
#!/usr/bin/env node
"use strict";
var util = require("util");
var fs = require("fs");
var path = require("path");

2
lib/compiler.js

@ -1,3 +1,5 @@
"use strict";
var arrays = require("./utils/arrays"),
objects = require("./utils/objects");

2
lib/compiler/asts.js

@ -1,3 +1,5 @@
"use strict";
var arrays = require("../utils/arrays"),
visitor = require("./visitor");

2
lib/compiler/javascript.js

@ -1,3 +1,5 @@
"use strict";
function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
/* JavaScript code generation helpers. */

2
lib/compiler/opcodes.js

@ -1,3 +1,5 @@
"use strict";
/* Bytecode instruction opcodes. */
var opcodes = {
/* Stack Manipulation */

2
lib/compiler/passes/generate-bytecode.js

@ -1,3 +1,5 @@
"use strict";
var arrays = require("../../utils/arrays"),
objects = require("../../utils/objects"),
asts = require("../asts"),

2
lib/compiler/passes/generate-javascript.js

@ -1,3 +1,5 @@
"use strict";
var arrays = require("../../utils/arrays"),
asts = require("../asts"),
op = require("../opcodes"),

2
lib/compiler/passes/remove-proxy-rules.js

@ -1,3 +1,5 @@
"use strict";
var arrays = require("../../utils/arrays"),
visitor = require("../visitor");

2
lib/compiler/passes/report-infinite-loops.js

@ -1,3 +1,5 @@
"use strict";
var GrammarError = require("../../grammar-error"),
asts = require("../asts"),
visitor = require("../visitor");

2
lib/compiler/passes/report-left-recursion.js

@ -1,3 +1,5 @@
"use strict";
var arrays = require("../../utils/arrays"),
GrammarError = require("../../grammar-error"),
asts = require("../asts"),

2
lib/compiler/passes/report-missing-rules.js

@ -1,3 +1,5 @@
"use strict";
var GrammarError = require("../../grammar-error"),
asts = require("../asts"),
visitor = require("../visitor");

2
lib/compiler/visitor.js

@ -1,3 +1,5 @@
"use strict";
var objects = require("../utils/objects"),
arrays = require("../utils/arrays");

2
lib/grammar-error.js

@ -1,3 +1,5 @@
"use strict";
var classes = require("./utils/classes");
/* Thrown when the grammar contains an error. */

2
lib/peg.js

@ -1,3 +1,5 @@
"use strict";
var arrays = require("./utils/arrays"),
objects = require("./utils/objects");

2
lib/utils/arrays.js

@ -1,3 +1,5 @@
"use strict";
/* Array utilities. */
var arrays = {
range: function(start, stop) {

2
lib/utils/classes.js

@ -1,3 +1,5 @@
"use strict";
/* Class utilities */
var classes = {
subclass: function(child, parent) {

2
lib/utils/objects.js

@ -1,3 +1,5 @@
"use strict";
/* Object utilities. */
var objects = {
keys: function(object) {

4
spec/api/generated-parser-api.spec.js

@ -1,3 +1,7 @@
/* global describe, expect, it, PEG, spyOn */
"use strict";
describe("generated parser API", function() {
describe("parse", function() {
it("parses input", function() {

4
spec/api/pegjs-api.spec.js

@ -1,3 +1,7 @@
/* global describe, expect, it, PEG, spyOn */
"use strict";
describe("PEG.js API", function() {
describe("buildParser", function() {
it("builds a parser", function() {

4
spec/api/plugin-api.spec.js

@ -1,3 +1,7 @@
/* global beforeEach, describe, expect, it, jasmine, PEG */
"use strict";
describe("plugin API", function() {
beforeEach(function() {
this.addMatchers({

4
spec/behavior/generated-parser-behavior.spec.js

@ -1,3 +1,7 @@
/* global beforeEach, describe, expect, it, jasmine, PEG */
"use strict";
describe("generated parser behavior", function() {
function varyOptimizationOptions(block) {
function clone(object) {

2
spec/helpers.js

@ -1,3 +1,5 @@
"use strict";
(function(root) {
if (typeof module !== 'undefined') {
root.PEG = require("../lib/peg.js");

4
spec/unit/compiler/passes/generate-bytecode.spec.js

@ -1,3 +1,7 @@
/* global describe, expect, it, PEG */
"use strict";
describe("compiler pass |generateBytecode|", function() {
var pass = PEG.compiler.passes.generate.generateBytecode;

4
spec/unit/compiler/passes/helpers.js

@ -1,3 +1,7 @@
/* global beforeEach, jasmine, PEG */
"use strict";
beforeEach(function() {
this.addMatchers({
toChangeAST: function(grammar) {

4
spec/unit/compiler/passes/remove-proxy-rules.spec.js

@ -1,3 +1,7 @@
/* global describe, expect, it, PEG */
"use strict";
describe("compiler pass |removeProxyRules|", function() {
var pass = PEG.compiler.passes.transform.removeProxyRules;

4
spec/unit/compiler/passes/report-infinite-loops.spec.js

@ -1,3 +1,7 @@
/* global describe, expect, it, PEG */
"use strict";
describe("compiler pass |reportLeftRecursion|", function() {
var pass = PEG.compiler.passes.check.reportInfiniteLoops;

4
spec/unit/compiler/passes/report-left-recursion.spec.js

@ -1,3 +1,7 @@
/* global describe, expect, it, PEG */
"use strict";
describe("compiler pass |reportLeftRecursion|", function() {
var pass = PEG.compiler.passes.check.reportLeftRecursion;

4
spec/unit/compiler/passes/report-missing-rules.spec.js

@ -1,3 +1,7 @@
/* global describe, expect, it, PEG */
"use strict";
describe("compiler pass |reportMissingRules|", function() {
var pass = PEG.compiler.passes.check.reportMissingRules;

4
spec/unit/parser.spec.js

@ -1,3 +1,7 @@
/* global beforeEach, describe, expect, it, jasmine, PEG */
"use strict";
describe("PEG.js grammar parser", function() {
var literalAbcd = { type: "literal", value: "abcd", ignoreCase: false },
literalEfgh = { type: "literal", value: "efgh", ignoreCase: false },

Loading…
Cancel
Save