[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    Re: functioncall vs varlist ambiguity
From:       David Manura <dm.lua () math2 ! org>
Date:       2010-07-26 13:03:07
Message-ID: AANLkTilua9KQEAtPxpIs0M2wBiZD91qIm5XaS9t9mhje () mail ! gmail ! com
[Download RAW message or body]

On Sun, Jul 25, 2010 at 6:18 AM, Peter Cawley <lua@corsix.org> wrote:
> On Sun, Jul 25, 2010 at 1:13 AM, David Manura <dm.lua@math2.org> wrote:
>> ...but a difficulty is that Lua currently doesn't
>> include column numbers in parser error messages (which at times I've
>> thought it should--like it would be of some use to me in LuaInspect).
>
> For this particular case, perhaps you could use a custom lua_Reader
> which feeds in the chunk one byte at a time, and keeps track of how
> many bytes have been requested. For large inputs, this might be
> inefficient, but a combination of feeding one byte at a time and
> binary search should fix that.

That looks like a good idea.  The first pass of loadstring gives you a
line number.  Then you can call `load` with a chunk reader, passing
each byte or even each token or approximation of a token (e.g.
'%w*%W+') on the line individually.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic