Skip to content

Support for the config modifiers in the PEG notation - #135

Draft
andr-dots wants to merge 90 commits into
textX:masterfrom
andr-dots:peg-modify-config
Draft

Support for the config modifiers in the PEG notation#135
andr-dots wants to merge 90 commits into
textX:masterfrom
andr-dots:peg-modify-config

Conversation

@andr-dots

@andr-dots andr-dots commented Jul 27, 2025

Copy link
Copy Markdown

Arpeggio allows to set some config parameters in the initialization of the parser, but those modifiers has to be changed sometimes during the runtime. For example, in some cases you need to consume whitespace characters as regular text.

In this pull request, the config modifiers were introduced in the PEG notation, so that they can affect a single rule or a grouped expression. The config modifiers use square brackets before a parsing expression to set the config parameters. Some examples:

INDENTATION <- [whitespace='\n\r']r' *';`
SPACE <- [skip_whitespace=False]r'[ \t]+';

Also, config modifiers allow to debug erroneous rules more easily like this: [debug=True]erroneous_rules. This way, there wouldn't be a long sheet of debug output from the other rules.

This pull request depends on #131.

Code review checklist

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly
  • Changelog(s) has/have been updated, as needed (see CHANGELOG.md, no need
    to update for typo fixes and such).

andr-dots added 30 commits July 21, 2025 19:34
The parser state class was decomposed into the main class and the state level class. The code responsible for the state data that should depend on a state level was moved to the state parsing class.
…pressions with state layers

The changes are incompatible with the previous PEG actions implementation; state actions were removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant