Commit graph

195 commits

Author SHA1 Message Date
David Majda 918dcf6ed2 Test and benchmark command-line runners can be run from any directory 2011-01-26 16:08:03 +01:00
David Majda aa2327191f Escape 0xFF still with "\x", not "\u" 2011-01-26 14:10:00 +01:00
David Majda d5caaa7877 Nicer messages in command-line mode on read/write errors 2011-01-26 14:01:57 +01:00
David Majda 957b96c1b5 Add check for missing parameter of the -e/--export-var option. 2011-01-26 13:52:39 +01:00
David Majda 8f005c027b Fix encoding in |fs.readFileSync| calls ("utf-8" -> "utf8") 2011-01-26 13:07:39 +01:00
David Majda d0c074e2f8 Small style fixes 2011-01-26 13:05:40 +01:00
David Majda 8e63ad3b6c Add command-line runner for the benchmark suite 2011-01-26 12:59:29 +01:00
David Majda a091cb2ffd Factor out parts of benchmarks unrelated to running in the browser 2011-01-26 12:59:29 +01:00
David Majda fc1f489165 Save one concatenation when creating cache keys in generated parsers
Results of benchmark with 100 runs on V8:

  Before:  38.06 kB/s
  After:   38.72 kB/s
  Speedup: 1.734 %

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.10 (KHTML, like
Gecko) Chrome/8.0.552.237 Safari/534.10
2011-01-26 11:53:16 +01:00
David Majda afcceb127f Add command-line runner for the test suite
The output format and code is heavily inspired by Nodeunit and code in
QUnit's "cli" branch.
2011-01-25 16:59:32 +01:00
David Majda 0e9d58ea96 Upgrade QUnit to the current master (c532d183664118fc2ca1) 2011-01-25 14:54:38 +01:00
David Majda 98cbd57ead Add two missing |var|s (fix global namespace pollution) 2011-01-25 11:21:47 +01:00
David Majda 1a3291fa36 Jakefile: Put the LIB_DIR existence check & creation at the right place 2011-01-25 10:35:48 +01:00
David Majda 595d3adb82 Add package.json for installing as Node package 2011-01-24 16:05:20 +01:00
David Majda 88f901f36e Jakefile: Create the "lib" directory if it does not exist
Closes GH-14.
Closes GH-15.
2011-01-24 13:57:48 +01:00
David Majda 4c59bbfef9 Fixes to previous commit
Require PEG only in the "parser" task -- it may not exist when executing
the "build" task. Also don't make the "build" task dependent on the
"parser" to break a dependency circle.
2011-01-24 13:55:14 +01:00
David Majda f3845726f2 Rakefile -> Jakefile
Or, swapped Ruby dependency for a Node dependency.

The build script was also modified to always regenerate the parser (in
case of the "parser" task) or rebuild the library (in case of the
"build" task) even if the source files were not modified. Not doing this
led to problems when the generating code changed but the files didn't
(which happened often during development).
2011-01-24 13:51:50 +01:00
David Majda 814ce7d9db Switch command-line mode backend from Rhino to Node 2011-01-24 10:57:00 +01:00
David Majda e25dcfbac8 Update CHANGELOG 2010-11-28 17:18:51 +01:00
David Majda aeb2cb4f1c Make sure quoting functions output only ASCII characters
This patch prevents portability problems. In particular, it fixes a
problem where "SyntaxError: Invalid range in character class." error
appeared when using command-line version on Widnows (see GH-13).
2010-11-20 16:58:47 +01:00
David Majda 4d68812b65 Fix usage description 2010-11-14 18:13:28 +01:00
David Majda 490eeadffe Bump version to 0.5+ 2010-11-14 17:30:54 +01:00
David Majda 977d1d20c7 Fix wrong version reported by "bin/pegjs --version"
DRY: Now the version is stored only in the VERSION file.
2010-11-14 17:14:10 +01:00
David Majda 4ea2003b7b Export PEG.VERSION property with PEG.js version
Value of the property is read in build time from the VERSION file.
2010-11-14 17:11:36 +01:00
David Majda e3effab86b Behave correctly in Rhino context (fixes previous commit) 2010-09-28 21:06:01 +02:00
David Majda 2120de36af Behave like CommonJS module in CommonJS context 2010-09-28 21:02:11 +02:00
David Majda 77ec4f7162 Little bit cleaner way to protect against |undefined| redefinition 2010-09-28 20:22:44 +02:00
David Majda a12a24fca1 Make parsers generated by /bin/pegjs CommonJS modules by default 2010-09-28 16:44:04 +02:00
David Majda 2d38c5cab3 Handle non-unique expected values of match failuers differently
Before this commit, uniqueness was checked when addding the failure. Now
we make the entiries unique when generating the error report, saving a
little time when the parsing is successful. This does not increase the
benchmark numbers too much though.

