Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify grammar #557

Closed
xcoulon opened this issue May 3, 2020 · 0 comments · Fixed by #560
Closed

Simplify grammar #557

xcoulon opened this issue May 3, 2020 · 0 comments · Fixed by #560

Comments

@xcoulon
Copy link
Member

xcoulon commented May 3, 2020

Use the [^...] syntax when a rule consists of an exclusion of one of more characters.

Eg:

[^:\n]+

instead of

(Alphanums / Spaces / (!EOL !":"  .))+ 
@xcoulon xcoulon self-assigned this May 3, 2020
@xcoulon xcoulon added this to the v0.5.0 milestone May 3, 2020
xcoulon added a commit to xcoulon/libasciidoc that referenced this issue May 13, 2020
use `[^...]` wherever possible

require a blank line between a paragraph and its following block

also, refactor ContinuedListItemElement rule to not rely
on Blankline elements, so they can be processed earlier in the
DocumentBlock rule.

also, update the `make bench-parser` goal to run benchmarks
with the standard grammar on 2 large files, provide stats
on smaller samples.

Fixes bytesparadise#557

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit to xcoulon/libasciidoc that referenced this issue May 13, 2020
Refactor multiple rules to simplify the grammar and
make the parser more efficient:

- use character groups instead of choices whenever applicable
- refactor `ContinuedListItemElement` rule: ignore BlankLine,
  but take into account during preprocessing (when building lists)
- move `LabeledListItem` alone before `SimpleParagraph` to simplify the latter
- remove multiple occurrences of `!EOL !LineBreak` and `!EOF !BlankLine rules
- simplify single quote/double quote bokld/monospace/italic text rules
- merge TextOnlyLinkAttributes and TextAndMoreLinkAttributes rules
- simplify FoonoteContent rule
- simplify InlineElement rule
- remove Anychars and Parenthesis rules, simplify AnyChar

also:
- define a makefile goal for the bench, using a separate .go file with a custom build tag so we can have the parse options.

Fixes bytesparadise#557

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit to xcoulon/libasciidoc that referenced this issue May 13, 2020
Refactor multiple rules to simplify the grammar and
make the parser more efficient:

- use character groups instead of choices whenever applicable
- refactor `ContinuedListItemElement` rule: ignore BlankLine,
  but take into account during preprocessing (when building lists)
- move `LabeledListItem` alone before `SimpleParagraph` to simplify the latter
- remove multiple occurrences of `!EOL !LineBreak` and `!EOF !BlankLine rules
- simplify single quote/double quote bokld/monospace/italic text rules
- merge TextOnlyLinkAttributes and TextAndMoreLinkAttributes rules
- simplify FoonoteContent rule
- simplify InlineElement rule
- remove Anychars and Parenthesis rules, simplify AnyChar

also:
- define a makefile goal for the bench, using a separate .go file with a custom build tag so we can have the parse options.

Fixes bytesparadise#557

Signed-off-by: Xavier Coulon <[email protected]>
xcoulon added a commit that referenced this issue May 14, 2020
Refactor multiple rules to simplify the grammar and
make the parser more efficient:

- use character groups instead of choices whenever applicable
- refactor `ContinuedListItemElement` rule: ignore BlankLine,
  but take into account during preprocessing (when building lists)
- move `LabeledListItem` alone before `SimpleParagraph` to simplify the latter
- remove multiple occurrences of `!EOL !LineBreak` and `!EOF !BlankLine rules
- simplify single quote/double quote bokld/monospace/italic text rules
- merge TextOnlyLinkAttributes and TextAndMoreLinkAttributes rules
- simplify FoonoteContent rule
- simplify InlineElement rule
- remove Anychars and Parenthesis rules, simplify AnyChar

also:
- define a makefile goal for the bench, using a separate .go file with a custom build tag so we can have the parse options.

Fixes #557

Signed-off-by: Xavier Coulon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant