1143 Commits (93cc6c5b26854fc6026aa0a2d9202786d336c339)
 

Author SHA1 Message Date
David Majda 9808b88ccb generated-parser-behavior.spec.js: Move variable inside loop 8 years ago
David Majda 6e463e2113 {spec,benchmark}/server: Use template literals 8 years ago
David Majda 70e59fc5d0 {spec,benchmark}/server: Remove extra trailing newline 8 years ago
David Majda 9648ca53d7 Use the "eslint-disable" directive instead of "eslint"
The "eslint-disable" directive is more specific.
8 years ago
David Majda 60821bb80b Sort "require" calls by variable names and group them
This makes things consistent and reduces thinking about "require"
ordering.
8 years ago
David Majda c134e06229 Move "use strict" directives up
Move "use strict" directives to the first line of each file. In
particular, move them above any ESLint comments, which are far less
important.

There are few exceptions:

  Executable files

    In these, the "use strict" directive must give way to the shebang.

  lib/parser.js

    Here, the "Generated by..." comment comes first. Also, ESLint
    comments are prepended in post-processing.
8 years ago
David Majda ff7193776e Avoid aligning "="
The only exception left are instances where aligning "=" helps to
express symmetry between lines.

See #443.
8 years ago
David Majda 400a3cfa3c Avoid aligning object keys
The only exception left are objects representing a mapping with simple
keys and values -- essentially tables written as object literals.

See #443.
8 years ago
David Majda 12112310f2 Use only double quotes for strings
See #443
8 years ago
David Majda 6294bb5b13 Use only "//" comments
See #443.
8 years ago
David Majda 1da6abc458 Use one var/let/const per variable (fixup)
Fix few instances in generated code which I missed in the previous
commit.

See #443.
8 years ago
David Majda 516023546d Use one var/let/const per variable (for initialized variables)
Use one var/let/const per variable, but only for initialized variables.
Uninitialized variables are still grouped into one var/let/const
declaration as I don't see any value in separating them. This approach
reflects the fact that initialized and uninitialized var/let/const
declarations are really two different things.

See #443.
8 years ago
David Majda 381b5f4db7 Merge pull request #455 from Mingun/fix-testing 8 years ago
Mingun fcddfbebdd Add `glob` dev dependency used in spec and benchmark servers 8 years ago
Mingun 26ded450f4 Add "use strict" for spec and benchmark servers 8 years ago
David Majda 7f01db2fb8 Get rid of for-in loops
The for-in statement in JavaScript iterates also over inherited
properties. This is typically not desired and requires adding a
check using Object.prototype.hasOwnProperty inside the loop.

This commit replaces all for-in statements and related checks inside
them with iteration over Object.keys(...). The iteration is performed
using either Array.prototype.forEach of a plain for loop.
8 years ago
David Majda b2a9dabcff Remove now unused lib/utils/objects.js
See #442.
8 years ago
David Majda 5fbb557f80 Don't use "objects" in lib/peg.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 66ca7e2168 Don't use "objects" in lib/compiler/visitor.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 76e70c3923 Don't use "objects" in lib/compiler/passes/report-duplicate-labels.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda d2569b9bf3 Don't use "objects" in lib/compiler/passes/generate-js.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 8a75d19468 Don't use "objects" in lib/compiler/passes/generate-bytecode.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 97d92c9d8b Don't use "objects" in lib/compiler/index.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda c344460855 Remove now unused lib/utils/arrays.js
See #442.
8 years ago
David Majda f81ae1845b Don't use "arrays" in lib/compiler/passes/report-infinite-recursion.js
The "arrays" module will be removed.

See #442.
8 years ago
David Majda 71ef4c9b91 Don't use "arrays" in lib/compiler/passes/remove-proxy-rules.js
The "arrays" module will be removed.

See #442.
8 years ago
David Majda 8f8484b1a1 Don't use "arrays" in lib/compiler/passes/generate-js.js
The "arrays" module will be removed.

See #442.
8 years ago
David Majda 33f23ee4be Don't use "arrays" in lib/compiler/passes/generate-bytecode.js
The "arrays" module will be removed.

See #442.
8 years ago
David Majda 4dec5e52ba Don't use "arrays" in lib/compiler/asts.js
The "arrays" module will be removed.

