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