[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Generating a pretty AST with LPeg
- From: David Favro <lua@...>
- Date: Wed, 29 Jan 2014 13:19:54 -0500
Use lpeg.Cg() around NAME and PLIST, like this:
local WS = lpeg.S' \n\t'^0
local NAME = lpeg.C( lpeg.R'az'^1 )
local PLIST = lpeg.Ct( WS * ( NAME * ( WS * ',' * WS * NAME )^0 )^-1 )
local FCALL = lpeg.Cc'FCALL' * lpeg.Ct( WS * lpeg.Cg(NAME,'name')
* '(' * lpeg.Cg(PLIST,'args') * WS * ')' )
local ALL = lpeg.Ct( FCALL^0 )