siefkenj / unified-latex

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

Allow non-character brace tokens in xparse argument specification #46

Open theseanl opened 1 year ago

theseanl commented 1 year ago

The code below should be expanded to Arg is: 123.

\NewDocumentCommand{\xxx}{ r\a{ 1 } }{  Arg is: #1 }
\xxx \a{123}1
siefkenj commented 11 months ago

Is this actually used in any packages? It seems like it would add a lot of complication to argument parsing...

theseanl commented 11 months ago

I am not aware of any real-world use cases, its just that xparse documentation always talks about "tokens", not individual characters, so I figured out that things like r\a{ 1 } should work and it actually did.

By the way, xparse argument specifications may contain argument processors like > { \SplitArgument { 2 } { , } } m, which I myself found convenient. I want to support such argument specifications eventually, and then the parsing will need to be more complicated anyway.