lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


V S P wrote:
Although metalua
(http://metalua.luaforge.net/) would error out when given incorrect Lua syntax, may be modifying/relaxing its internals is the right approach for you (perhaps creating another 'token' type indicating possibly incorrect syntax )

I have thought about doing this for SciTE once upon a time, by modifying code from Yueliang.

You will need to get the parser, flatten all the parts, use state variables and a state stack instead. Something like that. We need to be able to snapshot the parser state plus the lexer state properly, say, at each start-of-line. Then, if the editor request to refresh line 42 onwards, we can do a table lookup, copy over the state information, then resume the parser. I guess it will run at most 100-200KB/sec, but that's par for Lua-based text processing.

On Fri, 24 Jul 2009 10:25 -0300, "Luís Eduardo Jason Santos" <jasonsantos@gmail.com> wrote:
Hi, folks

I need to write a lua-based Parser that can build and repair a Lua AST for the LuaEclipse project.

Although is relatively easy to create parsers with LPEG, error-detection and 'online' matching is a pain.

Besides, I am not familiar with all the issues of this particular problem, so I am looking for examples.

Therefore, I wonder if anyone has ever written an incremental parser for Lua that I could use as a reference.

Interesting papers on the subject are welcome too.

Thanks in advance!

Luís Eduardo Jason Santos

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia