[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPeg: inconsistencies regarding empty captures
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 8 May 2013 14:08:21 -0300
> > I'm really scared of saying something is a bug nowadays.
> > So I'll confine myself to asking whether the following behaviour
> > is reproducible on other systems.
> >
> > $ lua -l lpeg
> > Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> > > =lpeg.version()
> > 0.12
> > > local Cc=lpeg.Cc; return (Cc(nil)*Cc()/1):match""
> > Segmentation fault (core dumped)
>
> It seems to be a bug (but it only happens with Lua 5.2).
And it seems to happen with an even simpler example:
> print(lpeg.Cc(nil):match"")
The constant 'nil' does not create an 'uvalue' for the pattern, so
when LPeg tries to access it, there is no table there. In Lua 5.1,
all userdata have an 'fenv', so there is no bug.
-- Roberto