Debian Codegraph @

CHANGELOG.md

raw symbols SCIP
1 Change Log
2 ==========
3
4 This file documents all notable changes to PEG.js. The releases follow [semantic
5 versioning](http://semver.org/).
6
7 0.10.0
8 ------
9
10 Released: August 19, 2016
11
12 ### Major Changes
13
14 * **Parsers can be generated in multiple module formats.** The available
15 formats are: CommonJS (the default), AMD, UMD, globals, and bare (not
16 available from the command-line).
17
18 The format can be specified using the `format` option of the `peg.generate`
19 function or the `--format` option on the command-line.
20
21 It is also possible to specify parser dependencies using the `dependencies`
22 option of the `peg.generate` function or the `--dependency`/`-d` option on
23 the command-line. This is mainly useful for the UMD format, where the
24 dependencies are translated into both AMD dependencies and CommonJS
25 `require` calls.
26
27 * **Browser version of PEG.js is now in the UMD format.** This means it will try
28 to detect AMD or Node.js/CommonJS module loader and define itself as a
29 module. If no loader is found, it will export itself using a global
30 variable.
31
32 * **API polishing.** The `peg.buildParser` function was renamed to
33 `peg.generate`. The global variable the browser version of PEG.js is
34 available in when no loader is detected was renamed from `PEG` to `peg`.
35
36 * **CLI improvements.** There is new `--output`/`-o` command-line option which
37 allows to specify the output file. The old way of specifying the output file
38 using a second argument was removed. To make room for the new `-o` option
39 the old one (a shortcut for `--optimize`) was renamed to `-O`. All these
40 changes make PEG.js conform to traditional compiler command-line interface.
41
42 It is now also possible to use `-` as a file name on the command-line (with
43 the usual meaning of standard input/output).
44
45 * **Improved error messages.** Both messages produced by PEG.js and generated
46 parsers were improved.
47
48 * **Duplicate rule definitions are reported as errors.**
49
50 * **Duplicate labels are reported as errors.**
51
52 ### Minor Changes
53
54 * Exposed the AST node visitor builder as `peg.compiler.visitor`. This is
55 useful mainly for plugins which manipulate the AST.
56
57 * Exposed the function which builds messages of exceptions produced by
58 generated parsers as `SyntaxError.buildMessage`. This is useful mainly for
59 customizing these error messages.
60
61 * The `error` and `expected` functions now accept an optional `location`
62 parameter. This allows to customize the location in which the resulting
63 syntax error is reported.
64
65 * Refactored expectations reported in the `expected` property of exceptions
66 produced by generated parsers. They are no longer de-duplicated and sorted,
67 their format changed to be more machine-readable, and they no longer contain
68 human-readable descriptions.
69
70 * The `found` property of exceptions produced by the `error` function is now
71 set to `null`.
72
73 * Removed access to the parser object in parser code via the `parser`
74 variable.
75
76 * Made handling of optional parameters consistent with ES 2015. Specifically,
77 passing `undefined` as a parameter value is now equivalent to not passing
78 the parameter at all.
79
80 * Renamed several compiler passes.
81
82 * Generated parsers no longer consider `\r`, `\u2028`, and `\u2029` as
83 newlines (only `\n` and `\r\n`).
84
85 * Simplified the arithmetics example grammar.
86
87 * Switched from `first`/`rest` to `head`/`tail` in PEG.js grammar and example
88 grammars.
89
90 * Started using ESLint instead of JSHint and fixed various problems it found.
91
92 * Added [contribution
93 guidelines](https://github.com/pegjs/pegjs/blob/master/CONTRIBUTING.md).
94
95 * Removed support for io.js.
96
97 ### Bug Fixes
98
99 * Fixed `bin/pegjs` so that invoking it with one non-option argument which is
100 an extension-less file doesn’t cause that file to be overwritten.
101
102 * Fixed label scoping so that labels in expressions like `(a:"a")` or `(a:"a"
103 b:"b" c:"c")` aren’t visible from the outside.
104
105 * Fixed escaping of generated JavaScript strings & regexps to also escape DEL
106 (U+007F).
107
108 * Fixed the JSON example grammar to correctly handle characters with code
109 points above U+10FF in strings.
110
111 * Fixed multiple compatibility issues of `tools/impact` on OS X.
112
113 * Fixed slow deduplication of expectation descriptions.
114
115 [Complete set of changes](https://github.com/pegjs/pegjs/compare/v0.9.0...v0.10.0)
116
117 0.9.0
118 -----
119
120 Released: August 30, 2015
121
122 ### Major Changes
123
124 * **Tracing support.** Parsers can be compiled with support for tracing their
125 progress, which can help debugging complex grammars. This feature is
126 experimental and is expected to evolve over time as experience is gained.
127 [More details](https://github.com/pegjs/pegjs/commit/da57118a43a904f753d44d407994cf0b36358adc)
128
129 * **Infinite loop detection.** Grammar constructs that could cause infinite
130 loops in generated parsers are detected during compilation and cause errors.
131
132 * **Improved location information API.** The `line`, `column`, and `offset`
133 functions available in parser code were replaced by a single `location`
134 function which returns an object describing the current location. Similarly,
135 the `line`, `column`, and `offset` properties of exceptions were replaced by
136 a single `location` property. The location is no longer a single point but a
137 character range, which is meaningful mainly in actions where the range
138 covers action’s expression.
139 [More details](https://github.com/pegjs/pegjs/compare/e75f21dc8f0e66b3d87c4c19b3fcb8f89d9c3acd...eaca5f0acf97b66ef141fed84aa95d4e72e33757)
140
141 * **Improved error reporting.** All exceptions thrown when generating a parser
142 have associated location information. And all exceptions thrown by generated
143 parser and PEG.js itself have a stack trace (the `stack` property) in
144 environments that support `Error.captureStackTrace`.
145
146 * **Strict mode code**. All PEG.js and generated parser code is written using
147 [JavaScript strict mode](https://developer.mozilla.org/cs/docs/Web/JavaScript/Reference/Strict_mode).
148
149 ### Minor Changes
150
151 * Labels behave like block-scoped variables. This means parser code can see
152 labels defined outside expressions containing code.
153
154 * Empty sequences are no longer allowed.
155
156 * Label names can’t be JavaScript reserved words.
157
158 * Rule and label names can contain Unicode characters like in JavaScript.
159
160 * Rules have to be separated either by `;` or a newline (until now, any
161 whitespace was enough).
162
163 * The PEG.js grammar and all the example grammars were completely rewritten.
164 This rewrite included a number of cleanups, formatting changes, naming
165 changes, and bug fixes.
166
167 * The parser object can now be accessed as `parser` in parser code.
168
169 * Location information computation is faster.
170
171 * Added support for Node.js >= 0.10.x, io.js, and Edge. Removed support for
172 Node.js < 0.10.x.
173
174 ### Bug Fixes
175
176 * Fixed left recursion detector which missed many cases.
177
178 * Fixed escaping of U+0100—U+107F and U+1000—U+107F in generated code and
179 error messages.
180
181 * Renamed `parse` and `SyntaxError` to `peg$parse` and `peg$SyntaxError` to
182 mark them as internal identifiers.
183
184 [Complete set of changes](https://github.com/pegjs/pegjs/compare/v0.8.0...v0.9.0)
185
186 0.8.0
187 -----
188
189 Released: December 24, 2013
190
191 ### Big Changes
192
193 * Completely rewrote the code generator. Among other things, it allows
194 optimizing generated parsers for parsing speed or code size using the
195 `optimize` option of the `PEG.buildParser` method or the `--optimize`/`-o`
196 option on the command-line. All internal identifiers in generated code now
197 also have a `peg$` prefix to discourage their use and avoid conflicts.
198 [[#35](https://github.com/dmajda/pegjs/issues/35),
199 [#92](https://github.com/dmajda/pegjs/issues/92)]
200
201 * Completely redesigned error handling. Instead of returning `null` inside
202 actions to indicate match failure, new `expected` and `error` functions can
203 be called to trigger an error. Also, expectation inside the `SyntaxError`
204 exceptions are now structured to allow easier machine processing.
205 [[#198](https://github.com/dmajda/pegjs/issues/198)]
206
207 * Implemented a plugin API. The list of plugins to use can be specified using
208 the `plugins` option of the `PEG.buildParser` method or the `--plugin`
209 option on the command-line. Also implemented the `--extra-options` and
210 `--extra-options-file` command-line options, which are mainly useful to pass
211 additional options to plugins.
212 [[#106](https://github.com/dmajda/pegjs/issues/106)]
213
214 * Made `offset`, `line` and `column` functions, not variables. They are now
215 available in all parsers and return lazily-computed position data. Removed
216 now useless `trackLineAndColumn` option of the `PEG.buildParser` method and
217 the `--track-line-and-column` option on the command-line.
218
219 * Added a new `text` function. When called inside an action, it returns the
220 text matched by action's expression.
221 [[#131](https://github.com/dmajda/pegjs/issues/131)]
222
223 * Added a new `$` operator. It extracts matched strings from expressions.
224
225 * The `?` operator now returns `null` on unsuccessful match.
226
227 * Predicates now always return `undefined`.
228
229 * Replaced the `startRule` parameter of the `parse` method in generated
230 parsers with more generic `options` parameter. The start rule can now be
231 specified as the `startRule` option. The `options` parameter can be also
232 used to pass custom options to the parser because it is visible as the
233 `options` variable inside parser code.
234 [[#37](https://github.com/dmajda/pegjs/issues/37)]
235
236 * The list of allowed start rules of a generated parser now has to be
237 specified explicitly using the `allowedStartRules` option of the
238 `PEG.buildParser` method or the `--allowed-start-rule` option on the
239 command-line. This will make certain optimizations like rule inlining easier
240 in the future.
241
242 * Removed the `toSource` method of generated parsers and introduced a new
243 `output` option of the `PEG.buildParser` method. It allows callers to
244 specify whether they want to get back the parser object or its source code.
245
246 * The source code is now a valid npm package. This makes using development
247 versions easier.
248 [[#32](https://github.com/dmajda/pegjs/issues/32)]
249
250 * Generated parsers are now ~25% faster and ~62%/~3% smaller (when optimized
251 for size/speed) than those generated by 0.7.0.
252
253 * Requires Node.js 0.8.0+.
254
255 ### Small Changes
256
257 * `bin/pegjs` now outputs just the parser source if the value of the
258 `--export-var` option is empty. This makes embedding generated parsers into
259 other files easier.
260 [[#143](https://github.com/dmajda/pegjs/issues/143)]
261
262 * Changed the value of the `name` property of `PEG.GrammarError` instances
263 from “PEG.GrammarError” to just “GrammarError”. This better reflects the
264 fact that PEG.js can get required with different variable name than `PEG`.
265
266 * Setup prototype chain for `PEG.GrammarError` correctly.
267
268 * Setup prototype chain for `SyntaxError` in generated parsers correctly.
269
270 * Fixed error messages in certain cases with trailing input
271 [[#119](https://github.com/dmajda/pegjs/issues/119)]
272
273 * Fixed code generated for classes starting with `\^`.
274 [[#125](https://github.com/dmajda/pegjs/issues/125)]
275
276 * Fixed too eager proxy rules removal.
277 [[#137](https://github.com/dmajda/pegjs/issues/137)]
278
279 * Added a license to all vendored libraries.
280 [[#207](https://github.com/dmajda/pegjs/issues/207)]
281
282 * Converted the test suite from QUnit to Jasmine, cleaning it up on the way.
283
284 * Travis CI integration.
285
286 * Various internal code improvements and fixes.
287
288 * Various generated code improvements and fixes.
289
290 * Various example grammar improvements and fixes.
291
292 * Improved `README.md`.
293
294 * Converted `CHANGELOG` to Markdown.
295
296 0.7.0
297 -----
298
299 Released: April 18, 2012
300
301 ### Big Changes
302
303 * Added ability to pass options to `PEG.buildParser`.
304
305 * Implemented the `trackLineAndColumn` option for `PEG.buildParser` (together
306 with the `--track-line-and-column` command-line option). It makes the
307 generated parser track line and column during parsing. These are made
308 available inside actions and predicates as `line` and `column` variables.
309
310 * Implemented the `cache` option for `PEG.buildParser` (together with the
311 `--cache` command-line option). This option enables/disables the results
312 cache in generated parsers, resulting in dramatic speedup when the cache is
313 disabled (the default now). The cost is breaking the linear parsing time
314 guarantee.
315
316 * The current parse position is visible inside actions and predicates as the
317 `offset` variable.
318
319 * Exceptions thrown by the parser have `offset`, `expected` and `found`
320 properties containing machine-readable information about the parse failure
321 (based on a patch by Marcin Stefaniuk).
322
323 * Semantic predicates have access to preceding labels.
324 [[GH-69](https://github.com/dmajda/pegjs/issues/69)]
325
326 * Implemented case-insensitive literal and class matching.
327 [[GH-34](https://github.com/dmajda/pegjs/issues/34)]
328
329 * Rewrote the code generator — split some computations into separate passes
330 and based it on a proper templating system (Codie).
331
332 * Rewrote variable handling in generated parsers in a stack-like fashion,
333 simplifying the code and making the parsers smaller and faster.
334
335 * Adapted to Node.js 0.6.6+ (no longer supported in older versions).
336
337 * Dropped support for IE < 8.
338
339 * As a result of several optimizations, parsers generated by 0.7.0 are ~6.4
340 times faster and ~19% smaller than those generated by 0.6.2 (as reported by
341 `/tools/impact`).
342
343 ### Small Changes
344
345 * Fixed reported error position when part of the input is not consumed.
346 [[GH-48](https://github.com/dmajda/pegjs/issues/48)]
347
348 * Fixed incorrect disjunction operator in `computeErrorPosition` (original
349 patch by Wolfgang Kluge).
350
351 * Fixed regexp for detecting command-line options in `/bin/pegjs`.
352 [[GH-51](https://github.com/dmajda/pegjs/issues/51)]
353
354 * Generate more efficient code for empty literals (original patch by Wolfgang
355 Kluge).
356
357 * Fixed comment typos (patches by Wolfgang Kluge and Jason Davies).
358 [[GH-59](https://github.com/dmajda/pegjs/issues/59)]
359
360 * Fixed a typo in JavaScript example grammar.
361 [[GH-62](https://github.com/dmajda/pegjs/issues/62)]
362
363 * Made copy & paste inclusion of the PEG.js library into another code easier
364 by changing how the library is exported.
365
366 * Improved the copyright comment and the “Generated by...” header.
367
368 * Replaced `Jakefile` with `Makefile`.
369
370 * Added `make hint` task that checks all JavaScript files using JSHint and
371 resolved all issues it reported. All JavaScript files and also generated
372 parsers are JSHint-clean now.
373
374 * Fixed output printed during test failures (expected value was being printed
375 instead of the actual one). Original patch by Wolfgang Kluge.
376
377 * Added a `/tools/impact` script to measure speed and size impact of commits.
378
379 * Various generated code improvements and fixes.
380
381 * Various internal code improvements and fixes.
382
383 * Improved `README.md`.
384
385 0.6.2
386 -----
387
388 Released: August 20, 2011
389
390 ### Small Changes
391
392 * Reset parser position when action returns `null`.
393
394 * Fixed typo in JavaScript example grammar.
395
396 0.6.1
397 -----
398
399 Released: April 14, 2011
400
401 ### Small Changes
402
403 * Use `--ascii` option when generating a minified version.
404
405 0.6.0
406 -----
407
408 Released: April 14, 2011
409
410 ### Big Changes
411
412 * Rewrote the command-line mode to be based on Node.js instead of Rhino — no
413 more Java dependency. This also means that PEG.js is available as a Node.js
414 package and can be required as a module.
415
416 * Version for the browser is built separately from the command-line one in two
417 flavors (normal and minified).
418
419 * Parser variable name is no longer required argument of `bin/pegjs` — it is
420 `module.exports` by default and can be set using the `-e`/`--export-var`
421 option. This makes parsers generated by `/bin/pegjs` Node.js modules by
422 default.
423
424 * Added ability to start parsing from any grammar rule.
425
426 * Added several compiler optimizations — 0.6 is ~12% faster than 0.5.1 in the
427 benchmark on V8.
428
429 ### Small Changes
430
431 * Split the source code into multiple files combined together using a build
432 system.
433
434 * Jake is now used instead of Rake for build scripts — no more Ruby
435 dependency.
436
437 * Test suite can be run from the command-line.
438
439 * Benchmark suite can be run from the command-line.
440
441 * Benchmark browser runner improvements (users can specify number of runs,
442 benchmarks are run using `setTimeout`, table is centered and fixed-width).
443
444 * Added PEG.js version to “Generated by...” line in generated parsers.
445
446 * Added PEG.js version information and homepage header to `peg.js`.
447
448 * Generated code improvements and fixes.
449
450 * Internal code improvements and fixes.
451
452 * Rewrote `README.md`.
453
454 0.5.1
455 -----
456
457 Released: November 28, 2010
458
459 ### Small Changes
460
461 * Fixed a problem where “SyntaxError: Invalid range in character class.” error
462 appeared when using command-line version on Widnows
463 ([GH-13](https://github.com/dmajda/pegjs/issues/13)).
464
465 * Fixed wrong version reported by `bin/pegjs --version`.
466
467 * Removed two unused variables in the code.
468
469 * Fixed incorrect variable name on two places.
470
471 0.5
472 ---
473
474 Released: June 10, 2010
475
476 ### Big Changes
477
478 * Syntax change: Use labeled expressions and variables instead of `$1`, `$2`,
479 etc.
480
481 * Syntax change: Replaced `:` after a rule name with `=`.
482
483 * Syntax change: Allow trailing semicolon (`;`) for rules
484
485 * Semantic change: Start rule of the grammar is now implicitly its first rule.
486
487 * Implemented semantic predicates.
488
489 * Implemented initializers.
490
491 * Removed ability to change the start rule when generating the parser.
492
493 * Added several compiler optimizations — 0.5 is ~11% faster than 0.4 in the
494 benchmark on V8.
495
496 ### Small Changes
497
498 * `PEG.buildParser` now accepts grammars only in string format.
499
500 * Added “Generated by ...” message to the generated parsers.
501
502 * Formatted all grammars more consistently and transparently.
503
504 * Added notes about ECMA-262, 5th ed. compatibility to the JSON example
505 grammar.
506
507 * Guarded against redefinition of `undefined`.
508
509 * Made `bin/pegjs` work when called via a symlink
510 ([issue #1](https://github.com/dmajda/pegjs/issues/1)).
511
512 * Fixed bug causing incorrect error messages
513 ([issue #2](https://github.com/dmajda/pegjs/issues/2)).
514
515 * Fixed error message for invalid character range.
516
517 * Fixed string literal parsing in the JavaScript grammar.
518
519 * Generated code improvements and fixes.
520
521 * Internal code improvements and fixes.
522
523 * Improved `README.md`.
524
525 0.4
526 ---
527
528 Released: April 17, 2010
529
530 ### Big Changes
531
532 * Improved IE compatibility — IE6+ is now fully supported.
533
534 * Generated parsers are now standalone (no runtime is required).
535
536 * Added example grammars for JavaScript, CSS and JSON.
537
538 * Added a benchmark suite.
539
540 * Implemented negative character classes (e.g. `[^a-z]`).
541
542 * Project moved from BitBucket to GitHub.
543
544 ### Small Changes
545
546 * Code generated for the character classes is now regexp-based (= simpler and
547 more scalable).
548
549 * Added `\uFEFF` (BOM) to the definition of whitespace in the metagrammar.
550
551 * When building a parser, left-recursive rules (both direct and indirect) are
552 reported as errors.
553
554 * When building a parser, missing rules are reported as errors.
555
556 * Expected items in the error messages do not contain duplicates and they are
557 sorted.
558
559 * Fixed several bugs in the example arithmetics grammar.
560
561 * Converted `README` to GitHub Flavored Markdown and improved it.
562
563 * Added `CHANGELOG`.
564
565 * Internal code improvements.
566
567 0.3
568 ---
569
570 Released: March 14, 2010
571
572 * Wrote `README`.
573
574 * Bootstrapped the grammar parser.
575
576 * Metagrammar recognizes JavaScript-like comments.
577
578 * Changed standard grammar extension from `.peg` to `.pegjs` (it is more
579 specific).
580
581 * Simplified the example arithmetics grammar + added comment.
582
583 * Fixed a bug with reporting of invalid ranges such as `[b-a]` in the
584 metagrammar.
585
586 * Fixed `--start` vs. `--start-rule` inconsistency between help and actual
587 option processing code.
588
589 * Avoided ugliness in QUnit output.
590
591 * Fixed typo in help: `parserVar` → `parser_var`.
592
593 * Internal code improvements.
594
595 0.2.1
596 -----
597
598 Released: March 8, 2010
599
600 * Added `pegjs-` prefix to the name of the minified runtime file.
601
602 0.2
603 ---
604
605 Released: March 8, 2010
606
607 * Added `Rakefile` that builds minified runtime using Google Closure Compiler
608 API.
609
610 * Removed trailing commas in object initializers (Google Closure does not like
611 them).
612
613 0.1
614 ---
615
616 Released: March 8, 2010
617
618 * Initial release.