On Wed, Jun 08, 2016 at 01:16:28PM +0200, Martin Bjorklund wrote:
> Juergen Schoenwaelder <[email protected]> wrote:
> > On Wed, Jun 08, 2016 at 12:29:59PM +0200, Martin Bjorklund wrote:
> > 
> > > > > Note that this is legal YANG:
> > > > > 
> > > > >    leaf type {
> > > > >      type string;
> > > > >    }
> > > > 
> > > > So keywords aren't reserved; they can also be used as identifiers.
> > > 
> > > Yes.
> >  
> > > > That's a lot clearer.  Though you can shorten it to:
> > > > 
> > > >    An unquoted string is any sequence of characters that is not a
> > > >    keyword, and does not contain any space, tab, or newline
> > > >    characters, a single or double quote character, a semicolon (";"),
> > > >    braces ("{" or "}"), or comment sequences ("//", "/*", or "*/").
> > > 
> > > Thanks, better.
> > 
> > The does the 'is not a keyword' not contratict the example shown
> > above? My reading of the new suggested text would make me believe
> > I would have to write the example as follows
> > 
> >   leaf "type" {
> >       type string;
> >   }
> > 
> > which is different from the YANG 1.0 syntax rules I think.
> 
> Note that I also wrote:
> 
> > > In section 6.3 we must also do:
> > > 
> > > OLD:
> > > 
> > >    The argument is a string, as defined in Section 6.1.2.
> > > 
> > > NEW:
> > > 
> > >    The argument is a string or a keyword, as defined in Section 6.1.2.
> 
> The alternative is to keep the current text.  But it means that the
> scanner is context-dependent (logically at least).
> 
> IMO it doesn't really matter - this is just a conceptual explanation;
> an implementation is free to implement this in whatever clever way it
> wants.

OK. So in combination with the other text we achieve the same result.
But personally, I think it is much clearer for an implementor if the
definition of an unquoted string does not exclude keywords, the risk
of getting inconsistencies later on scares me a bit. I rather would
like to see something like this:

    An unquoted string is any sequence of characters and does not
    contain any space, tab, or newline characters, a single or double
    quote character, a semicolon (";"), braces ("{" or "}"), or
    comment sequences ("//", "/*", or "*/").

    Note that any keyword can legally appear as an unquoted string.

YANG is indeed a bit special here and I believe it helps implementors
to point this out right here where an unquoted string is defined.  And
'the argument' is really a string and not a string or a keyword, which
may lead to confusion or worse wrong interpretations (despite the fact
that one might implement things this way).

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to