wikipeg 2.0.5 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/VERSION +1 -1
- package/bin/wikipeg +18 -0
- package/lib/compiler/language/javascript.js +8 -2
- package/lib/compiler/language/php.js +15 -10
- package/lib/compiler/passes/ast-to-code.js +61 -18
- package/lib/parser.js +2 -0
- package/lib/peg.js +1 -1
- package/lib/runtime/template.js +1 -3
- package/lib/runtime/template.php +61 -47
- package/package.json +47 -47
- package/src/DefaultTracer.php +61 -60
- package/src/Expectation.php +48 -46
- package/src/InternalError.php +1 -1
- package/src/Location.php +33 -32
- package/src/LocationRange.php +32 -30
- package/src/PEGParserBase.php +298 -277
- package/src/SyntaxError.php +30 -27
- package/src/Tracer.php +2 -2
- package/CHANGELOG.md +0 -433
package/CHANGELOG.md
DELETED
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
0.8.0
|
|
2
|
-
-----
|
|
3
|
-
|
|
4
|
-
Released: December 24, 2013
|
|
5
|
-
|
|
6
|
-
### Big Changes
|
|
7
|
-
|
|
8
|
-
* Completely rewrote the code generator. Among other things, it allows
|
|
9
|
-
optimizing generated parsers for parsing speed or code size using the
|
|
10
|
-
`optimize` option of the `PEG.buildParser` method or the `--optimize`/`-o`
|
|
11
|
-
option on the command-line. All internal identifiers in generated code now
|
|
12
|
-
also have a `peg$` prefix to discourage their use and avoid conflicts.
|
|
13
|
-
[[#35](https://github.com/dmajda/pegjs/issues/35),
|
|
14
|
-
[#92](https://github.com/dmajda/pegjs/issues/92)]
|
|
15
|
-
|
|
16
|
-
* Completely redesigned error handling. Instead of returning `null` inside
|
|
17
|
-
actions to indicate match failure, new `expected` and `error` functions can
|
|
18
|
-
be called to trigger an error. Also, expectation inside the `SyntaxError`
|
|
19
|
-
exceptions are now structured to allow easier machine processing.
|
|
20
|
-
[[#198](https://github.com/dmajda/pegjs/issues/198)]
|
|
21
|
-
|
|
22
|
-
* Implemented a plugin API. The list of plugins to use can be specified using
|
|
23
|
-
the `plugins` option of the `PEG.buildParser` method or the `--plugin`
|
|
24
|
-
option on the command-line. Also implemented the `--extra-options` and
|
|
25
|
-
`--extra-options-file` command-line options, which are mainly useful to pass
|
|
26
|
-
additional options to plugins.
|
|
27
|
-
[[#106](https://github.com/dmajda/pegjs/issues/106)]
|
|
28
|
-
|
|
29
|
-
* Made `offset`, `line` and `column` functions, not variables. They are now
|
|
30
|
-
available in all parsers and return lazily-computed position data. Removed
|
|
31
|
-
now useless `trackLineAndColumn` option of the `PEG.buildParser` method and
|
|
32
|
-
the `--track-line-and-column` option on the command-line.
|
|
33
|
-
|
|
34
|
-
* Added a new `text` function. When called inside an action, it returns the
|
|
35
|
-
text matched by action's expression.
|
|
36
|
-
[[#131](https://github.com/dmajda/pegjs/issues/131)]
|
|
37
|
-
|
|
38
|
-
* Added a new `$` operator. It extracts matched strings from expressions.
|
|
39
|
-
|
|
40
|
-
* The `?` operator now returns `null` on unsuccessful match.
|
|
41
|
-
|
|
42
|
-
* Predicates now always return `undefined`.
|
|
43
|
-
|
|
44
|
-
* Replaced the `startRule` parameter of the `parse` method in generated
|
|
45
|
-
parsers with more generic `options` parameter. The start rule can now be
|
|
46
|
-
specified as the `startRule` option. The `options` parameter can be also
|
|
47
|
-
used to pass custom options to the parser because it is visible as the
|
|
48
|
-
`options` variable inside parser code.
|
|
49
|
-
[[#37](https://github.com/dmajda/pegjs/issues/37)]
|
|
50
|
-
|
|
51
|
-
* The list of allowed start rules of a generated parser now has to be
|
|
52
|
-
specified explicitly using the `allowedStartRules` option of the
|
|
53
|
-
`PEG.buildParser` method or the `--allowed-start-rule` option on the
|
|
54
|
-
command-line. This will make certain optimizations like rule inlining easier
|
|
55
|
-
in the future.
|
|
56
|
-
|
|
57
|
-
* Removed the `toSource` method of generated parsers and introduced a new
|
|
58
|
-
`output` option of the `PEG.buildParser` method. It allows callers to
|
|
59
|
-
specify whether they want to get back the parser object or its source code.
|
|
60
|
-
|
|
61
|
-
* The source code is now a valid npm package. This makes using development
|
|
62
|
-
versions easier.
|
|
63
|
-
[[#32](https://github.com/dmajda/pegjs/issues/32)]
|
|
64
|
-
|
|
65
|
-
* Generated parsers are now ~25% faster and ~62%/~3% smaller (when optimized
|
|
66
|
-
for size/speed) than those generated by 0.7.0.
|
|
67
|
-
|
|
68
|
-
* Requires Node.js 0.8.0+.
|
|
69
|
-
|
|
70
|
-
### Small Changes
|
|
71
|
-
|
|
72
|
-
* `bin/pegjs` now outputs just the parser source if the value of the
|
|
73
|
-
`--export-var` option is empty. This makes embedding generated parsers into
|
|
74
|
-
other files easier.
|
|
75
|
-
[[#143](https://github.com/dmajda/pegjs/issues/143)]
|
|
76
|
-
|
|
77
|
-
* Changed the value of the `name` property of `PEG.GrammarError` instances
|
|
78
|
-
from “PEG.GrammarError” to just “GrammarError”. This better reflects the
|
|
79
|
-
fact that PEG.js can get required with different variable name than `PEG`.
|
|
80
|
-
|
|
81
|
-
* Setup prototype chain for `PEG.GrammarError` correctly.
|
|
82
|
-
|
|
83
|
-
* Setup prototype chain for `SyntaxError` in generated parsers correctly.
|
|
84
|
-
|
|
85
|
-
* Fixed error messages in certain cases with trailing input
|
|
86
|
-
[[#119](https://github.com/dmajda/pegjs/issues/119)]
|
|
87
|
-
|
|
88
|
-
* Fixed code generated for classes starting with `\^`.
|
|
89
|
-
[[#125](https://github.com/dmajda/pegjs/issues/125)]
|
|
90
|
-
|
|
91
|
-
* Fixed too eager proxy rules removal.
|
|
92
|
-
[[#137](https://github.com/dmajda/pegjs/issues/137)]
|
|
93
|
-
|
|
94
|
-
* Added a license to all vendored libraries.
|
|
95
|
-
[[#207](https://github.com/dmajda/pegjs/issues/207)]
|
|
96
|
-
|
|
97
|
-
* Converted the test suite from QUnit to Jasmine, cleaning it up on the way.
|
|
98
|
-
|
|
99
|
-
* Travis CI integration.
|
|
100
|
-
|
|
101
|
-
* Various internal code improvements and fixes.
|
|
102
|
-
|
|
103
|
-
* Various generated code improvements and fixes.
|
|
104
|
-
|
|
105
|
-
* Various example grammar improvements and fixes.
|
|
106
|
-
|
|
107
|
-
* Improved `README.md`.
|
|
108
|
-
|
|
109
|
-
* Converted `CHANGELOG` to Markdown.
|
|
110
|
-
|
|
111
|
-
0.7.0
|
|
112
|
-
-----
|
|
113
|
-
|
|
114
|
-
Released: April 18, 2012
|
|
115
|
-
|
|
116
|
-
### Big Changes
|
|
117
|
-
|
|
118
|
-
* Added ability to pass options to `PEG.buildParser`.
|
|
119
|
-
|
|
120
|
-
* Implemented the `trackLineAndColumn` option for `PEG.buildParser` (together
|
|
121
|
-
with the `--track-line-and-column` command-line option). It makes the
|
|
122
|
-
generated parser track line and column during parsing. These are made
|
|
123
|
-
available inside actions and predicates as `line` and `column` variables.
|
|
124
|
-
|
|
125
|
-
* Implemented the `cache` option for `PEG.buildParser` (together with the
|
|
126
|
-
`--cache` command-line option). This option enables/disables the results
|
|
127
|
-
cache in generated parsers, resulting in dramatic speedup when the cache is
|
|
128
|
-
disabled (the default now). The cost is breaking the linear parsing time
|
|
129
|
-
guarantee.
|
|
130
|
-
|
|
131
|
-
* The current parse position is visible inside actions and predicates as the
|
|
132
|
-
`offset` variable.
|
|
133
|
-
|
|
134
|
-
* Exceptions thrown by the parser have `offset`, `expected` and `found`
|
|
135
|
-
properties containing machine-readable information about the parse failure
|
|
136
|
-
(based on a patch by Marcin Stefaniuk).
|
|
137
|
-
|
|
138
|
-
* Semantic predicates have access to preceding labels.
|
|
139
|
-
[[GH-69](https://github.com/dmajda/pegjs/issues/69)]
|
|
140
|
-
|
|
141
|
-
* Implemented case-insensitive literal and class matching.
|
|
142
|
-
[[GH-34](https://github.com/dmajda/pegjs/issues/34)]
|
|
143
|
-
|
|
144
|
-
* Rewrote the code generator — split some computations into separate passes
|
|
145
|
-
and based it on a proper templating system (Codie).
|
|
146
|
-
|
|
147
|
-
* Rewrote variable handling in generated parsers in a stack-like fashion,
|
|
148
|
-
simplifying the code and making the parsers smaller and faster.
|
|
149
|
-
|
|
150
|
-
* Adapted to Node.js 0.6.6+ (no longer supported in older versions).
|
|
151
|
-
|
|
152
|
-
* Dropped support for IE < 8.
|
|
153
|
-
|
|
154
|
-
* As a result of several optimizations, parsers generated by 0.7.0 are ~6.4
|
|
155
|
-
times faster and ~19% smaller than those generated by 0.6.2 (as reported by
|
|
156
|
-
`/tools/impact`).
|
|
157
|
-
|
|
158
|
-
### Small Changes
|
|
159
|
-
|
|
160
|
-
* Fixed reported error position when part of the input is not consumed.
|
|
161
|
-
[[GH-48](https://github.com/dmajda/pegjs/issues/48)]
|
|
162
|
-
|
|
163
|
-
* Fixed incorrect disjunction operator in `computeErrorPosition` (original
|
|
164
|
-
patch by Wolfgang Kluge).
|
|
165
|
-
|
|
166
|
-
* Fixed regexp for detecting command-line options in `/bin/pegjs`.
|
|
167
|
-
[[GH-51](https://github.com/dmajda/pegjs/issues/51)]
|
|
168
|
-
|
|
169
|
-
* Generate more efficient code for empty literals (original patch by Wolfgang
|
|
170
|
-
Kluge).
|
|
171
|
-
|
|
172
|
-
* Fixed comment typos (patches by Wolfgang Kluge and Jason Davies).
|
|
173
|
-
[[GH-59](https://github.com/dmajda/pegjs/issues/59)]
|
|
174
|
-
|
|
175
|
-
* Fixed a typo in JavaScript example grammar.
|
|
176
|
-
[[GH-62](https://github.com/dmajda/pegjs/issues/62)]
|
|
177
|
-
|
|
178
|
-
* Made copy & paste inclusion of the PEG.js library into another code easier
|
|
179
|
-
by changing how the library is exported.
|
|
180
|
-
|
|
181
|
-
* Improved the copyright comment and the “Generated by...” header.
|
|
182
|
-
|
|
183
|
-
* Replaced `Jakefile` with `Makefile`.
|
|
184
|
-
|
|
185
|
-
* Added `make hint` task that checks all JavaScript files using JSHint and
|
|
186
|
-
resolved all issues it reported. All JavaScript files and also generated
|
|
187
|
-
parsers are JSHint-clean now.
|
|
188
|
-
|
|
189
|
-
* Fixed output printed during test failures (expected value was being printed
|
|
190
|
-
instead of the actual one). Original patch by Wolfgang Kluge.
|
|
191
|
-
|
|
192
|
-
* Added a `/tools/impact` script to measure speed and size impact of commits.
|
|
193
|
-
|
|
194
|
-
* Various generated code improvements and fixes.
|
|
195
|
-
|
|
196
|
-
* Various internal code improvements and fixes.
|
|
197
|
-
|
|
198
|
-
* Improved `README.md`.
|
|
199
|
-
|
|
200
|
-
0.6.2
|
|
201
|
-
-----
|
|
202
|
-
|
|
203
|
-
Released: August 20, 2011
|
|
204
|
-
|
|
205
|
-
### Small Changes
|
|
206
|
-
|
|
207
|
-
* Reset parser position when action returns `null`.
|
|
208
|
-
|
|
209
|
-
* Fixed typo in JavaScript example grammar.
|
|
210
|
-
|
|
211
|
-
0.6.1
|
|
212
|
-
-----
|
|
213
|
-
|
|
214
|
-
Released: April 14, 2011
|
|
215
|
-
|
|
216
|
-
### Small Changes
|
|
217
|
-
|
|
218
|
-
* Use `--ascii` option when generating a minified version.
|
|
219
|
-
|
|
220
|
-
0.6.0
|
|
221
|
-
-----
|
|
222
|
-
|
|
223
|
-
Released: April 14, 2011
|
|
224
|
-
|
|
225
|
-
### Big Changes
|
|
226
|
-
|
|
227
|
-
* Rewrote the command-line mode to be based on Node.js instead of Rhino — no
|
|
228
|
-
more Java dependency. This also means that PEG.js is available as a Node.js
|
|
229
|
-
package and can be required as a module.
|
|
230
|
-
|
|
231
|
-
* Version for the browser is built separately from the command-line one in two
|
|
232
|
-
flavors (normal and minified).
|
|
233
|
-
|
|
234
|
-
* Parser variable name is no longer required argument of `bin/pegjs` — it is
|
|
235
|
-
`module.exports` by default and can be set using the `-e`/`--export-var`
|
|
236
|
-
option. This makes parsers generated by `/bin/pegjs` Node.js modules by
|
|
237
|
-
default.
|
|
238
|
-
|
|
239
|
-
* Added ability to start parsing from any grammar rule.
|
|
240
|
-
|
|
241
|
-
* Added several compiler optimizations — 0.6 is ~12% faster than 0.5.1 in the
|
|
242
|
-
benchmark on V8.
|
|
243
|
-
|
|
244
|
-
### Small Changes
|
|
245
|
-
|
|
246
|
-
* Split the source code into multiple files combined together using a build
|
|
247
|
-
system.
|
|
248
|
-
|
|
249
|
-
* Jake is now used instead of Rake for build scripts — no more Ruby
|
|
250
|
-
dependency.
|
|
251
|
-
|
|
252
|
-
* Test suite can be run from the command-line.
|
|
253
|
-
|
|
254
|
-
* Benchmark suite can be run from the command-line.
|
|
255
|
-
|
|
256
|
-
* Benchmark browser runner improvements (users can specify number of runs,
|
|
257
|
-
benchmarks are run using `setTimeout`, table is centered and fixed-width).
|
|
258
|
-
|
|
259
|
-
* Added PEG.js version to “Generated by...” line in generated parsers.
|
|
260
|
-
|
|
261
|
-
* Added PEG.js version information and homepage header to `peg.js`.
|
|
262
|
-
|
|
263
|
-
* Generated code improvements and fixes.
|
|
264
|
-
|
|
265
|
-
* Internal code improvements and fixes.
|
|
266
|
-
|
|
267
|
-
* Rewrote `README.md`.
|
|
268
|
-
|
|
269
|
-
0.5.1
|
|
270
|
-
-----
|
|
271
|
-
|
|
272
|
-
Released: November 28, 2010
|
|
273
|
-
|
|
274
|
-
### Small Changes
|
|
275
|
-
|
|
276
|
-
* Fixed a problem where “SyntaxError: Invalid range in character class.” error
|
|
277
|
-
appeared when using command-line version on Widnows
|
|
278
|
-
([GH-13](https://github.com/dmajda/pegjs/issues/13)).
|
|
279
|
-
|
|
280
|
-
* Fixed wrong version reported by `bin/pegjs --version`.
|
|
281
|
-
|
|
282
|
-
* Removed two unused variables in the code.
|
|
283
|
-
|
|
284
|
-
* Fixed incorrect variable name on two places.
|
|
285
|
-
|
|
286
|
-
0.5
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
Released: June 10, 2010
|
|
290
|
-
|
|
291
|
-
### Big Changes
|
|
292
|
-
|
|
293
|
-
* Syntax change: Use labeled expressions and variables instead of `$1`, `$2`,
|
|
294
|
-
etc.
|
|
295
|
-
|
|
296
|
-
* Syntax change: Replaced `:` after a rule name with `=`.
|
|
297
|
-
|
|
298
|
-
* Syntax change: Allow trailing semicolon (`;`) for rules
|
|
299
|
-
|
|
300
|
-
* Semantic change: Start rule of the grammar is now implicitly its first rule.
|
|
301
|
-
|
|
302
|
-
* Implemented semantic predicates.
|
|
303
|
-
|
|
304
|
-
* Implemented initializers.
|
|
305
|
-
|
|
306
|
-
* Removed ability to change the start rule when generating the parser.
|
|
307
|
-
|
|
308
|
-
* Added several compiler optimizations — 0.5 is ~11% faster than 0.4 in the
|
|
309
|
-
benchmark on V8.
|
|
310
|
-
|
|
311
|
-
### Small Changes
|
|
312
|
-
|
|
313
|
-
* `PEG.buildParser` now accepts grammars only in string format.
|
|
314
|
-
|
|
315
|
-
* Added “Generated by ...” message to the generated parsers.
|
|
316
|
-
|
|
317
|
-
* Formatted all grammars more consistently and transparently.
|
|
318
|
-
|
|
319
|
-
* Added notes about ECMA-262, 5th ed. compatibility to the JSON example
|
|
320
|
-
grammar.
|
|
321
|
-
|
|
322
|
-
* Guarded against redefinition of `undefined`.
|
|
323
|
-
|
|
324
|
-
* Made `bin/pegjs` work when called via a symlink
|
|
325
|
-
([issue #1](https://github.com/dmajda/pegjs/issues/1)).
|
|
326
|
-
|
|
327
|
-
* Fixed bug causing incorrect error messages
|
|
328
|
-
([issue #2](https://github.com/dmajda/pegjs/issues/2)).
|
|
329
|
-
|
|
330
|
-
* Fixed error message for invalid character range.
|
|
331
|
-
|
|
332
|
-
* Fixed string literal parsing in the JavaScript grammar.
|
|
333
|
-
|
|
334
|
-
* Generated code improvements and fixes.
|
|
335
|
-
|
|
336
|
-
* Internal code improvements and fixes.
|
|
337
|
-
|
|
338
|
-
* Improved `README.md`.
|
|
339
|
-
|
|
340
|
-
0.4
|
|
341
|
-
---
|
|
342
|
-
|
|
343
|
-
Released: April 17, 2010
|
|
344
|
-
|
|
345
|
-
### Big Changes
|
|
346
|
-
|
|
347
|
-
* Improved IE compatibility — IE6+ is now fully supported.
|
|
348
|
-
|
|
349
|
-
* Generated parsers are now standalone (no runtime is required).
|
|
350
|
-
|
|
351
|
-
* Added example grammars for JavaScript, CSS and JSON.
|
|
352
|
-
|
|
353
|
-
* Added a benchmark suite.
|
|
354
|
-
|
|
355
|
-
* Implemented negative character classes (e.g. `[^a-z]`).
|
|
356
|
-
|
|
357
|
-
* Project moved from BitBucket to GitHub.
|
|
358
|
-
|
|
359
|
-
### Small Changes
|
|
360
|
-
|
|
361
|
-
* Code generated for the character classes is now regexp-based (= simpler and
|
|
362
|
-
more scalable).
|
|
363
|
-
|
|
364
|
-
* Added `\uFEFF` (BOM) to the definition of whitespace in the metagrammar.
|
|
365
|
-
|
|
366
|
-
* When building a parser, left-recursive rules (both direct and indirect) are
|
|
367
|
-
reported as errors.
|
|
368
|
-
|
|
369
|
-
* When building a parser, missing rules are reported as errors.
|
|
370
|
-
|
|
371
|
-
* Expected items in the error messages do not contain duplicates and they are
|
|
372
|
-
sorted.
|
|
373
|
-
|
|
374
|
-
* Fixed several bugs in the example arithmetics grammar.
|
|
375
|
-
|
|
376
|
-
* Converted `README` to GitHub Flavored Markdown and improved it.
|
|
377
|
-
|
|
378
|
-
* Added `CHANGELOG`.
|
|
379
|
-
|
|
380
|
-
* Internal code improvements.
|
|
381
|
-
|
|
382
|
-
0.3
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
Released: March 14, 2010
|
|
386
|
-
|
|
387
|
-
* Wrote `README`.
|
|
388
|
-
|
|
389
|
-
* Bootstrapped the grammar parser.
|
|
390
|
-
|
|
391
|
-
* Metagrammar recognizes JavaScript-like comments.
|
|
392
|
-
|
|
393
|
-
* Changed standard grammar extension from `.peg` to `.pegjs` (it is more
|
|
394
|
-
specific).
|
|
395
|
-
|
|
396
|
-
* Simplified the example arithmetics grammar + added comment.
|
|
397
|
-
|
|
398
|
-
* Fixed a bug with reporting of invalid ranges such as `[b-a]` in the
|
|
399
|
-
metagrammar.
|
|
400
|
-
|
|
401
|
-
* Fixed `--start` vs. `--start-rule` inconsistency between help and actual
|
|
402
|
-
option processing code.
|
|
403
|
-
|
|
404
|
-
* Avoided ugliness in QUnit output.
|
|
405
|
-
|
|
406
|
-
* Fixed typo in help: `parserVar` → `parser_var`.
|
|
407
|
-
|
|
408
|
-
* Internal code improvements.
|
|
409
|
-
|
|
410
|
-
0.2.1
|
|
411
|
-
-----
|
|
412
|
-
|
|
413
|
-
Released: March 8, 2010
|
|
414
|
-
|
|
415
|
-
* Added `pegjs-` prefix to the name of the minified runtime file.
|
|
416
|
-
|
|
417
|
-
0.2
|
|
418
|
-
---
|
|
419
|
-
|
|
420
|
-
Released: March 8, 2010
|
|
421
|
-
|
|
422
|
-
* Added `Rakefile` that builds minified runtime using Google Closure Compiler
|
|
423
|
-
API.
|
|
424
|
-
|
|
425
|
-
* Removed trailing commas in object initializers (Google Closure does not like
|
|
426
|
-
them).
|
|
427
|
-
|
|
428
|
-
0.1
|
|
429
|
-
---
|
|
430
|
-
|
|
431
|
-
Released: March 8, 2010
|
|
432
|
-
|
|
433
|
-
* Initial release.
|