How would I parse macros like this?
\topskip=40pt
\parskip=10pt
\parindent=0pt
\baselineskip=15pt
I have tried this:
const macrosWithSetting: {
signature?: string
argumentParser: ArgumentParser
} = {
argumentParser: (nodes, startPos) => {
// parses things like `\lineskip=-\baselineskip`
// nodes[startPos] is the equality sign
const value = nodes[startPos + 1]
const args = [
value, // value or "-"
...(value.type === 'string' && value.content === '-' // actual value if value === '-'
? [nodes[startPos + 2]]
: []),
].map((n) => arg(n))
return {
args,
nodesRemoved: args.length,
}
},
}
But it doesn't to collect the arguments / remove them from the AST.
How would I parse macros like this?
I have tried this:
But it doesn't to collect the arguments / remove them from the AST.