[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc1) GOTO
- From: Pierre-Yves Gérardy <pygy79@...>
- Date: Wed, 15 Jun 2011 20:04:12 +0200
On Wed, Jun 15, 2011 at 17:32, Michael Rose <firstname.lastname@example.org> wrote:
> Von: "Pierre-Yves Gérardy" <email@example.com>
>>@>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.
> @123.name> or
> @123$name!> or even
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