[NTG-context] Grammar to parse TeX input?

Joseph Canedo josephcanedo at gmail.com
Mon Nov 26 15:19:21 CET 2018


Dear list,

I use a buffer to make some text processing. That text contains TeX macros etc… and I’d like to know if there is some feature in lua to parse the text to extract bits which macros, normal text etc… ? 
Thanks

Best regards

Joseph

Example of pseudo MWE follows.

\startluacode

function zzz_function(text)
- How to process ‘text’ to get bits which are macros, groups etc… ? Eventually expanded ?
end

\stopluacode

\definebuffer[ZZZBuffer]

\def\StartZZZ{\grabbufferdata[ZZZBuffer][StartZZZ][StopZZZ]}
\def\StopZZZ{\ctxlua{zzz_function(buffers.getcontent('ZZZBuffer'))}}

\StartZZZ
\input knuth
\StopZZZ


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20181126/265fa725/attachment.html>


More information about the ntg-context mailing list