Skip to content

Commit

Permalink
Default maxLookahead should be 4 not 3.
Browse files Browse the repository at this point in the history
fixes #472
  • Loading branch information
Shahar Soel committed Jun 13, 2017
1 parent 9219612 commit bb1699b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## X.Y.Z (INSERT_DATE_HERE)

#### Breaking Changes
- [Default maxLookahead changed to 3](https://github.com/SAP/chevrotain/issues/472)
- [Default maxLookahead changed to 4](https://github.com/SAP/chevrotain/issues/472)
* Originally the default maxLookahead was 5, This could cause very slow parser initialization
under certain edge case during ambiguity detection, however the vast majority of grammars do not
require five tokens of lookahead. A smaller default avoids these potential slow downs while still allows
override in unique cases which require a large lookahead.
overriding in unique cases which require a large lookahead.

#### Bug Fixes
- [Separator DSL methods lookahead issue.](https://github.com/SAP/chevrotain/issues/391)
Expand Down
2 changes: 1 addition & 1 deletion src/parse/parser_public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export interface IParserConfig {

const DEFAULT_PARSER_CONFIG:IParserConfig = Object.freeze({
recoveryEnabled: false,
maxLookahead: 3,
maxLookahead: 4,
ignoredIssues: <any>{},
dynamicTokensEnabled: false,
// TODO: Document this breaking change, can it be mitigated?
Expand Down
4 changes: 2 additions & 2 deletions test/parse/recognizer/recognizer_config_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("The Recognizer's Configuration", () => {

let parser = new EmptyConfigParser()
expect((<any>parser).recoveryEnabled).to.be.false
expect((<any>parser).maxLookahead).to.equal(3)
expect((<any>parser).maxLookahead).to.equal(4)

})

Expand All @@ -26,7 +26,7 @@ describe("The Recognizer's Configuration", () => {

let parser = new NoConfigParser()
expect((<any>parser).recoveryEnabled).to.be.false
expect((<any>parser).maxLookahead).to.equal(3)
expect((<any>parser).maxLookahead).to.equal(4)
})

})

0 comments on commit bb1699b

Please sign in to comment.