lua-users home
lua-l archive

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


I'm with what steve said, in that case, I think in your case its much
simpler. Why write a parser at all? Just use Lua to parse a
programmable configfile for you! Thats what Lua originally was made
for.

This _is_ valid lua code, suppsing "WIDGET", "TILE", "TYPE",
"ELEMENTS" etc have been declared as functions:

WIDGET mywidget
{
    TITLE "My widget";
    TYPE WIDGET_TYPE;
    ELEMENTS
    {
        element1,
        element2,
        element3
    }
}

IMPORT  WIDGET mywidget
{
    REFINE widget_name{
        REDEFINE TITLE "Your widget";
    }
}

if YOUR_WIDGET_ALLOWED then
WIDGET yourwidget
{
    TITLE "Your widget";
    TYPE WIDGET_TYPE;
    ELEMENTS
    {
        element1,
        element2,
        element3
    }
}
endif

for x= 0, 8 do
   if  something_true then
       do_this(argument1, argument2);
   end
end


supports

do
    statements;
while(condition);

supports

while(condition)
    statements;
end