Skip to content

Use canonical pyparsing names - #191

Merged
dellaert merged 3 commits into
masterfrom
fix/naming
Jul 30, 2026
Merged

Use canonical pyparsing names#191
dellaert merged 3 commits into
masterfrom
fix/naming

Conversation

@dellaert

Copy link
Copy Markdown
Member

Summary

  • replace deprecated pyparsing camelCase aliases with their canonical PEP 8 names
  • rename Module.parseString to Module.parse_string without a compatibility alias
  • update the Python and MATLAB wrapper entrypoints and parser tests

Why

Pyparsing 3 recommends its PEP 8 API. The older camelCase spellings are retained only as backward-compatible aliases and can trigger misleading review feedback or eventually be removed. This change uses the canonical API throughout the project while leaving the accepted .i grammar unchanged.

Impact

Callers of the project parser must now use Module.parse_string. This is an intentional breaking rename; Module.parseString is not retained. DelimitedList remains PascalCase because it is pyparsing's canonical class name.

Validation

  • conda run -n py312 python -m pytest tests/test_interface_parser.py tests/test_parser_diagnostics.py tests/test_template_instantiator.py — 73 passed
  • conda run -n py312 python -m pytest tests — 110 passed
  • git diff --check
  • verified pyparsing 3.2.5 in py312

@dellaert
dellaert marked this pull request as ready for review July 30, 2026 13:32
@dellaert
dellaert requested a review from Copilot July 30, 2026 13:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the project’s interface parser and its callers to pyparsing’s canonical (PEP 8–style) APIs, including an intentional breaking rename of Module.parseString to Module.parse_string. It updates the Python/MATLAB wrapper entrypoints and parser-related tests to match the new API surface.

Changes:

  • Replace deprecated pyparsing camelCase aliases with canonical PEP 8 names across the interface parser (e.g., set_parse_action, as_list, nested_expr, string_end).
  • Rename the project parser entrypoint from Module.parseString to Module.parse_string (no compatibility alias), and update wrappers accordingly.
  • Update parser tests to use .parse_string(...) consistently.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_template_instantiator.py Updates parser rule invocations to .parse_string(...) for template instantiation tests.
tests/test_parser_diagnostics.py Updates diagnostics tests to call Module.parse_string(...).
tests/test_interface_parser.py Updates extensive parser unit tests to use .parse_string(...) consistently.
gtwrap/pybind_wrapper.py Updates pybind wrapper to call parser.Module.parse_string(...).
gtwrap/matlab_wrapper/wrapper.py Updates MATLAB wrapper to call parser.Module.parse_string(...).
gtwrap/interface_parser/variable.py Switches pyparsing parse-action hookup to set_parse_action.
gtwrap/interface_parser/type.py Replaces deprecated pyparsing helpers and methods (e.g., DelimitedList, as_list, set_parse_action).
gtwrap/interface_parser/tokens.py Migrates token helpers to canonical pyparsing names (e.g., nested_expr, original_text_for).
gtwrap/interface_parser/template.py Updates template grammar to use canonical pyparsing names (DelimitedList, set_parse_action, as_list).
gtwrap/interface_parser/namespace.py Updates namespace grammar and parse-result list conversion to canonical names.
gtwrap/interface_parser/module.py Updates module grammar and exposes parse_string as the new parser entrypoint.
gtwrap/interface_parser/function.py Updates function grammar to canonical pyparsing names (DelimitedList, set_parse_action, as_list).
gtwrap/interface_parser/enum.py Updates enum grammar to DelimitedList and set_parse_action.
gtwrap/interface_parser/declaration.py Updates declaration parse actions to set_parse_action.
gtwrap/interface_parser/classes.py Updates class/method grammars to use set_parse_action and as_list.
gtwrap/interface_parser/init.py Switches to ParserElement.enable_packrat() canonical name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gtwrap/interface_parser/module.py Outdated
dellaert and others added 2 commits July 30, 2026 15:43
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@dellaert
dellaert merged commit 55f6f21 into master Jul 30, 2026
8 checks passed
@dellaert
dellaert deleted the fix/naming branch July 30, 2026 13:47
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.

2 participants