BroadbandForum / yang

Broadband Forum YANG Modules
https://yang.broadband-forum.org
Other
25 stars 19 forks source link

Newline character in if-feature expression string bbf-l2-forwarding-mac-learning-control submodule #5

Closed darshana-jk closed 5 years ago

darshana-jk commented 5 years ago

In bbf-l2-forwarding-mac-learning-control.yang, lines 129-131,

if-feature
        "forwarding-databases and mac-learning and
         mac-learning-control-profiles";

There's a newline in the if-feature expression string. According to the RFC7950-section-6.1.3.1, the expression effectively becomes:

        "forwarding-databases and mac-learning and\n" + "mac-learning-control-profiles";

For a YANG parser, the newline character doesn't have a meaning there, is this intended?

jboyd77 commented 5 years ago

This was not intentional to include the \n character. We will need to fix this in the next publication.

wlupton commented 5 years ago

I'm not convinced that it's wrong. Tracing down the BNF I think we get to sep which includes "\n" (LF).

7.20.2.  The "if-feature" Statement
...
The if-feature boolean expression syntax is formally defined by the rule "if-feature-expr" in Section 14.
14.  YANG ABNF Grammar
...
if-feature-expr     = if-feature-term
                           [sep or-keyword sep if-feature-expr]

if-feature-term     = if-feature-factor
                           [sep and-keyword sep if-feature-term]

if-feature-factor   = not-keyword sep if-feature-factor /
                         "(" optsep if-feature-expr optsep ")" /
                         identifier-ref-arg
sep                 = 1*(WSP / line-break)
                         ; unconditional separator

optsep              = *(WSP / line-break)

WSP                 = SP / HTAB
                         ; whitespace

line-break          = CRLF / LF
darshana-jk commented 5 years ago

Ok, considering the newline as a separator/optional separator makes more sense. Thank you for the clarification.