Open robcxyz opened 1 year ago
Upgrade string parsers to use an AST
Proposal Status: wip
Issue Number: 172
Proposal Doc: ast-parser.md
Current parsing is based on regex which works in most use cases but has become:
Very complex - Regex is basically unmaintainable
Rigid - Can't use equal signs, just spaces
Patched in multiple places where an AST strategy would be better
We currently use regex based parsing in:
tackle/utils/command.py - unpack_args_kwargs_string - Main CLI input string / hook call parser
tackle/parser.py - parse_complex_types - Parses types
Both of these parsers could benefit from a more structured tree based parser vs the current regex hack machine.
[ ] Create working POC for custom parser
[ ] Replace existing main parser
[ ] Replace type parser
[ ] Create custom visitor and replace hack for rendering tool
AST Upgrade
Upgrade string parsers to use an AST
Proposal Status: wip
Issue Number: 172
Proposal Doc: ast-parser.md
Overview
Current parsing is based on regex which works in most use cases but has become:
Very complex - Regex is basically unmaintainable
Rigid - Can't use equal signs, just spaces
Patched in multiple places where an AST strategy would be better
We currently use regex based parsing in:
tackle/utils/command.py - unpack_args_kwargs_string - Main CLI input string / hook call parser
tackle/parser.py - parse_complex_types - Parses types
Both of these parsers could benefit from a more structured tree based parser vs the current regex hack machine.
Steps
[ ] Create working POC for custom parser
[ ] Replace existing main parser
[ ] Replace type parser
[ ] Create custom visitor and replace hack for rendering tool