# [NTG-context] Grammar to parse TeX input?

Joseph Canedo josephcanedo at gmail.com
Tue Nov 27 23:00:43 CET 2018

I’ve tried context.processbuffer but I am afraid it’s not what I am after, most probably I have not phrased clearly my question.

What I am looking for is roughly what’s described in Taco’s presentation https://meeting.contextgarden.net/2014/talks/2014-09-12-taco-luatex/luatextalk.pdf
A way to decompose some input into tokens which represent either normal text, csnames etc…  I had a try to this token library in LuaTeX but I could not find examples of how to use it. I suspect that buffers mechanism use it somehow.

Thanks

De : Hans Hagen
Envoyé le :lundi 26 novembre 2018 18:55
À : mailing list for ConTeXt users; Joseph Canedo
Objet :Re: [NTG-context] Grammar to parse TeX input?

On 11/26/2018 3:19 PM, Joseph Canedo wrote:
> \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
context.processbuffer { "ZZZBuffer" }

-----------------------------------------------------------------