lua-users home
lua-l archive

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


> >Or am I wrong? Does anybody know about some way to reuse Lua's parser?
> >Or do you think it would be better to write new parser just for 
> the editor?
> 
> Do you need a full parser for your editor, or just a lexer?
> It's not difficult to re-use Lua's lexer. I can send you code for that.

To say the truth I am still not very sure what all I will need. Syntax
highlighting can be easily implemented just by simple string comparisons.
But the statement completion can not - I need to know about every
single variable what type(s) it can represent to determine what it
may contain and act accordingly: Let's say I have a global variable
named 'a'. When the user types 'a.' or 'a[' I need to find out
what all can follow - that is I need to find all XXX's where
'a.XXX' is defined, which is easy to say but hard to do. I guess
I will torment myself with this problem for some while and finally
rather ask the user for the type than try to find it out. So if 
you are so kind to send me the code to reuse Lua's lexer, I'd be
very grateful.


> On the other hand, I've been toying with the idea of writing a Lua parser
> in Lua, which would create a tree representation of the program, 
> so if there's
> really enough demand, I can take that again.

The problem is I need to modify the tree as the user modifies the source
code. If that would not be a problem, I'd vote for it with all my hands.

Martin