Commit graph

20 commits

Author SHA1 Message Date
David Majda 52704593cd Allow labeled expressions in the metagrammar (without any meaning yet) 2010-05-31 16:35:03 +02:00
David Majda 698564a3c2 Replace ":" after a rule name with "="
I'll introduce labelled expressions shortly and I want to use ":" as a
label-expression separator. This change avoids conflict between the two
meanings of ":". (What would e.g. "foo: 'bar'" mean?  Rule "foo"
matching string "bar", or string "bar" labelled "foo"?)
2010-05-31 16:31:45 +02:00
David Majda 7fdf0492c7 Fixed error message for invalid character range + added test 2010-05-31 16:30:02 +02:00
David Majda 9bf86b89a6 Fix stupid mistakes in metagrammar-test.js
The mistakes weren't caught because the first one introduces a syntax
error, causing the whole test suite not to load. Unfortunately, QUnit
didn't complain so I missed this.

The real commit these changes belong to is
33a1a7c1e9.
2010-05-22 18:58:41 +02:00
David Majda 33a1a7c1e9 Clean up class handling in the metagrammar and compiler
The class AST node now contains structured data and a raw text which is
used for error messages.
2010-05-22 10:55:12 +02:00
David Majda 137a4b4f53 Renamed |characters| -> |chars| (shorter, no loss of expressivity) 2010-05-21 21:18:33 +02:00
David Majda 76ed63c86e AST refactoring 6/6: Get rid of the |Grammar| namespace 2010-05-21 19:00:00 +02:00
David Majda b4bf49443a AST refactoring 5/6: Make AST classless 2010-05-21 18:54:52 +02:00
David Majda 1c7c5bb5da Correct variable name: "choice" -> "optional". 2010-05-15 19:56:50 +02:00
David Majda b2f230fad2 Added Optional AST node.
This does not speed up the benchmark suite execution statistically significantly
on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   28.84 kB/s   28.75 kB/s
      2   28.76 kB/s   28.69 kB/s
      3   28.72 kB/s   28.69 kB/s
      4   28.84 kB/s   28.93 kB/s
      5   28.82 kB/s   28.70 kB/s
---------------------------------
Average   28.80 kB/s   28.75 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko)
Chrome/5.0.342.9 Safari/533.2
2010-04-21 21:19:48 +02:00
David Majda e5df8284b5 Added AndPredicate AST node.
This does not speed up the benchmark suite execution statistically significantly
on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   28.72 kB/s   28.84 kB/s
      2   28.84 kB/s   28.76 kB/s
      3   28.83 kB/s   28.72 kB/s
      4   28.81 kB/s   28.84 kB/s
      5   28.76 kB/s   28.82 kB/s
---------------------------------
Average   28.79 kB/s   28.80 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
2010-04-21 12:02:45 +02:00
David Majda c3c1c79665 Added OneOrMore AST node.
This speeds up the benchmark suite execution by 1.08% on V8.

Detailed results (benchmark suite totals):

---------------------------------
 Test #     Before       After
---------------------------------
      1   28.38 kB/s   28.72 kB/s
      2   28.52 kB/s   28.84 kB/s
      3   28.41 kB/s   28.83 kB/s
      4   28.47 kB/s   28.81 kB/s
      5   28.64 kB/s   28.76 kB/s
---------------------------------
Average   28.48 kB/s   28.79 kB/s
---------------------------------

Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
2010-04-20 21:09:23 +02:00
David Majda 4b51e6a6d3 Quote null characters in regexps, IE does not like them. 2010-04-16 08:53:02 +02:00
David Majda 7fc491412d Work around the fact that IE does not recognize "\v" in strings. 2010-04-14 21:29:05 +02:00
David Majda 3291c70d97 Added \uFEFF (BOM) to the definition of whitespace in the metagrammar.
The Rhino bug that prevented inclusion of \uFEFF among the whitespace characters
is no longer relevant here because we compile character classes into regexps
now, which avoids the infinite recursion.
2010-04-11 11:45:05 +02:00
David Majda 383c5acaa6 Replaced \xA0 by \u00A0 in the whitespace definition in the metagrammar.
This is purely stylistic change.
2010-04-11 11:18:42 +02:00
David Majda 4f4bb34ded Implemented negative character classes (e.g. [^a-z]). 2010-03-20 12:08:45 +01:00
David Majda b3381b9352 Fixed test name. 2010-03-20 11:51:31 +01:00
David Majda 22d2ac8ac2 Rewrote implementation of classes to be regexp-based. 2010-03-20 11:24:04 +01:00
David Majda a43d1b33e3 Bootstrapped the grammar parser, yay! I should have done this long ago. 2010-03-13 15:18:57 +01:00