814 Commits (3330ceb7b848bdeae00357efab0af0e9b646d60a)
 

Author SHA1 Message Date
Adrian Sampson 3330ceb7b8 Docs: try to explain error messages (#368) 8 years ago
David Majda e61c23c634 ESLint: Set environments better
Instead of setting ESLint environment to "node" globally, set it on
per-directory basis using separate .eslintrc.json files:

  Directory   Environment
  -----------------------
  bin         node
  lib         commonjs
  spec        jasmine

It was impossible to use this approach for the "benchmark" directory
which contains a mix of files used in various environments. For
benchmark/run, the environment is set inline. For the other files, as
well as spec/helpers.js, the globals are declared manually (it is
impossible to express how these files are used just by a list of
environments).

Fixes #408.
8 years ago
David Majda 0e66f19523 Makefile: Remove obsolete comment
It should have been removed with the switch to Browserify in
0d8c045823.
8 years ago
David Majda ddd4ac3787 Fix ESLint errors in lib/parser.js
Fix the following errors:

    31:9   error  "parser" is defined but never used    no-unused-vars
   406:14  error  "expected" is defined but never used  no-unused-vars
  1304:15  error  "s1" is defined but never used        no-unused-vars
  1386:15  error  "s1" is defined but never used        no-unused-vars
  1442:15  error  "s1" is defined but never used        no-unused-vars
8 years ago
David Majda c8d23e5471 Fix ESLint errors in bin/pegjs
Fix the following errors:

   12:3  error  Unexpected console statement       no-console
   16:3  error  Unexpected console statement       no-console
   17:3  error  Unexpected console statement       no-console
   18:3  error  Unexpected console statement       no-console
   19:3  error  Unexpected console statement       no-console
   20:3  error  Unexpected console statement       no-console
   21:3  error  Unexpected console statement       no-console
   22:3  error  Unexpected console statement       no-console
   23:3  error  Unexpected console statement       no-console
   24:3  error  Unexpected console statement       no-console
   25:3  error  Unexpected console statement       no-console
   26:3  error  Unexpected console statement       no-console
   27:3  error  Unexpected console statement       no-console
   28:3  error  Unexpected console statement       no-console
   29:3  error  Unexpected console statement       no-console
   30:3  error  Unexpected console statement       no-console
   31:3  error  Unexpected console statement       no-console
   32:3  error  Unexpected console statement       no-console
   33:3  error  Unexpected console statement       no-console
   34:3  error  Unexpected console statement       no-console
   35:3  error  Unexpected console statement       no-console
   36:3  error  Unexpected console statement       no-console
   37:3  error  Unexpected console statement       no-console
   38:3  error  Unexpected console statement       no-console
   39:3  error  Unexpected console statement       no-console
   40:3  error  Unexpected console statement       no-console
   41:3  error  Unexpected console statement       no-console
   42:3  error  Unexpected console statement       no-console
   43:3  error  Unexpected console statement       no-console
   44:3  error  Unexpected console statement       no-console
   56:3  error  Unexpected console statement       no-console
  232:9  error  "inputStream" is already defined   no-redeclare
  240:9  error  "outputStream" is already defined  no-redeclare
8 years ago
David Majda ee66113130 Fix ESLint errors in benchmark/run
Fix the following errors:

   37:3   error  Unexpected console statement      no-console
   38:3   error  Unexpected console statement      no-console
   42:3   error  Unexpected console statement      no-console
   43:3   error  Unexpected console statement      no-console
   44:3   error  Unexpected console statement      no-console
   51:3   error  Unexpected console statement      no-console
   64:3   error  Unexpected console statement      no-console
   68:3   error  Unexpected console statement      no-console
   74:3   error  Unexpected console statement      no-console
   75:3   error  Unexpected console statement      no-console
   76:3   error  Unexpected console statement      no-console
   77:3   error  Unexpected console statement      no-console
   78:3   error  Unexpected console statement      no-console
   79:3   error  Unexpected console statement      no-console
   80:3   error  Unexpected console statement      no-console
   81:3   error  Unexpected console statement      no-console
   82:3   error  Unexpected console statement      no-console
   94:3   error  Unexpected console statement      no-console
  126:11  error  "runCount" is already defined     no-redeclare
  169:34  error  "test" is defined but never used  no-unused-vars
  194:4   error  Unexpected trailing comma         comma-dangle
8 years ago
David Majda 488f32e661 Fix ESLint errors in benchmark/index.js
Fix the following errors:

  74:14  error  "benchmarks" is not defined       no-undef
  84:36  error  "test" is defined but never used  no-unused-vars
8 years ago
David Majda 00faf20fe1 Fix ESLint errors in spec/behavior/generated-parser-behavior.spec.js
Fix the following errors:

   24:46  error  Unexpected trailing comma  comma-dangle
  403:26  error  Unexpected trailing comma  comma-dangle
  414:26  error  Unexpected trailing comma  comma-dangle
8 years ago
David Majda 04f8b50f80 Fix ESLint errors in spec/api/plugin-api.spec.js
Fix the following errors:

   59:35  error  "options" is defined but never used  no-unused-vars
   91:11  error  "plugin" is defined but never used   no-unused-vars
  102:35  error  "options" is defined but never used  no-unused-vars
  128:35  error  "options" is defined but never used  no-unused-vars

Note that ESLint revealed a real problem where the test supposedly
verifying receiving options by a plugin didn't actually verify anything.
8 years ago
David Majda 47ac688ce9 Fix ESLint errors in spec/api/generated-parser-api.spec.js
Fix the following errors:

  65:20  error  Unexpected console statement  no-console
  66:20  error  Unexpected console statement  no-console
  67:20  error  Unexpected console statement  no-console
  68:20  error  Unexpected console statement  no-console
  69:20  error  Unexpected console statement  no-console
  70:20  error  Unexpected console statement  no-console
8 years ago
David Majda 88c957c9e8 Fix ESLint errors in lib/compiler/passes/generate-js.js
Fix the following errors:

   65:11  error  Unexpected trailing comma  comma-dangle
  211:40  error  Unexpected trailing comma  comma-dangle
  223:27  error  Unexpected trailing comma  comma-dangle
  233:27  error  Unexpected trailing comma  comma-dangle
8 years ago
David Majda 768ece28e6 Use ESLint instead of JSHint
Implement the swap and change various directives in the source code. The
"make hint" target becomes "make lint".

The change leads to quite some errors being reported by ESLint. These
will be fixed in subsequent commits.

Note the configuration enables just the recommended rules. Later I plan
to enable more rules to enforce the coding standard. The configuration
also sets the environment to "node", which is far from ideal as the
codebase contains a mix of CommonJS, Node.js and browser code. I hope to
clean this up at some point.
8 years ago
David Majda 48f5ea4b37 tools/impact: Tweak the uname call
It turns out that OS X doesn't support long options for uname and it
doesn't support -o/--operating-system at all. Let's tweak uname's
options into something POSIX-compatible which still gives reasonable
results.

The new "uname -mrs" call results in the following:

  OS               uname -mrs
  -----------------------------------------------
  OS X Mavericks   Darwin 15.2.0 x86_64
  Ubuntu 14.04     Linux 3.13.0-32-generic x86_64
8 years ago
David Majda fdd6e66321 tools/impact: Set locale to C at the beginning
Without this, shell's printf is unreliable. For example, on OSX with
cs_CZ.UTF-8 locale it complained about number formatting:

  tools/impact: line 51: printf: .0300: invalid number
8 years ago
David Majda 8eeb0d1469 tools/impact: Use printf instead of echo -n
It turns out that on OS X, /bin/sh pretends it doesn't know the echo -n
option and just prints it with other input.
8 years ago
David Majda 6a3ede059d .travis.yml: Tweak Node.js versions
Do not test under io.js (which is no longer a thing), test under Node.js
4.0.x and 5.0.x.

Zero minor versions are intentional, I wan't to make sure that PEG.js
doesn't depend on any features added later in the 4.x and 5.x cycle.
8 years ago
David Majda 3a80933430 package.json: Update the "engine" field
* Use just 0.10 instead of 0.10.0 (it's shorter).

  * Remove space after >= (it is apparently conventionally not used in
    the npm world).
8 years ago
David Majda 3796cbfbad package.json: Reformat to formatting used by npm
This makes it possible to do e.g. "npm install --save" without a lot of
whitespace noise in the resulting diff.
8 years ago
David Majda 874b9c3dea Update copyright years to 2010-1016 8 years ago
David Majda f34ef59ff3 Merge pull request #382 from josephfrazier/travis-cache-node_modules
travis: cache node_modules for faster builds
8 years ago
David Majda 475215aa52 Expose the AST node visitor builder via PEG.compiler.visitor
This is useful mainly for plugins which manipulate the AST.
8 years ago
David Majda d34faba59e Speed up deduplication of expectations
The expectation deduplication algorithm called |Array.prototype.splice|
to eliminate each individual duplication, which was slow. This caused
problems with grammar/input combinations that generated a lot of
expecations (see #377 for an example).

This commit replaces the algorithm with much faster one, eliminating the
problem.
8 years ago
Joseph Frazier 2483b950e6 travis: cache node_modules for faster builds
This reduces build times by around 10 seconds.

http://blog.travis-ci.com/2013-12-05-speed-up-your-builds-cache-your-dependencies/
9 years ago
David Majda 972cafbee0 Merge pull request #380 from joseph-onsip/travis-container
travis: use containers for faster builds
9 years ago
David Majda f20054e1b5 Merge pull request #379 from joseph-onsip/browserify
Use browserify for building the browser version
9 years ago
Joseph Frazier 8bd2e4965e travis: use containers for faster builds
http://docs.travis-ci.com/user/migrating-from-legacy/
9 years ago
Joseph Frazier 0d8c045823 Use browserify for building the browser version
This resolves https://github.com/pegjs/pegjs/issues/373 and,
since `browserify` produces a UMD bundle (due to `--standalone PEG`),
addresses the first part of https://github.com/pegjs/pegjs/issues/362,

> 1. Making PEG.js itself UMD module.

This also adds a MAIN_FILE variable to the Makefile, as specified by
7fe3aeb999 (commitcomment-13817973)
9 years ago
David Majda a4a66a2e5b Switch from first/rest to head/tail in the PEG.js grammar
In the past year I worked on various grammars where first/rest or
head/tail were used as labels for parts of lists. I found I associate
head/tail with a list immediately, while in case of first/rest I have to
"parse" grammar rules for a while before understanding their structure.

Moreover, I tend to assume that rest is a list of the same thigs as
first, but I don't have such assumption in case of head/tail. This
assumption was in conflict with the grammar structure.

I'm not sure how much these observations are applicable to others, but I
decided to act on them and switch from first/rest to head/tail.
9 years ago
David Majda e510ecc3d0 Switch from first/rest to head/tail in example grammars
In the past year I worked on various grammars where first/rest or
head/tail were used as labels for parts of lists. I found I associate
head/tail with a list immediately, while in case of first/rest I have to
"parse" grammar rules for a while before understanding their structure.

Moreover, I tend to assume that rest is a list of the same thigs as
first, but I don't have such assumption in case of head/tail. This
assumption was in conflict with the grammar structure.

I'm not sure how much these observations are applicable to others, but I
decided to act on them and switch from first/rest to head/tail.
9 years ago
David Majda 10d7a6aded Simplify the arithmetics example grammar
The arithmetics example grammar is the first thing everyone sees in the
online editor at the PEG.js website, but it begins with a complicated
|combine| function in the initializer. Without understanding it it is
impossible to understand code in the actions. This may be a barrier to
learning how PEG.js works.

This commit removes the |combine| function and gets rid of the whole
initializer, removing the learning obstacle and streamlining action
code. The only cost is a slight code duplication.
9 years ago
David Majda 69a0f769fc Use literal raw text in error messages
Fixes #127.
9 years ago
David Majda 36eb7b81b5 Use single quotes for |rawText| in parser specs
PEG.js convention is to use single quotes for code and |rawText| *is* a
piece of code (originally).
9 years ago
David Majda 25ab98027d Remove info about found string from syntax errors
The |found| property wasn't very useful as it mostly contained just one
character or |null| (the exception being syntax errors triggered by
|error| or |expected|). Similarly, the "but XXX found" part of the error
message (based on the |found| property) wasn't much useful and was
redundant in presence of location info.

For these reasons, this commit removes the |found| property and
corresponding part of the error message from syntax errors. It also
modifies error location info slightly to cover a range of 0 characters,
not 1 character (except when the error is triggered by |error| or
|expected|). This corresponds more precisely to the actual situation.

Fixes #372.
9 years ago
David Majda 4466265763 README.md: Remove link to Trello board
Trello board was replaced by development roadmap in the wiki.
9 years ago
David Majda bbb4f006cd Report full rule chain in recursive rule errors
The idea came from a PR by @Mingun:

  https://github.com/pegjs/pegjs/pull/307
9 years ago
David Majda 491106c347 Report left recursion and infinite loops only as "possible"
A semantic predicate can prevent the parser to actually enter infinite
recursion or loop. This is undetectable at compile-time.
9 years ago
David Majda ebf5d969b2 s/alwaysAdvancesOnSuccess/alwaysConsumesOnSuccess/
Matches terminology change from the previous commit.
9 years ago
David Majda 6ff005786c Talk about "consuming input", not "advancing parser position"
It's shorter, less technical, and more understandible.
9 years ago
David Majda 091e60112c Consistently use "matched text" to describe matched part of the input 9 years ago
David Majda 60ebd9e695 Simplify JSHint directives 9 years ago
David Majda efb420479e Tweak package.json 9 years ago
David Majda 48fe4d6580 Rename generate-javascript.js to generate-js.js
Short & sweet.
9 years ago
David Majda 575883586f Rename javascript.js to js.js
Short & sweet.
9 years ago
David Majda 20a4fb2e7f Update version to 0.9.0 9 years ago
David Majda 7aa4d519db Update CHANGELOG.md 9 years ago
David Majda 9e8cb04c81 examples/arithmetics.pegjs: Remove trailing whitespace 9 years ago
David Majda a2d6488dae CHANGELOG.md: Add header 9 years ago
David Majda cee0d6a60a README.md: Update the "Compatibility" section
* Added io.js.
  * Added Edge.
  * Spelled out IE.
9 years ago
David Majda 787239e15c Update copyright years 9 years ago
David Majda be5d14eb27 Update jQuery.scrollTo's LICENSE file
I forgot to do that after upgrading jQuery.scrollTo itself.
9 years ago