On Tue, Aug 26, 2014 at 08:39:57AM +0200, Dominik Vogt wrote:
> You are right.  The current code mixes all sorts of things in an order
> that lacks proper definition:
> 
>   * Reading command lines from various sources (module input, file input,
>     PipeRead), including parsing of continued lines.
>   * Lazy tokenisation of command lines (i.e. the next token is parsed
>     when it's needed).  Tokenisation actually does not suit all commands.
>     Some take the remaining part of the command line as a literal string
>     (Echo, function definitions, ...), and some have more complex needs,
>     e.g. commands that parse conditions containing sub-tokens separated
>     by whitespace.  Sometimes it is required that a token begins with a
>     quote character.
>   * De-quoting of tokens.  This is done for the tokens before their
>     contents are interpreted.  So, the POSINT rule should really be a
>     POSINT_TOKEN rule, but I wouldn't do that now because its a lot of
>     work and the gain is doubtful.
>   * Variable expansion does not fit into the parsing process at all.
> 
> So we'll probably end up with several separate parsing steps (with their
> own Abnf each) and generation steps in between (expansion, de-quoting).

Trouble is, you're in danger of silently documenting most of the
intricacies of the current parser at the same time as you're documenting
what the different commands have a syntaxes.  As you say though, it's
likely possible to link the two together after the fact, and since we
know the above points, it's perhaps easier to do after we've documented
everything else, which is more important.  What I was checking is that
we're not shooting ourselves in the foot by ignoring it now; so I'm not
too worried.

> >     MENUCONTEXT =/ "Window" /
> >         "Interior"
> >         "Interior =/ "Title"
> >         "Interior =/ ("Button" INT) "Icon"
> >         "Interior =/ "Item"
> >         "Interior =/ "Context"
> >         "Interior =/ "This"
> >         "Interior =/ ("Rectangle" MENUCONTEXTGEOMETRY)
> >                             
> > I'm not convinced the syntax is correct there, but I'm not sure
> > precisely what it's getting at either?
> 
> MENUCONTEXT = "Window" / "Interior" / "Title" / ("Button" INT) / "Icon" / ...
> 
> can be written as 
> 
> MENUCONTEXT = "Window"
> MENUCONTEXT =/ "Interior"
> MENUCONTEXT =/ "Title"
> MENUCONTEXT =/ ("Button" INT)
> MENUCONTEXT =/ "Icon"
> MENUCONTEXT =/ ...
> 
> See 3.3 in the rfc:  http://tools.ietf.org/html/rfc5234
> =/ is just a form of multi line continuation of a alternative rule:
>   FOO = a / b / c
> or
>   FOO = a / b /
>           c
> is equivalent to
>   FOO = a / b
>   FOO =/ c

Sorry, I don't think I was too clear on this, Dominik.  I understand the
rules, what I'm not understanding in the above is why "Interior" is a
continuation pattern repeated over again and again.  It looks incorrect
to me, as in I would have expected:

    MENUCONTEXT =/ "Window" / "Interior"
    MENUCONTEXT =/ "Title"
    ; etc...

But that's not how it's ended up being in the document we're writing,
and I'm just wondering if that's deliberate (i.e., I'm misreading it),
or a typo.  At this point I'm suggesting it's a typo.

I need coffee and then I'm off to $DAYJOB.  I'll continue this in my
lunch hour.

-- Thomas Adam

-- 
"Deep in my heart I wish I was wrong.  But deep in my heart I know I am
not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)

Reply via email to