[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Any LPEG tutorial for laymen ?
- From: Craig Barnes <craigbarnes85@...>
- Date: Tue, 24 Sep 2013 14:13:54 +0100
On 24 September 2013 13:07, David Crayford <email@example.com> wrote:
> I'm another layman wanting to grok LPeg. I come from a mainframe background
> where the lingua franca is REXX. Lua really does nuke REXX in just about
> every aspect other than simplicity of parsing.
> Take the following output from a netstat command.
> Client Name: SMTP Client Id: 000000B7
> Local Socket: 0.0.0.0..1049
> Foreign Socket: *..*
> BytesIn: 00000000000000493311
> BytesOut: 00000000000000366747
> DgramIn: 00000000000000008397
> DgramOut: 00000000000000008529
> Last Touched: 10:51:10
> MaxSendLim: 0000065535 MaxRecvLim: 0000065535
> SockOpt: D0000000 DSField: 00
> QOSPolicy: No
> RoutingPolicy: No
> ReceiveDataQueued: 0000000000 ReceiveMsgCnt: 0000000000
> I would love to learn how to write LPeg parser to yank the key->values from
> that multi-line report easily. I know it can be done I just can't work it
> out because I'm a neophyte.
I just threw together a rough example with LPeg, if it helps at all: