Hi Lada,
On 22/10/2015 13:50, Ladislav Lhotka wrote:
On 22 Oct 2015, at 14:27, Robert Wilton <[email protected]> wrote:
Hi Martin,
I have a couple more minor queries/observations as I work through some of the
details of ABNF grammar:
1. For the module-stmt rule below, to be strictly correct, should it have a comment stating that
the statements in any of the "*-stmts" blocks can appear in any order? Or is the
intention that the "*-stmt" blocks must strictly be in the order defined by the ABNF? If
the latter statement is true then does any of the text in 7.1 need to be strengthened to explicitly
state this?
I understand the order is fixed in this case.
This makes sense to me, otherwise it would be valid to perversely put
the 'yang-version "1.1"' statement right at the end of the module
definition.
The section 14 text states:
In YANG, almost all statements are unordered. The ABNF grammar
[RFC5234] [RFC7405] defines the canonical order. To improve module
readability, it is RECOMMENDED that clauses be entered in this order.
Within the ABNF grammar, unordered statements are marked with
comments.
So this does mean that the module sections are ordered. Potentially a
more explicit statement somewhere in section 7.1. might be helpful.
Thanks,
Rob
module-stmt = optsep module-keyword sep identifier-arg-str
optsep
"{" stmtsep
module-header-stmts
linkage-stmts
meta-stmts
revision-stmts
body-stmts
"}" optsep
2. Similarly for import-stmt. Should this have a comment indicating that
prefix-stmt or revision-date-stmt can appear in any order?
import-stmt = import-keyword sep identifier-arg-str optsep
"{" stmtsep
prefix-stmt
[revision-date-stmt]
"}" stmtsep
Here it IMO makes little sense to require fixed order.
Lada
On a practical note, it seems that YANG allowing various statements to be in
any arbitrary order makes writing a parser quite a lot more complex and less
efficient than writing a parser that only accepts YANG modules that have been
written in the canonical order.
Thanks,
Rob
On 14/10/2015 19:48, Robert Wilton wrote:
On 14/10/2015 18:14, Martin Bjorklund wrote:
Robert Wilton <[email protected]> wrote:
Hi Martin,
I was looking at the YANG ABNF grammar a bit more last night (to see
how hard it would be to write a parser for it) and I had a couple more
observations. Apologies that this is after the WG last call ...
1. [Trivial] The indentation of the range statement in 9.3.5 looks
wrong.
9.3.5. Usage Example
typedef my-decimal {
type decimal64 {
fraction-digits 2;
range "1 .. 3.14 | 10 | 20..max";
}
}
I presume that it should be:
9.3.5. Usage Example
typedef my-decimal {
type decimal64 {
fraction-digits 2;
range "1 .. 3.14 | 10 | 20..max";
}
}
Fixed.
2. The description of yang-char (around page 186) doesn't seem to be
quite accurate (relative to description of legal characters in 6. YANG
Syntax), and given that it excludes character values outside the
unicode range.
Hmm, which characters are outside the unicode range?
I was thinking of anything above 0xFFFF, but it looks like my definition (and
possibly quite a few others on the Internet) of Unicode vs UTF-16 is out of
date.
;; any Unicode character including tab, carriage return, and line
;; feed, but excluding the other C0 control characters, the surrogate
;; blocks, and the noncharacters.
yang-char = %x9 / %xA / %xD / %x20-D7FF /
...
Should this be:
;; any Unicode or IOS/IEC 10646 character including tab, carriage return,
;; and line
;; feed, but excluding the other C0 control characters, the surrogate
;; blocks, and the noncharacters.
yang-char = %x9 / %xA / %xD / %x20-D7FF /
I think this would be ok.
3. There are lots of comments where "these stmts can appear in any
order", e.g.
linkageStmts = ;; these stmts can appear in any order
*importStmt
*includeStmt
Am I right in interpreting that there can be any number of import and
include statements and they can be interleaved in any arbitrary
order?
Yes.
E.g. this specific example (but not in the general case) could equally
have been written *(importStmt / includeStmt).
Well, the grammar defines the canonical order. With the alternative
rule above, the canonical order would be different.
Thanks for the clarification,
Rob
/martin
.
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod
--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C
.
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod