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

Re: [YANG] YANG syntax



Martin Bjorklund wrote:
> Hi,
> 
> Thank's for the feedback!
> 
> Ladislav Lhotka <lhotka at cesnet.cz> wrote:
>> Hi,
>>
>> here are my comments and questions on YANG syntax and its description in
>> the -02 draft:
>>
>> - An unquoted + is allowed as a string parameter. I think this is too
>> fragile as + can appear in numbers and also as a concatenation operator.
>> I suggest to require isolated + to be quoted.
> 
> It's not only isolated + signs, but also if the string itself includes
> a + sign:
>     
>     "1 + 2"  // ok
>     1 + 2    // nok
>     
> The simplest way would be to always require a + within a string to be quoted:
> 
>   If a string contains any whitespace characters, a semicolon (";"), a
>   plus sign ("+"), curly braces ("{ }"), or comment sequences ("//",
>   "/*", or "*/"), then it MUST be enclosed within double or single
>   quotes.
> 
> But that means that:
> 
>    default +1;    // nok
>    default "+1";  // ok
> 
> This would mean that a + sign either in isolation or within a string
> must be quoted.
> 
> I think I prefer the simple rule.  Any comments?


I prefer to leave the string encoding rules the way they are.
The differentiator is whether the string contains whitespace,
curly braces, or a start of comment.  A no-whitespace string
is OK in YANG, which is a pain to parse, but easier on the user.

Equivalent:
    default 1+3;  //  ok
    default "1+3"; // ok
    default "1+" + "3";  //ok

Legal:
    config "fa" + "lse";  //ok
    range min..max;  // ok
    type min..max;   // ok but now an ID not 3 tokens


The '+' operator needs to be unquoted and also needs to be
isolated (in whitespace), to be a concat operator, not a plus sign.




Andy

> 
>> - The draft should probably clearly specify that recursive containment
>> is not allowed.
> 
> Ok.  I'll try to write some text.
> 
>> - Can a submodule use definitions from its parent module - automatically
>> or via "include"?
> 
> No.  You can never include a module (just submodules).
> 
> 
>> - Production rules for all statements except module and submodule are
>> labelled "<keyword>-stmt". For the sake of consistency, the rules for
>> module and submodule should be renamed to module-stmt and
>> submodule-stmt.
> 
> Fixed.
> 
> 
>> - Is it necessary to keep meta-stmts and submodule-meta-stmts distinct?
>> Their productions are identical.
> 
> No reason.  Fixed.
> 
>> - float-value requires a sign ("+/"-") in the exponent, pyang allows
>> floats like 6.022E23. Maybe the sign should be made optional?
> 
> Yes I think so.  This is supported by the standard strdtoX functions.
> Any comments?
> 
>> - The "boolean" type in W3C and RELAX NG datatype libraries allow as
>> values either true/false or 1/0. Would it be a problem to allow this in
>> YANG, too?
> 
> I'll pass on this and see if Juergen will comment.
> 
>> - I don't really understand the keyref statement and its path
>> expression. An example would be helpful.
> 
> Do you need more than what's in 8.8.4?
> 
>> - bit-stmt - all substatements are optional but braces are required.
> 
> Fixed.
> 
>> - presence keyword is missing in Table 30 in App. B.
> 
> Fixed.
> 
>> - unique-arg  should have "1*SP" instead of "1*sp"
> 
> Yes, but it is actually valid ABNF (by accident!) since rule names are
> case insensitive.
> 
> But I think it should be "sep" instead of "1*sp".   That also
> allows newlines, just like key-arg.   Alternatively, both key-arg and
> unique-arg should use "1*SP", and if you want newlines you can use
> string concatenation.
> 
> 
>> - descendant-schema-nodeid should be an alternative?
>>   descendant-schema-nodeid
>>                        = node-identifier /
>>                          absolute-schema-nodeid
> 
> No, if it is absolute it is not descendant.  descendant-schema-nodeid
> means that it is a relative w/o leading dots, i.e. it reference
> soemthing below the current point.
> 
>> - What is the role of unknown-statement in stmtsep and stmtend?
> 
> It covers extension statements.  The grammar must allow e.g.:
> 
>   description "bla bla" {
>     my-ext:type "cli-help";
>   }
> 
> 
> /martin
> _______________________________________________
> YANG mailing list
> YANG at ietf.org
> https://www.ietf.org/mailman/listinfo/yang
> 
> 
> 


_______________________________________________
YANG mailing list
YANG at ietf.org
https://www.ietf.org/mailman/listinfo/yang