Results of benchmark with 100 runs on V8:

  Before:  37.25 kB/s
  After:   37.41 kB/s
  Speedup: 0.241 %

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.3 (KHTML, like
Gecko) Chrome/6.0.472.63 Safari/534.3
2010-09-28 13:40:48 +02:00
David Majda b6288a8d9c Avoid quoting when reporting errors for literals
This is a small win performance-wise.

Results of benchmark with 100 runs on V8:

  Before:  31.65 kB/s
  After:   32.83 kB/s
  Speedup: 3.728 %

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like
Gecko) Chrome/5.0.375.127 Safari/533.4
2010-08-22 19:02:08 +02:00
David Majda c8836c0312 Remove two unused variables 2010-08-22 18:15:53 +02:00
David Majda 7b03f164b8 Avoid passing |context| in the generated parser
Passing the context is not necessary, global variable is good enough
(passing the context would make more sense if each AST node was
translated into a function call, but this isn't the case).

The performance gain is very small, on the border of statstical error.

Results of benchmark with 100 runs on V8:

  Before:  31.49 kB/s
  After:   31.57 kB/s
  Speedup: 0.254 %

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like
Gecko) Chrome/5.0.375.127 Safari/533.4
2010-08-22 17:56:08 +02:00
David Majda a42b957573 Remove now mostly useless comment headers from the code 2010-08-21 15:38:17 +02:00
David Majda d493a4d143 Move test helper into its own file + reorder test file includes 2010-08-21 15:34:56 +02:00
David Majda fea6d85194 Little compiler tests clean-up 2010-08-21 15:30:23 +02:00
David Majda 8918d77da1 Add compiler passes tests (currently testing the one pass that exists) 2010-08-21 14:36:44 +02:00
David Majda 95f70c9562 Test the checks directly, do not go through |PEG.buildParser| 2010-08-21 11:59:42 +02:00
David Majda f82a4ebf28 Compiler checks and passes are named for easier reference from tests 2010-08-21 11:55:46 +02:00
David Majda 906488027b Fix stupid mistakes in the |buildNodeVisitor| function 2010-08-21 11:54:35 +02:00
David Majda 1b75a7b9b3 Split-off |PEG.compiler.checks| tests 2010-08-18 21:15:48 +02:00
David Majda b15eb0bb5f Change term "grammar parser" to "parser" in tests 2010-08-18 21:07:04 +02:00
David Majda b105c43756 Define |global| object in different way in tests 2010-08-18 20:59:03 +02:00
David Majda f787793848 Rename |node| -> |subnode| to avoid aliasing 2010-08-17 20:53:13 +02:00
David Majda 088c78e88c Fix incorrect variable name on two places 2010-08-17 20:44:24 +02:00
David Majda 4d50a37b14 Extract |buildNodeVisitor| 2010-08-17 20:34:14 +02:00
David Majda 1279e87766 Simplify utility functions structure + do not export them as part of the PEG object 2010-08-16 21:20:37 +02:00
David Majda 5ab36f8018 Split the vendor directory
There are now three vendor directories. The goal is to have test- and
benchmark-specific stuff is its own directories and not in the main one.

  vendor
  test/vendor
  benchmark/vendor
2010-08-15 19:50:59 +02:00
David Majda 44f541330e Rakefile: Make everything dependencies-based again 2010-08-15 19:45:51 +02:00
David Majda 9e2fc76fc5 Rakefile: Rename "metaparser" task to "parser"
This is more consistent with nomenclature in the code and with the file
names.
2010-08-15 19:45:51 +02:00
David Majda e59f3ba338 Split the source code into several files, introduce build system
The source code is now in the src directory. The library needs to be
built using "rake", which creates the lib/peg.js file by combining the
source files.
2010-08-15 19:45:51 +02:00