Skip to content

Commit

Permalink
v6.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bd82 committed Sep 20, 2019
1 parent fb59924 commit d8593c7
Show file tree
Hide file tree
Showing 31 changed files with 103 additions and 103 deletions.
4 changes: 2 additions & 2 deletions examples/custom_apis/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "chevrotain_examples_custom_apis",
"version": "6.4.0",
"version": "6.5.0",
"scripts": {
"test": "mocha \"!(node_modules)/**/*_spec.js\""
},
"dependencies": {
"chevrotain": "^6.4.0"
"chevrotain": "^6.5.0"
},
"private": true
}
4 changes: 2 additions & 2 deletions examples/grammars/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "chevrotain_examples_grammars",
"version": "6.4.0",
"version": "6.5.0",
"scripts": {
"test": "mocha \"!(node_modules)/**/*spec.js\""
},
"dependencies": {
"chevrotain": "^6.4.0"
"chevrotain": "^6.5.0"
},
"devDependencies": {
"acorn": "^7.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/implementation_languages/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "chevrotain_examples_implementation_languages",
"version": "6.4.0",
"version": "6.5.0",
"scripts": {
"build": "npm-run-all build:ts build:coffee",
"build:ts": "tsc ./typescript/typescript_json.ts --types \" \"",
"build:coffee": "coffee -c ./coffeescript/coffeescript_json.coffee",
"test": "mocha \"*spec.js\""
},
"dependencies": {
"chevrotain": "^6.4.0"
"chevrotain": "^6.5.0"
},
"devDependencies": {
"coffee-script": "^1.11.1",
Expand Down
4 changes: 2 additions & 2 deletions examples/lexer/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "chevrotain_examples_lexer",
"version": "6.4.0",
"version": "6.5.0",
"scripts": {
"test": "mocha \"!(node_modules)/**/*spec.js\""
},
"dependencies": {
"chevrotain": "^6.4.0",
"chevrotain": "^6.5.0",
"lodash": "~4.17.10"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/parser/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "chevrotain_examples_parser",
"version": "6.4.0",
"version": "6.5.0",
"scripts": {
"test": "mocha \"!(node_modules)/**/*spec.js\""
},
"dependencies": {
"chevrotain": "^6.4.0",
"chevrotain": "^6.5.0",
"lodash": "~4.17.10"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples/tutorial/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "chevrotain_examples_tutorial",
"version": "6.4.0",
"version": "6.5.0",
"scripts": {
"test": "mocha \"step*/*spec.js\""
},
"dependencies": {
"chevrotain": "^6.4.0"
"chevrotain": "^6.5.0"
},
"devDependencies": {
"chai": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": ["packages/*", "examples/*"],
"useWorkspaces": true,
"npmClient": "yarn",
"version": "6.4.0"
"version": "6.5.0"
}
2 changes: 1 addition & 1 deletion packages/chevrotain/docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Special handling is no longer needed during WebPacking scenarios.

The first time a Chevrotain parser is initialized additional validations and computations are performed.
Some of these can take a very long time under certain edge cases. Specifically the detection of ambiguous alternatives
when the parser uses a larger than the default [maxLookahead](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/iparserconfig.html#maxlookahead)
when the parser uses a larger than the default [maxLookahead](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/iparserconfig.html#maxlookahead)
and there are many (thousands) of ambiguous paths.

To resolve this try reducing the maxLookahead and inspect the ambiguity errors to fix
Expand Down
2 changes: 1 addition & 1 deletion packages/chevrotain/docs/changes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## X.Y.Z (INSERT_DATE_HERE)
## 6.5.0 (9-20-2019)

- [Optimize Certain Complex Lexers Initialization Performance](https://github.com/SAP/chevrotain/commit/e25222dcd2ce29f2c5352599dd55f3432a145316)
- [Lexer Initialization Performance Tracing](https://github.com/SAP/chevrotain/issues/1045)
Expand Down
12 changes: 6 additions & 6 deletions packages/chevrotain/docs/features/custom_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Chevrotain allows users to customize both the parser and lexer error messages.
This can be accomplished by implementing the following interfaces:

- [IParserErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/iparsererrormessageprovider.html)
- [ILexerErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/ilexererrormessageprovider.html)
- [IParserErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/iparsererrormessageprovider.html)
- [ILexerErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/ilexererrormessageprovider.html)

See executable examples:

Expand All @@ -25,7 +25,7 @@ $.RULE("myStatement", () => {

The **ERR_MSG** config property is available for the following DSL methods:

- [CONSUME](https://sap.github.io/chevrotain/documentation/6_4_0/classes/cstparser.html#consume)
- [OR](https://sap.github.io/chevrotain/documentation/6_4_0/classes/cstparser.html#or)
- [AT_LEAST_ONE](https://sap.github.io/chevrotain/documentation/6_4_0/classes/cstparser.html#at_least_one)
- [AT_LEAST_ONE_SEP](https://sap.github.io/chevrotain/documentation/6_4_0/classes/cstparser.html#at_least_one_sep)
- [CONSUME](https://sap.github.io/chevrotain/documentation/6_5_0/classes/cstparser.html#consume)
- [OR](https://sap.github.io/chevrotain/documentation/6_5_0/classes/cstparser.html#or)
- [AT_LEAST_ONE](https://sap.github.io/chevrotain/documentation/6_5_0/classes/cstparser.html#at_least_one)
- [AT_LEAST_ONE_SEP](https://sap.github.io/chevrotain/documentation/6_5_0/classes/cstparser.html#at_least_one_sep)
4 changes: 2 additions & 2 deletions packages/chevrotain/docs/features/grammar_inheritance.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Chevrotain supports Grammar Inheritance, This is useful to represent multiple va
for example a grammar for ECMAScript 6 **extends** an ECMAScript 5.1 grammar.

Chevrotain Grammars are JavaScript classes, so Grammar inheritance is simpliy JavaScript inheritance
with the replacement of the [**RULE**](https://sap.github.io/chevrotain/documentation/6_4_0/classes/cstparser.html#rule)
DSL method with [**OVERRIDE_RULE**](https://sap.github.io/chevrotain/documentation/6_4_0/classes/cstparser.html#override_rule) method when needed.
with the replacement of the [**RULE**](https://sap.github.io/chevrotain/documentation/6_5_0/classes/cstparser.html#rule)
DSL method with [**OVERRIDE_RULE**](https://sap.github.io/chevrotain/documentation/6_5_0/classes/cstparser.html#override_rule) method when needed.

See [executable example](https://github.com/SAP/chevrotain/tree/master/examples/parser/inheritance)
for further details.
2 changes: 1 addition & 1 deletion packages/chevrotain/docs/features/position_tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ token_skipping
- start and end lines.
- start and end columns.

The level of position information tracking can be reduced by using the [**positionTracking**](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/ilexerconfig.html#positiontracking) lexer config option.
The level of position information tracking can be reduced by using the [**positionTracking**](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/ilexerconfig.html#positiontracking) lexer config option.
For example:

```javascript
Expand Down
2 changes: 1 addition & 1 deletion packages/chevrotain/docs/features/token_grouping.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Chevrotain lexers support grouping Tokens Types **separately** from the main token vector in the lexing result.
This is often useful to **collect** a specific set of Token Types for later processing, for example to collect comments tokens.

To group a Token Type simply specify the [**group**](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/itokenconfig.html#group) property in its configuration.
To group a Token Type simply specify the [**group**](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/itokenconfig.html#group) property in its configuration.
For example:

```javascript
Expand Down
10 changes: 5 additions & 5 deletions packages/chevrotain/docs/guide/concrete_syntax_tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ There are two major differences.

How to enable CST output?

This feature is enabled when a parser extends the [CstParser class](https://sap.github.io/chevrotain/documentation/6_4_0/classes/cstparser.html).
This feature is enabled when a parser extends the [CstParser class](https://sap.github.io/chevrotain/documentation/6_5_0/classes/cstparser.html).

```typescript
import { CstParser } from "chevrotain"
Expand All @@ -43,7 +43,7 @@ class SelectParser extends CstParser {

The structure of the CST is very simple.

- See the full [CstNode type signature](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/cstnode.html)
- See the full [CstNode type signature](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/cstnode.html)

- Explore it by running the CST creation example in the [**online playground**](https://sap.github.io/chevrotain/playground/?example=JSON%20grammar%20and%20automatic%20CST%20output).

Expand Down Expand Up @@ -312,7 +312,7 @@ as we would have to fully traverse a CstNode to understands its full location ra
The feature for providing CstNode location directly on the CstNodes objects is available since version 4.7.0.
Tracking the CstNodes location is **disabled by default** and can be enabled
by setting the IParserConfig [nodeLocationTracking](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/iparserconfig.html#nodelocationtracking)
by setting the IParserConfig [nodeLocationTracking](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/iparserconfig.html#nodelocationtracking)
to:
- "full" (start/end for **all** offset/line/column)
Expand All @@ -332,14 +332,14 @@ class SelectParser extends CstParser {
}
```
Once this feature is enabled the optional [location property](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/cstnode.html#location)
Once this feature is enabled the optional [location property](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/cstnode.html#location)
on each CstNode would be populated with the relevant information.
Caveats
- In order to track the CstNodes location **every** Token in the input Token vector must include its own location information.
- This is enabled by default in the Chevrotain Lexer, See [ILexerConfig.positionTracking](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/ilexerconfig.html#positiontracking).
- This is enabled by default in the Chevrotain Lexer, See [ILexerConfig.positionTracking](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/ilexerconfig.html#positiontracking).
However, if a third party Lexer is used in conjunction with a Chevrotain Parser, the Tokens produced by such a lexer
must include the relevant location properties to allow the chevrotain parser to compute the CstNode locations.
Expand Down
40 changes: 20 additions & 20 deletions packages/chevrotain/docs/guide/custom_apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Skip to [runnable examples](https://github.com/SAP/chevrotain/tree/master/exampl

The structure of the GAST is made up of the following classes:

- [Rule](https://sap.github.io/chevrotain/documentation/6_4_0/classes/rule.html)
- [Terminal](https://sap.github.io/chevrotain/documentation/6_4_0/classes/terminal.html)
- [NonTerminal](https://sap.github.io/chevrotain/documentation/6_4_0/classes/nonterminal.html)
- [Alternation](https://sap.github.io/chevrotain/documentation/6_4_0/classes/alternation.html)
- [Option](https://sap.github.io/chevrotain/documentation/6_4_0/classes/option.html)
- [Repetition](https://sap.github.io/chevrotain/documentation/6_4_0/classes/repetition.html)
- [RepetitionWithSeparator](https://sap.github.io/chevrotain/documentation/6_4_0/classes/repetitionwithseparator.html)
- [RepetitionMandatory](https://sap.github.io/chevrotain/documentation/6_4_0/classes/repetitionmandatory.html)
- [RepetitionMandatoryWithSeparator](https://sap.github.io/chevrotain/documentation/6_4_0/classes/repetitionmandatorywithseparator.html)
- [Flat](https://sap.github.io/chevrotain/documentation/6_4_0/classes/flat.html) (sequence)
- [Rule](https://sap.github.io/chevrotain/documentation/6_5_0/classes/rule.html)
- [Terminal](https://sap.github.io/chevrotain/documentation/6_5_0/classes/terminal.html)
- [NonTerminal](https://sap.github.io/chevrotain/documentation/6_5_0/classes/nonterminal.html)
- [Alternation](https://sap.github.io/chevrotain/documentation/6_5_0/classes/alternation.html)
- [Option](https://sap.github.io/chevrotain/documentation/6_5_0/classes/option.html)
- [Repetition](https://sap.github.io/chevrotain/documentation/6_5_0/classes/repetition.html)
- [RepetitionWithSeparator](https://sap.github.io/chevrotain/documentation/6_5_0/classes/repetitionwithseparator.html)
- [RepetitionMandatory](https://sap.github.io/chevrotain/documentation/6_5_0/classes/repetitionmandatory.html)
- [RepetitionMandatoryWithSeparator](https://sap.github.io/chevrotain/documentation/6_5_0/classes/repetitionmandatorywithseparator.html)
- [Flat](https://sap.github.io/chevrotain/documentation/6_5_0/classes/flat.html) (sequence)

For example to define a grammar rule for a fully qualified name:

Expand Down Expand Up @@ -94,7 +94,7 @@ Important to note that:

Chevrotain exposes three functions for Grammar(GAST) Validation purposes:

1. [**resolveGrammar**](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#resolvegrammar)
1. [**resolveGrammar**](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#resolvegrammar)
NonTerminals are often referenced by their name as cyclic references will make
a direct object reference impossible, for example with right recursion:

Expand All @@ -107,25 +107,25 @@ Chevrotain exposes three functions for Grammar(GAST) Validation purposes:

For any reference that cannot be resolved an error object will be outputted,
this object will contain an error message which can be customized by providing
a custom implementation of [IGrammarResolverErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/igrammarresolvererrormessageprovider.html).
The [default implementation](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#defaultgrammarresolvererrorprovider) also exported as part of the public API.
a custom implementation of [IGrammarResolverErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/igrammarresolvererrormessageprovider.html).
The [default implementation](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#defaultgrammarresolvererrorprovider) also exported as part of the public API.

1) [**validateGrammar**](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#validategrammar)
1) [**validateGrammar**](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#validategrammar)
Chevrotain expose a set of checks on the grammar structure that it is **highly recommended** to execute.
These checks will detect ambiguous alternatives, left recursion, conflicting Terminals & NonTerminal names and more...

validateGrammar is side effect free and like resolveGrammar will return an array of error objects.
The error messages in these objects can once again be customized by providing a [IGrammarResolverErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/igrammarvalidatorerrormessageprovider.html)
optionally based on the [default implementation](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#defaultgrammarvalidatorerrorprovider)
The error messages in these objects can once again be customized by providing a [IGrammarResolverErrorMessageProvider](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/igrammarvalidatorerrormessageprovider.html)
optionally based on the [default implementation](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#defaultgrammarvalidatorerrorprovider)

1) [**assignOccurrenceIndices**](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#assignoccurrenceindices)
1) [**assignOccurrenceIndices**](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#assignoccurrenceindices)
Chevrotain has certain constraint on the "shape" of the generated code. The relevant one in this case is the [unique numerical suffixes](https://sap.github.io/chevrotain/docs/FAQ.html#NUMERICAL_SUFFIXES) for the DSL methods.
The assignOccurrenceIndices function will take care of this requirement by mutating the idx property on the GAST classes accordingly.

### A Note on Custom Error Messages

As mentioned earlier **validateGrammar** **assignOccurrenceIndices** optionally accept
a [errMsgProvider](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#validategrammar) option.
a [errMsgProvider](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#validategrammar) option.
Note that all custom error message builders receive a GAST instance as input. What this means is that
the GAST classes created by the implementor of the custom API can be augmented with additional information to enable
producing better error messages. e.g:
Expand All @@ -140,14 +140,14 @@ producing better error messages. e.g:

There are two APIs for code generation and execution.

- [**generateParserModule**](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#generateparsermodule)
- [**generateParserModule**](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#generateparsermodule)
This will generate the string literal of a [UMD](https://github.com/umdjs/umd) module.
This UMD pattern is consumable in all standard JS runtimes & module implementations.
The approach is to generate the string literal and write it to a file for later consumption.
However for development purposes or under certain runtimes it is possible to skip the file creation
For example see the [require-from-string](https://github.com/floatdrop/require-from-string)

- [**generateParserFactory**](https://sap.github.io/chevrotain/documentation/6_4_0/globals.html#generateparserfactory)
- [**generateParserFactory**](https://sap.github.io/chevrotain/documentation/6_5_0/globals.html#generateparserfactory)
This API skips string literal and directly evals (new Function(...)) the code and returns
a factory that can be used to create Parser instances.

Expand Down
6 changes: 3 additions & 3 deletions packages/chevrotain/docs/guide/custom_token_patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function. But with a small constraint.
- A custom pattern should behave as though the RegExp [sticky flag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky) has been set.
This means that attempted matches must begin at the offset argument, **not** at the start of the input.

The basic syntax for supplying a custom pattern is defined by the [ICustomPattern](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/icustompattern.html) interface.
The basic syntax for supplying a custom pattern is defined by the [ICustomPattern](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/icustompattern.html) interface.
Example:

```javascript
Expand Down Expand Up @@ -63,7 +63,7 @@ createToken({
pattern: { exec: matchInteger },

// Optional property that will enable optimizations in the lexer
// See: https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/itokenconfig.html#start_chars_hint
// See: https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/itokenconfig.html#start_chars_hint
start_chars_hint: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
})
```
Expand Down Expand Up @@ -100,7 +100,7 @@ function matchInteger(text, offset, matchedTokens, groups) {

A larger and non contrived example can seen here: [Lexing Python like indentation using Chevrotain](https://github.com/SAP/chevrotain/blob/master/examples/lexer/python_indentation/python_indentation.js).

It is important to note that The matchedTokens and groups arguments match the token and groups properties of the tokenize output ([ILexingResult](https://sap.github.io/chevrotain/documentation/6_4_0/interfaces/ilexingresult.html)).
It is important to note that The matchedTokens and groups arguments match the token and groups properties of the tokenize output ([ILexingResult](https://sap.github.io/chevrotain/documentation/6_5_0/interfaces/ilexingresult.html)).
These arguments are the current state of the lexing result so even if the lexer has performed error recovery any tokens found
in those arguments are still guaranteed to be in the final result.

Expand Down
Loading

0 comments on commit d8593c7

Please sign in to comment.