See #442.
8 years ago
David Majda 5822596ab8 Replace classes.subclass with native classes
See #442.
8 years ago
David Majda 6fa8ad63f9 Replace some functions with arrow functions
Because arrow functions work rather differently than normal functions (a
bad design mistake if you ask me), I decided to be conservative with the
conversion.

I converted:

  * event handlers
  * callbacks
  * arguments to Array.prototype.map & co.
  * small standalone lambda functions

I didn't convert:

  * functions assigned to object literal properties (the new shorthand
    syntax would be better here)
  * functions passed to "describe", "it", etc. in specs (because Jasmine
    relies on dynamic "this")

See #442.
8 years ago
David Majda d00e9526c3 Minimize variable scope
Where possible, move "let" statements into inner blocks, loop headers,
etc.

See #442.
8 years ago
David Majda bdf91b5941 Replace "var" with "let" & "const"
This is purely a mechanical change, not taking advantage of block scope
of "let" and "const". Minimizing variable scope will come in the next
commit.

In general, "var" is converted into "let" and "const" is used only for
immutable variables of permanent character (generally spelled in
ALL_CAPS). Using it for any immutable variable regardless on its
permanence would feel confusing.

Any code which is not transpiled and needs to run in ES6 environment
(examples, code in grammars embedded in specs, ...) is kept unchanged.
This is also true for code generated by PEG.js.

See #442.
8 years ago
David Majda 5249814fc0 .eslintrc.json: Set parserOptions.ecmaVersion to 6
This means all code will be parsed as ES2015 by ESLint.

See #442.
8 years ago
David Majda 4a49e910ac package.json: Remove http-server
It is no longer used after introducing spec/server and benchmark/server.

See #442.
8 years ago
David Majda 959f20f6e2 Pass benchmark code through Babel before serving it to the browser
This will allow to use ES2015 constructs in benchmark code.

The change required introducing a small server, which serves both PEG.js
and benchmark code passed through Babel and bundled together. This
allowed to convert the benchmark to regular modules and to get rid of
the hackery that was previously needed to make it run both in Node.js
and in the browser.

Note the benchmark no longer exercises the browser version.

See #442.
8 years ago
David Majda 5c40fff136 Pass spec code through Babel before serving it to the browser
This will allow to use ES2015 constructs in spec code.

The change required introducing a small server, which serves both PEG.js
and spec code passed through Babel and bundled together. This allowed to
convert the specs to regular modules and get rid of the hackery that was
previously needed to make them run both in Node.js and in the browser.

Note the specs no longer exercise the browser version. This will allow
to spec PEG.js internals in the future.

See #442.
8 years ago
David Majda d239bf0107 package.json: Add packages that will be needed soon
Add "express" and "morgan" packages, which will be needed by
soon-to-be-introduced spec server and benchmark server.

See #442.
8 years ago
David Majda 4e38617748 Pass the browser version through Babel
This will allow to use ES2015 constructs in PEG.js code.

See #442.
8 years ago
David Majda 16f38f6380 Drop Node 0.10.x & 0.12.x support
See #442.
8 years ago
David Majda 5ad1bc2add CSS example: Switch from first/rest to head/tail
Follow-up to e510ecc3d0.
8 years ago
David Majda f0657ba628 generated-parser-behavior.spec.js: Switch from first/rest to head/tail
Follow-up to these commits:

  e510ecc3d0
  a4a66a2e5b
8 years ago
David Majda 0d48ffca2b generated-parser-behavior.spec.js: s/==/===/ 8 years ago
David Majda c3e7072fa2 Remove unused arrays.pluck function 8 years ago
David Majda 062c6ae706 Escape backspace in regexp classes as "\b", not "\x08"
The "\x08" escaping is necessary only outside of classes (where "\b"
means "word boundary").
8 years ago
David Majda 1c71bf6cd7 spec/index.html: Add <!DOCTYPE html>
This ensures the specs are run in standards mode in Internet Explorer.
8 years ago
David Majda bd62ddf846 Use "[]" & "[^]" for empty character classes, not "(?!)" & "[\\S\\s]"
See #441.
8 years ago
David Majda 9c04c94c85 Escape vertical tab as "\v", not "\x0B"
See #441.
8 years ago
David Majda f36a667376 Remove "undefined" redefinition protection
See #441.
8 years ago
David Majda aa1a2e74cf Replace suitable for loops with Array methods (in /examples)
See #441.
8 years ago