Commit graph

891 commits

Author SHA1 Message Date
David Majda 972cafbee0 Merge pull request #380 from joseph-onsip/travis-container
travis: use containers for faster builds
2015-10-17 09:21:52 +02:00
David Majda f20054e1b5 Merge pull request #379 from joseph-onsip/browserify
Use browserify for building the browser version
2015-10-17 09:14:09 +02:00
Joseph Frazier 8bd2e4965e travis: use containers for faster builds
http://docs.travis-ci.com/user/migrating-from-legacy/
2015-10-16 11:52:37 -04:00
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)
2015-10-16 10:46:11 -04:00
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.
2015-10-09 17:23:36 +02:00
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.
2015-10-09 17:09:33 +02:00
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.
2015-10-09 16:34:19 +02:00
David Majda 69a0f769fc Use literal raw text in error messages
Fixes #127.
2015-09-18 10:56:05 -07:00
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).
2015-09-18 10:17:57 -07:00
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.
2015-09-18 10:01:15 -07:00
David Majda 4466265763 README.md: Remove link to Trello board
Trello board was replaced by development roadmap in the wiki.
2015-09-11 16:46:26 +02:00
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
2015-09-11 15:09:42 +02:00
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.
2015-09-11 14:58:53 +02:00
David Majda ebf5d969b2 s/alwaysAdvancesOnSuccess/alwaysConsumesOnSuccess/
Matches terminology change from the previous commit.
2015-09-04 17:35:37 +02:00
David Majda 6ff005786c Talk about "consuming input", not "advancing parser position"
It's shorter, less technical, and more understandible.
2015-09-04 17:23:42 +02:00
David Majda 091e60112c Consistently use "matched text" to describe matched part of the input 2015-09-04 17:15:22 +02:00
David Majda 60ebd9e695 Simplify JSHint directives 2015-09-04 16:52:38 +02:00
David Majda efb420479e Tweak package.json 2015-09-04 16:39:58 +02:00
David Majda 48fe4d6580 Rename generate-javascript.js to generate-js.js
Short & sweet.
2015-09-04 15:41:20 +02:00
David Majda 575883586f Rename javascript.js to js.js
Short & sweet.
2015-09-04 15:38:17 +02:00
David Majda 20a4fb2e7f Update version to 0.9.0 2015-08-30 08:22:26 +02:00
David Majda 7aa4d519db Update CHANGELOG.md 2015-08-30 08:22:26 +02:00
David Majda 9e8cb04c81 examples/arithmetics.pegjs: Remove trailing whitespace 2015-08-28 14:01:30 +02:00
David Majda a2d6488dae CHANGELOG.md: Add header 2015-08-28 11:24:48 +02:00
David Majda cee0d6a60a README.md: Update the "Compatibility" section
* Added io.js.
  * Added Edge.
  * Spelled out IE.
2015-08-24 11:16:10 +02:00
David Majda 787239e15c Update copyright years 2015-08-21 20:38:58 +02:00
David Majda be5d14eb27 Update jQuery.scrollTo's LICENSE file
I forgot to do that after upgrading jQuery.scrollTo itself.
2015-08-21 20:38:51 +02:00
David Majda a4b4a57569 Custom tracers specs: s/'/"/
The convention is to use single quotes only for strings containing code.
2015-08-21 17:38:04 +02:00
David Majda 1d38b973ee Custom tracers specs: Simplify code slightly 2015-08-21 17:36:34 +02:00
David Majda 671c22e80f Avoid using |console| in default tracer and its tests when not defined
This makes default tracer and its tests work in IE 8-10.
2015-08-21 17:32:37 +02:00
David Majda e8b379f945 Rewrite |trace| option tests to avoid using |console|
This makes them cleaner and also makes them work in IE 8-10.
2015-08-21 17:32:23 +02:00
David Majda cca41e6618 Quote |class| object literal key
It broke IE 8.
2015-08-21 16:36:43 +02:00
David Majda 6d82422045 Remove trailing comma in an array literal
It caused an additional newline in generated parsers in IE 8.
2015-08-21 16:02:23 +02:00
David Majda 969d39e8d9 Remove trailing commas in object literals
They broke IE 8-9.
2015-08-21 16:02:13 +02:00
David Majda 2d0ab55fa2 Use jQuery.scrollTo 2.1.1 2015-08-21 12:23:37 +02:00
David Majda b929f6ed97 Use jQuery 1.11.3 2015-08-21 12:20:46 +02:00
David Majda ae407572e6 Use jshint 2.8.0 2015-08-21 12:11:37 +02:00
David Majda 9cea4502f0 Use uglify-js 2.4.24 2015-08-21 12:04:03 +02:00
David Majda 698dba299a Use jasmine-node 1.14.5 2015-08-21 11:54:16 +02:00
David Majda d5f93a8282 Fix comment typo 2015-08-18 10:58:22 +02:00
David Majda a4772376fb Renumber bytecode instructions sequentially 2015-08-18 10:57:50 +02:00
David Majda ad27a300a8 Fix left recursion detection in sequences
Report left recursion also in cases where the recursive rule invocation
is not a direct element of a sequence, but is wrapped inside an
expression.

Fixes #359.
2015-08-17 10:58:37 +02:00
David Majda 9eb62051be package.json: Add the "license" attribute
Based on a pull request by Peter deHaan (@pdehaan):

  https://github.com/pegjs/pegjs/pull/338
2015-08-14 14:14:45 +02:00
David Majda cdeecf750f reportLeftRecursion: Change handling of the |visitedRules| array
Before this commit, the |reportLeftRecursion| pass was written in
functional style, passing the |visitedRules| array around as a parameter
and making a new copy each time a rule was visited. This apparently
caused performance problems in some deeply recursive grammars.

This commit makes it so that there is just one array which is shared
across all the visitor functions via a closure and modified as rules are
visited.

I don't like losing the functional style (it was elegant) but
performance is more important.

Fixes #203.
2015-08-07 14:52:22 +02:00
David Majda de1704f007 Replace |util.{puts,error}| by |console.{log,error}|
The |util.puts| and |util.error| functions are deprecated in Node.js
0.12.x.

Based on a pull request by Jan Stránský (@burningtree):

  https://github.com/pegjs/pegjs/pull/334
2015-08-06 17:23:07 +02:00
David Majda 4b154e177f Update character categories in grammars to Unicode 8.0.0 2015-08-06 16:42:26 +02:00
David Majda 703a352985 Change few testcase descriptions
Reaction to changes in 130cbcfaa3.
2015-08-06 16:38:38 +02:00
David Majda d7d7e87874 Make infinite loop and left recursion detectors work with named rules
Add missing |named| case to the visitor in lib/compiler/asts.js, which
makes the infinite loop and left recursion detectors work correctly with
named rules.

The missing case caused |make parser| to fail with:

  140:34: Infinite loop detected.
  make: *** [parser] Error 1
2015-08-06 16:32:08 +02:00
David Majda 130cbcfaa3 Rename asts.matchesEmpty to alwaysAdvancesOnSuccess and negate it
This makes it more clear that the function isn't about the input the
expression *matched* but about the input it *consumed* when it matched.

Based on a comment by @Mingun:

  https://github.com/pegjs/pegjs/pull/307#issuecomment-89512575
2015-07-31 13:48:46 +02:00
David Majda 317059760a Fix incorrect pass name in a spec description 2015-07-17 15:37:45 +02:00