Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
theseanl opened this issue Sep 9, 2023 · 2 comments
Open

Comments

@theseanl
Copy link
Contributor

theseanl commented Sep 9, 2023

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

\NewDocumentCommand{\xxx}{ r\a{ 1 } }{  Arg is: #1 }
\xxx \a{123}1
@siefkenj
Copy link
Owner

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

@theseanl
Copy link
Contributor Author

theseanl commented Sep 29, 2023

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.

theseanl added a commit to theseanl/unified-latex that referenced this issue Jan 2, 2024
Doing so required a rewrite of pegjs grammar use for parsing xparse
argument specifications. Previously, a lot of things were modeled by an
ArgSpec struct `Group`, but in the end those used in O,R,D and those for
e,E,u required different behavior in many aspects, so the pegjs grammar
now differentiate them via `group` and `collection`. Also, the ArgSpec
does not have Group anymore, everything is parsed to an array of
strings.

This should fix siefkenj#46.
theseanl added a commit to theseanl/unified-latex that referenced this issue Jan 20, 2024
Until argspec's behavior was fixed, and while doing so, a support for
multi-token stops was added. Also, now it properly supports macro
delimiters (which was really just a by-product of applying uniform
treatment to any logic related to finding braces). This fixes
siefkenj#46.
theseanl added a commit to theseanl/unified-latex that referenced this issue Jan 20, 2024
Until argspec's behavior was fixed, and while doing so, a support for
multi-token stops was added. Also, now it properly supports macro
delimiters (which was really just a by-product of applying uniform
treatment to any logic related to finding braces). This fixes
siefkenj#46.
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

No branches or pull requests

2 participants