lua-users home
lua-l archive

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

On Wed, Jun 15, 2011 at 17:32, Michael Rose <> wrote:
> Von: "Pierre-Yves Gérardy" <>
>>@>name would be easier to parse. Otherwise, the parser has to fetch
>>the @ sigil, then the name, and only then the final sigil that
>>determines the branch to take.
> No it wouldn't.

How do you discriminate between a label or a goto before reaching
either the column or the right angled bracket?

Not that it matters much, but it increments the cyclomatic complexity
of the "@" clause.

>>  or
>    @123$name!> or even
>    @12-34-5123>

I understand the purpose of a terminator, but none of your examples
are valid goto labels. I assume that the first two would jump to
"name", but what about the third one?

Also, these examples create more convoluted clauses for the parser,
and duplicated code unless you use a goto. Here's the simplfied code

    name ? ( ":" ? label : goto )
    number ? ( "." ?  label with info : line number )

@!name,info> is clean and would allow the "@" section of the parser to
have only one conditional level. More straightforward, easier to read
and understand, and thus to maintain.

    name ? label  (with or without debug info)
    number ? line number
    "!" ? goto

-- Pierre-Yves