lua-users home
lua-l archive

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


On Mon, Aug 22, 2011 at 16:07, Axel Kittenberger <axkibe@gmail.com> wrote:
> 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
>
>

....how exactly are statements like "IMPORT WIDGET" made into valid Lua code?

-- 
Sent from my toaster.