Closed siefkenj closed 6 months ago
@theseanl I have incorporated some functionality from #62 . Let me know if you want to rework the macro expansion in #82 to be based off of this work.
In #62, where default argument support is already completely implemented, adding default arguments to AST as done in this PR is not even needed. expandMacros
have all the information needed to expand default arguments, so what this PR does (adding default arguments to renderInfo) is useless. You would be better off working on improving #62. I am open to more reviews.
I see you kept the default arg information just for expansion :-).
I like the argspec grammar in this PR better. I will reimplement the macro expansion on top of this PR. The other parts of #62 are the improvements to gobbleSingleArgument
. We can revisit those after expansion is done.
This PR adds some of the functionality from #62 but with a slightly different approach.
Default arguments are now stored on
argument
nodes if an argument is not provided. adefaultArg
is always a string.Since a default argument may contain LaTeX code, it will need to be parsed again before inserting into an expanded macro. For example
\NewDocumentCommand{\xxx}{E{^}{{\color{red}x}}}{#1}
would store the string"\color{red}x
as the default argument. A call toparse
would be needed inexpandMacros