siefkenj / unified-latex

Utilities for parsing and manipulating LaTeX ASTs with the Unified.js framework
MIT License
85 stars 20 forks source link

Pull requests list feat: support embellishments and non-punctuation delimiters #57

Closed siefkenj closed 9 months ago

siefkenj commented 9 months ago

This is a modification of PR #42

Previously, it couldn't attach arguments for macros whose argspec

This PR adds support for it. The second use-case may be marginal, I initially tried to make embellishments work, then realized that the same code would enable the second feature and unifies some codes.

Since a single embellishment argspec can represent multiple arguments, such as in e{^_} where each token ^ and _ would represents 2 arguments, gobbleSingleArguments signature was changed to return Ast.Arguments | Ast.Arguments[] | null.

Currently, this just puts embellishment tokens as openMark in Ast. Would it be preferable to have a new separate property for embellishments?

Next goal would be to support/test macro expansions for such arguments. Once it's done, I'd like to work on #24.

Please take a look and provide comments, and feel free to make your own changes!