14. YANG ABNF语法

YANG中,几乎所有的陈述都是无序的。 ABNF语法[RFC5234] [RFC7405]定义了规范的顺序。 为了提高模块可读性,建议按此顺序输入条款。

ABNF语法中,无序的语句用注释标记。

这个语法假定扫描器用一个空格字符替换YANG的注释。

<CODE BEGINS> file "yang.abnf"

module-stmt         = optsep module-keyword sep identifier-arg-str optsep
                      "{" stmtsep
                          module-header-stmts
                          linkage-stmts
                          meta-stmts
                          revision-stmts
                          body-stmts
                      "}" optsep

submodule-stmt      = optsep submodule-keyword sep identifier-arg-str optsep
                      "{" stmtsep
                          submodule-header-stmts
                          linkage-stmts
                          meta-stmts
                          revision-stmts
                          body-stmts
                      "}" optsep

module-header-stmts = ;; these stmts can appear in any order
                      yang-version-stmt
                      namespace-stmt
                      prefix-stmt

submodule-header-stmts =
                      ;; these stmts can appear in any order
                      yang-version-stmt
                      belongs-to-stmt
meta-stmts          = ;; these stmts can appear in any order
                    [organization-stmt]
                    [contact-stmt]
                    [description-stmt]
                    [reference-stmt]

linkage-stmts       = ;; these stmts can appear in any order
                    *import-stmt
                    *include-stmt

revision-stmts      = *revision-stmt

body-stmts          = *(extension-stmt /
                      feature-stmt /
                      identity-stmt /
                      typedef-stmt /
                      grouping-stmt /
                      data-def-stmt /
                      augment-stmt /
                      rpc-stmt /
                      notification-stmt /
                      deviation-stmt)

data-def-stmt       = container-stmt /
                    leaf-stmt /
                    leaf-list-stmt /
                    list-stmt /
                    choice-stmt /
                    anydata-stmt /
                    anyxml-stmt /
                    uses-stmt

yang-version-stmt   = yang-version-keyword sep yang-version-arg-str
                    stmtend

yang-version-arg-str = < a string that matches the rule >
                     < yang-version-arg >

yang-version-arg    = "1.1"

import-stmt         = import-keyword sep identifier-arg-str optsep
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        prefix-stmt
                        [revision-date-stmt]
                        [description-stmt]
                        [reference-stmt]
                    "}" stmtsep
include-stmt        = include-keyword sep identifier-arg-str optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           [revision-date-stmt]
                           [description-stmt]
                           [reference-stmt]
                       "}") stmtsep

namespace-stmt      = namespace-keyword sep uri-str stmtend

uri-str             = < a string that matches the rule >
                      < URI in RFC 3986 >

prefix-stmt         = prefix-keyword sep prefix-arg-str stmtend

belongs-to-stmt     = belongs-to-keyword sep identifier-arg-str
                      optsep
                      "{" stmtsep
                          prefix-stmt
                      "}" stmtsep

organization-stmt   = organization-keyword sep string stmtend

contact-stmt        = contact-keyword sep string stmtend

description-stmt    = description-keyword sep string stmtend

reference-stmt      = reference-keyword sep string stmtend

units-stmt          = units-keyword sep string stmtend

revision-stmt       = revision-keyword sep revision-date optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           [description-stmt]
                           [reference-stmt]
                       "}") stmtsep

revision-date       = date-arg-str

revision-date-stmt  = revision-date-keyword sep revision-date stmtend

extension-stmt      = extension-keyword sep identifier-arg-str optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           [argument-stmt]
                           [status-stmt]
                           [description-stmt]
                           [reference-stmt]
                       "}") stmtsep

argument-stmt       = argument-keyword sep identifier-arg-str optsep
                      (";" /
                       "{" stmtsep
                           [yin-element-stmt]
                       "}") stmtsep

yin-element-stmt    = yin-element-keyword sep yin-element-arg-str
                      stmtend

yin-element-arg-str = < a string that matches the rule >
                      < yin-element-arg >

yin-element-arg     = true-keyword / false-keyword

identity-stmt       = identity-keyword sep identifier-arg-str optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           *if-feature-stmt
                           *base-stmt
                           [status-stmt]
                           [description-stmt]
                           [reference-stmt]
                       "}") stmtsep

base-stmt           = base-keyword sep identifier-ref-arg-str
                      stmtend

feature-stmt        = feature-keyword sep identifier-arg-str optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           *if-feature-stmt
                           [status-stmt]
                           [description-stmt]
                           [reference-stmt]
                       "}") stmtsep
if-feature-stmt     = if-feature-keyword sep if-feature-expr-str
                     stmtend

if-feature-expr-str = < a string that matches the rule >
                     < if-feature-expr >

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

typedef-stmt        = typedef-keyword sep identifier-arg-str optsep
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         type-stmt
                         [units-stmt]
                         [default-stmt]
                         [status-stmt]
                         [description-stmt]
                         [reference-stmt]
                      "}" stmtsep

type-stmt           = type-keyword sep identifier-ref-arg-str optsep
                     (";" /
                      "{" stmtsep
                          [type-body-stmts]
                      "}") stmtsep

type-body-stmts     = numerical-restrictions /
                     decimal64-specification /
                     string-restrictions /
                     enum-specification /
                     leafref-specification /
                     identityref-specification /
                     instance-identifier-specification /
                     bits-specification /
                     union-specification /
                     binary-specification
                     numerical-restrictions = [range-stmt]

range-stmt          = range-keyword sep range-arg-str optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [error-message-stmt]
                        [error-app-tag-stmt]
                        [description-stmt]
                        [reference-stmt]
                     "}") stmtsep

decimal64-specification = ;; these stmts can appear in any order
                       fraction-digits-stmt
                       [range-stmt]

fraction-digits-stmt = fraction-digits-keyword sep
                    fraction-digits-arg-str stmtend

fraction-digits-arg-str = < a string that matches the rule >
                       < fraction-digits-arg >

fraction-digits-arg = ("1" ["0" / "1" / "2" / "3" / "4" /
                         "5" / "6" / "7" / "8"])
                   / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"

string-restrictions = ;; these stmts can appear in any order
                   [length-stmt]
                   *pattern-stmt

length-stmt         = length-keyword sep length-arg-str optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [error-message-stmt]
                        [error-app-tag-stmt]
                        [description-stmt]
                        [reference-stmt]
                     "}") stmtsep

pattern-stmt        = pattern-keyword sep string optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [modifier-stmt]
                        [error-message-stmt]
                        [error-app-tag-stmt]
                        [description-stmt]
                        [reference-stmt]
                     "}") stmtsep

modifier-stmt       = modifier-keyword sep modifier-arg-str stmtend

modifier-arg-str    = < a string that matches the rule >
                   < modifier-arg >

modifier-arg        = invert-match-keyword

default-stmt        = default-keyword sep string stmtend

enum-specification  = 1*enum-stmt

enum-stmt           = enum-keyword sep string optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        *if-feature-stmt
                        [value-stmt]
                        [status-stmt]
                        [description-stmt]
                        [reference-stmt]
                     "}") stmtsep

leafref-specification =
                   ;; these stmts can appear in any order
                   path-stmt
                   [require-instance-stmt]

path-stmt           = path-keyword sep path-arg-str stmtend

require-instance-stmt = require-instance-keyword sep
                      require-instance-arg-str stmtend

require-instance-arg-str = < a string that matches the rule >
                        < require-instance-arg >

require-instance-arg = true-keyword / false-keyword

instance-identifier-specification =
                      [require-instance-stmt]

identityref-specification =
                      1*base-stmt

union-specification = 1*type-stmt

binary-specification = [length-stmt]

bits-specification  = 1*bit-stmt

bit-stmt            = bit-keyword sep identifier-arg-str optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           *if-feature-stmt
                           [position-stmt]
                           [status-stmt]
                           [description-stmt]
                           [reference-stmt]
                       "}") stmtsep

position-stmt       = position-keyword sep
                      position-value-arg-str stmtend

position-value-arg-str = < a string that matches the rule >
                         < position-value-arg >

position-value-arg  = non-negative-integer-value

status-stmt         = status-keyword sep status-arg-str stmtend

status-arg-str      = < a string that matches the rule >
                      < status-arg >

status-arg          = current-keyword /
                      obsolete-keyword /
                      deprecated-keyword

config-stmt         = config-keyword sep
                      config-arg-str stmtend

config-arg-str      = < a string that matches the rule >
                      < config-arg >

config-arg          = true-keyword / false-keyword

mandatory-stmt      = mandatory-keyword sep
                      mandatory-arg-str stmtend

mandatory-arg-str   = < a string that matches the rule >
                      < mandatory-arg >

mandatory-arg       = true-keyword / false-keyword

presence-stmt       = presence-keyword sep string stmtend

ordered-by-stmt     = ordered-by-keyword sep
                      ordered-by-arg-str stmtend

ordered-by-arg-str  = < a string that matches the rule >
                      < ordered-by-arg >

ordered-by-arg      = user-keyword / system-keyword

must-stmt           = must-keyword sep string optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           [error-message-stmt]
                           [error-app-tag-stmt]
                           [description-stmt]
                           [reference-stmt]
                        "}") stmtsep

error-message-stmt  = error-message-keyword sep string stmtend

error-app-tag-stmt  = error-app-tag-keyword sep string stmtend

min-elements-stmt   = min-elements-keyword sep
                      min-value-arg-str stmtend

min-value-arg-str   = < a string that matches the rule >
                      < min-value-arg >

min-value-arg       = non-negative-integer-value

max-elements-stmt   = max-elements-keyword sep
                      max-value-arg-str stmtend

max-value-arg-str   = < a string that matches the rule >
                      < max-value-arg >

max-value-arg       = unbounded-keyword /
                      positive-integer-value

value-stmt          = value-keyword sep integer-value-str stmtend

integer-value-str   = < a string that matches the rule >
                    < integer-value >

grouping-stmt       = grouping-keyword sep identifier-arg-str optsep
                    (";" /
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         [status-stmt]
                         [description-stmt]
                         [reference-stmt]
                         *(typedef-stmt / grouping-stmt)
                         *data-def-stmt
                         *action-stmt
                         *notification-stmt
                     "}") stmtsep

container-stmt      = container-keyword sep identifier-arg-str optsep
                    (";" /
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         [when-stmt]
                         *if-feature-stmt
                         *must-stmt
                         [presence-stmt]
                         [config-stmt]
                         [status-stmt]
                         [description-stmt]
                         [reference-stmt]
                         *(typedef-stmt / grouping-stmt)
                         *data-def-stmt
                         *action-stmt
                         *notification-stmt
                     "}") stmtsep

leaf-stmt           = leaf-keyword sep identifier-arg-str optsep
                   "{" stmtsep
                       ;; these stmts can appear in any order
                       [when-stmt]
                       *if-feature-stmt
                       type-stmt
                       [units-stmt]
                       *must-stmt
                       [default-stmt]
                       [config-stmt]
                       [mandatory-stmt]
                       [status-stmt]
                       [description-stmt]
                       [reference-stmt]
                    "}" stmtsep

leaf-list-stmt      = leaf-list-keyword sep identifier-arg-str optsep
                   "{" stmtsep
                       ;; these stmts can appear in any order
                       [when-stmt]
                       *if-feature-stmt
                       type-stmt stmtsep
                       [units-stmt]
                       *must-stmt
                       *default-stmt
                       [config-stmt]
                       [min-elements-stmt]
                       [max-elements-stmt]
                       [ordered-by-stmt]
                       [status-stmt]
                       [description-stmt]
                       [reference-stmt]
                    "}" stmtsep

list-stmt           = list-keyword sep identifier-arg-str optsep
                      "{" stmtsep
                          ;; these stmts can appear in any order
                          [when-stmt]
                          *if-feature-stmt
                          *must-stmt
                          [key-stmt]
                          *unique-stmt
                          [config-stmt]
                          [min-elements-stmt]
                          [max-elements-stmt]
                          [ordered-by-stmt]
                          [status-stmt]
                          [description-stmt]
                          [reference-stmt]
                          *(typedef-stmt / grouping-stmt)
                          1*data-def-stmt
                          *action-stmt
                          *notification-stmt
                       "}" stmtsep

key-stmt            = key-keyword sep key-arg-str stmtend

key-arg-str         = < a string that matches the rule >
                      < key-arg >

key-arg             = node-identifier *(sep node-identifier)

unique-stmt         = unique-keyword sep unique-arg-str stmtend

unique-arg-str      = < a string that matches the rule >
                      < unique-arg >

unique-arg          = descendant-schema-nodeid
                      *(sep descendant-schema-nodeid)
choice-stmt         = choice-keyword sep identifier-arg-str optsep
                    (";" /
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         [when-stmt]
                         *if-feature-stmt
                         [default-stmt]
                         [config-stmt]
                         [mandatory-stmt]
                         [status-stmt]
                         [description-stmt]
                         [reference-stmt]
                         *(short-case-stmt / case-stmt)
                     "}") stmtsep

short-case-stmt     = choice-stmt /
                    container-stmt /
                    leaf-stmt /
                    leaf-list-stmt /
                    list-stmt /
                    anydata-stmt /
                    anyxml-stmt

case-stmt           = case-keyword sep identifier-arg-str optsep
                    (";" /
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         [when-stmt]
                         *if-feature-stmt
                         [status-stmt]
                         [description-stmt]
                         [reference-stmt]
                         *data-def-stmt
                     "}") stmtsep

anydata-stmt        = anydata-keyword sep identifier-arg-str optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [when-stmt]
                        *if-feature-stmt
                        *must-stmt
                        [config-stmt]
                        [mandatory-stmt]
                        [status-stmt]
                        [description-stmt]
                        [reference-stmt]
                     "}") stmtsep

anyxml-stmt         = anyxml-keyword sep identifier-arg-str optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [when-stmt]
                        *if-feature-stmt
                        *must-stmt
                        [config-stmt]
                        [mandatory-stmt]
                        [status-stmt]
                        [description-stmt]
                        [reference-stmt]
                     "}") stmtsep

uses-stmt           = uses-keyword sep identifier-ref-arg-str optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [when-stmt]
                        *if-feature-stmt
                        [status-stmt]
                        [description-stmt]
                        [reference-stmt]
                        *refine-stmt
                        *uses-augment-stmt
                    "}") stmtsep

refine-stmt         = refine-keyword sep refine-arg-str optsep
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           *if-feature-stmt
                           *must-stmt
                           [presence-stmt]
                           *default-stmt
                           [config-stmt]
                           [mandatory-stmt]
                           [min-elements-stmt]
                           [max-elements-stmt]
                           [description-stmt]
                           [reference-stmt]
                         "}" stmtsep

refine-arg-str      = < a string that matches the rule >
                      < refine-arg >

refine-arg          = descendant-schema-nodeid

uses-augment-stmt   = augment-keyword sep uses-augment-arg-str optsep
                      "{" stmtsep
                          ;; these stmts can appear in any order
                          [when-stmt]
                          *if-feature-stmt
                          [status-stmt]
                          [description-stmt]
                          [reference-stmt]
                          1*(data-def-stmt / case-stmt /
                             action-stmt / notification-stmt)
                       "}" stmtsep

uses-augment-arg-str = < a string that matches the rule >
                       < uses-augment-arg >

uses-augment-arg    = descendant-schema-nodeid

augment-stmt        = augment-keyword sep augment-arg-str optsep
                      "{" stmtsep
                          ;; these stmts can appear in any order
                          [when-stmt]
                          *if-feature-stmt
                          [status-stmt]
                          [description-stmt]
                          [reference-stmt]
                          1*(data-def-stmt / case-stmt /
                             action-stmt / notification-stmt)
                       "}" stmtsep

augment-arg-str     = < a string that matches the rule >
                      < augment-arg >

augment-arg         = absolute-schema-nodeid

when-stmt           = when-keyword sep string optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           [description-stmt]
                           [reference-stmt]
                        "}") stmtsep

rpc-stmt            = rpc-keyword sep identifier-arg-str optsep
                      (";" /
                       "{" stmtsep
                           ;; these stmts can appear in any order
                           *if-feature-stmt
                           [status-stmt]
                           [description-stmt]
                           [reference-stmt]
                           *(typedef-stmt / grouping-stmt)
                           [input-stmt]
                           [output-stmt]
                       "}") stmtsep

action-stmt         = action-keyword sep identifier-arg-str optsep
                     (";" /
                      "{" stmtsep
                          ;; these stmts can appear in any order
                          *if-feature-stmt
                          [status-stmt]
                          [description-stmt]
                          [reference-stmt]
                          *(typedef-stmt / grouping-stmt)
                          [input-stmt]
                          [output-stmt]
                      "}") stmtsep

input-stmt          = input-keyword optsep
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         *must-stmt
                         *(typedef-stmt / grouping-stmt)
                         1*data-def-stmt
                     "}" stmtsep

output-stmt         = output-keyword optsep
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         *must-stmt
                         *(typedef-stmt / grouping-stmt)
                         1*data-def-stmt
                     "}" stmtsep

notification-stmt   = notification-keyword sep
                     identifier-arg-str optsep
                     (";" /
                      "{" stmtsep
                          ;; these stmts can appear in any order
                          *if-feature-stmt
                          *must-stmt
                          [status-stmt]
                          [description-stmt]
                          [reference-stmt]
                          *(typedef-stmt / grouping-stmt)
                          *data-def-stmt
                      "}") stmtsep

deviation-stmt      = deviation-keyword sep
                    deviation-arg-str optsep
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [description-stmt]
                        [reference-stmt]
                        (deviate-not-supported-stmt /
                          1*(deviate-add-stmt /
                             deviate-replace-stmt /
                             deviate-delete-stmt))
                    "}" stmtsep

deviation-arg-str   = < a string that matches the rule >
                    < deviation-arg >

deviation-arg       = absolute-schema-nodeid

deviate-not-supported-stmt =
                    deviate-keyword sep
                    not-supported-keyword-str stmtend

deviate-add-stmt    = deviate-keyword sep add-keyword-str optsep
                    (";" /
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         [units-stmt]
                         *must-stmt
                         *unique-stmt
                         *default-stmt
                         [config-stmt]
                         [mandatory-stmt]
                         [min-elements-stmt]
                         [max-elements-stmt]
                     "}") stmtsep

deviate-delete-stmt = deviate-keyword sep delete-keyword-str optsep
                    (";" /
                     "{" stmtsep
                         ;; these stmts can appear in any order
                         [units-stmt]
                         *must-stmt
                         *unique-stmt
                         *default-stmt
                     "}") stmtsep

deviate-replace-stmt = deviate-keyword sep replace-keyword-str optsep
                   (";" /
                    "{" stmtsep
                        ;; these stmts can appear in any order
                        [type-stmt]
                        [units-stmt]
                        [default-stmt]
                        [config-stmt]
                        [mandatory-stmt]
                        [min-elements-stmt]
                        [max-elements-stmt]
                    "}") stmtsep

not-supported-keyword-str = < a string that matches the rule >
                         < not-supported-keyword >

add-keyword-str     = < a string that matches the rule >
                   < add-keyword >

delete-keyword-str  = < a string that matches the rule >
                   < delete-keyword >

replace-keyword-str = < a string that matches the rule >
                   < replace-keyword >

;; represents the usage of an extension
unknown-statement   = prefix ":" identifier [sep string] optsep
                   (";" /
                    "{" optsep
                        *((yang-stmt / unknown-statement) optsep)
                     "}") stmtsep

yang-stmt           = action-stmt /
                   anydata-stmt /
                   anyxml-stmt /
                   argument-stmt /
                   augment-stmt /
                   base-stmt /
                   belongs-to-stmt /
                   bit-stmt /
                   case-stmt /
                   choice-stmt /
                   config-stmt /
                   contact-stmt /
                   container-stmt /
                   default-stmt /
                   description-stmt /
                   deviate-add-stmt /

                   deviate-delete-stmt /
                   deviate-not-supported-stmt /
                   deviate-replace-stmt /
                   deviation-stmt /
                   enum-stmt /
                   error-app-tag-stmt /
                   error-message-stmt /
                   extension-stmt /
                   feature-stmt /
                   fraction-digits-stmt /
                   grouping-stmt /
                   identity-stmt /
                   if-feature-stmt /
                   import-stmt /
                   include-stmt /
                   input-stmt /
                   key-stmt /
                   leaf-list-stmt /
                   leaf-stmt /
                   length-stmt /
                   list-stmt /
                   mandatory-stmt /
                   max-elements-stmt /
                   min-elements-stmt /
                   modifier-stmt /
                   module-stmt /
                   must-stmt /
                   namespace-stmt /
                   notification-stmt /
                   ordered-by-stmt /
                   organization-stmt /
                   output-stmt /
                   path-stmt /
                   pattern-stmt /
                   position-stmt /
                   prefix-stmt /
                   presence-stmt /
                   range-stmt /
                   reference-stmt /
                   refine-stmt /
                   require-instance-stmt /
                   revision-date-stmt /
                   revision-stmt /
                   rpc-stmt /
                   status-stmt /
                   submodule-stmt /
                   typedef-stmt /
                   type-stmt /
                   unique-stmt /
                   units-stmt /
                   uses-augment-stmt /
                   uses-stmt /
                   value-stmt /
                   when-stmt /
                   yang-version-stmt /
                   yin-element-stmt

;; Ranges

range-arg-str       = < a string that matches the rule >
                   < range-arg >

range-arg           = range-part *(optsep "|" optsep range-part)

range-part          = range-boundary
                   [optsep ".." optsep range-boundary]

range-boundary      = min-keyword / max-keyword /
                   integer-value / decimal-value

;; Lengths

length-arg-str      = < a string that matches the rule >
                   < length-arg >

length-arg          = length-part *(optsep "|" optsep length-part)

length-part         = length-boundary
                   [optsep ".." optsep length-boundary]

length-boundary     = min-keyword / max-keyword /
                   non-negative-integer-value

;; Date

date-arg-str        = < a string that matches the rule >
                   < date-arg >

date-arg            = 4DIGIT "-" 2DIGIT "-" 2DIGIT

;; Schema Node Identifiers

schema-nodeid       = absolute-schema-nodeid /
                   descendant-schema-nodeid

absolute-schema-nodeid = 1*("/" node-identifier)

descendant-schema-nodeid =
                      node-identifier
                      [absolute-schema-nodeid]

node-identifier     = [prefix ":"] identifier

;; Instance Identifiers

instance-identifier = 1*("/" (node-identifier
                              [1*key-predicate /
                               leaf-list-predicate /
                               pos]))

key-predicate       = "[" *WSP key-predicate-expr *WSP "]"

key-predicate-expr  = node-identifier *WSP "=" *WSP quoted-string

leaf-list-predicate = "[" *WSP leaf-list-predicate-expr *WSP "]"

leaf-list-predicate-expr = "." *WSP "=" *WSP quoted-string

pos                 = "[" *WSP positive-integer-value *WSP "]"

quoted-string       = (DQUOTE string DQUOTE) / (SQUOTE string SQUOTE)

;; leafref path

path-arg-str        = < a string that matches the rule >
                      < path-arg >

path-arg            = absolute-path / relative-path

absolute-path       = 1*("/" (node-identifier *path-predicate))

relative-path       = 1*("../") descendant-path

descendant-path     = node-identifier
                      [*path-predicate absolute-path]

path-predicate      = "[" *WSP path-equality-expr *WSP "]"

path-equality-expr  = node-identifier *WSP "=" *WSP path-key-expr

path-key-expr       = current-function-invocation *WSP "/" *WSP
rel-path-keyexpr

rel-path-keyexpr    = 1*(".." *WSP "/" *WSP)
                    *(node-identifier *WSP "/" *WSP)
                    node-identifier

;;; Keywords, using the syntax for case-sensitive strings (RFC 7405)

;; statement keywords
action-keyword           = %s"action"
anydata-keyword          = %s"anydata"
anyxml-keyword           = %s"anyxml"
argument-keyword         = %s"argument"
augment-keyword          = %s"augment"
base-keyword             = %s"base"
belongs-to-keyword       = %s"belongs-to"
bit-keyword              = %s"bit"
case-keyword             = %s"case"
choice-keyword           = %s"choice"
config-keyword           = %s"config"
contact-keyword          = %s"contact"
container-keyword        = %s"container"
default-keyword          = %s"default"
description-keyword      = %s"description"
deviate-keyword          = %s"deviate"
deviation-keyword        = %s"deviation"
enum-keyword             = %s"enum"
error-app-tag-keyword    = %s"error-app-tag"
error-message-keyword    = %s"error-message"
extension-keyword        = %s"extension"
feature-keyword          = %s"feature"
fraction-digits-keyword  = %s"fraction-digits"
grouping-keyword         = %s"grouping"
identity-keyword         = %s"identity"
if-feature-keyword       = %s"if-feature"
import-keyword           = %s"import"
include-keyword          = %s"include"
input-keyword            = %s"input"
key-keyword              = %s"key"
leaf-keyword             = %s"leaf"
leaf-list-keyword        = %s"leaf-list"
length-keyword           = %s"length"
list-keyword             = %s"list"
mandatory-keyword        = %s"mandatory"
max-elements-keyword     = %s"max-elements"
min-elements-keyword     = %s"min-elements"
modifier-keyword         = %s"modifier"
module-keyword           = %s"module"
must-keyword             = %s"must"
namespace-keyword        = %s"namespace"

notification-keyword     = %s"notification"
ordered-by-keyword       = %s"ordered-by"
organization-keyword     = %s"organization"
output-keyword           = %s"output"
path-keyword             = %s"path"
pattern-keyword          = %s"pattern"
position-keyword         = %s"position"
prefix-keyword           = %s"prefix"
presence-keyword         = %s"presence"
range-keyword            = %s"range"
reference-keyword        = %s"reference"
refine-keyword           = %s"refine"
require-instance-keyword = %s"require-instance"
revision-keyword         = %s"revision"
revision-date-keyword    = %s"revision-date"
rpc-keyword              = %s"rpc"
status-keyword           = %s"status"
submodule-keyword        = %s"submodule"
type-keyword             = %s"type"
typedef-keyword          = %s"typedef"
unique-keyword           = %s"unique"
units-keyword            = %s"units"
uses-keyword             = %s"uses"
value-keyword            = %s"value"
when-keyword             = %s"when"
yang-version-keyword     = %s"yang-version"
yin-element-keyword      = %s"yin-element"

;; other keywords

add-keyword              = %s"add"
current-keyword          = %s"current"
delete-keyword           = %s"delete"
deprecated-keyword       = %s"deprecated"
false-keyword            = %s"false"
invert-match-keyword     = %s"invert-match"
max-keyword              = %s"max"
min-keyword              = %s"min"
not-supported-keyword    = %s"not-supported"
obsolete-keyword         = %s"obsolete"
replace-keyword          = %s"replace"
system-keyword           = %s"system"
true-keyword             = %s"true"
unbounded-keyword        = %s"unbounded"
user-keyword             = %s"user"

and-keyword              = %s"and"
or-keyword               = %s"or"
not-keyword              = %s"not"

current-function-invocation = current-keyword *WSP "(" *WSP ")"

;;; Basic Rules

prefix-arg-str      = < a string that matches the rule >
                      < prefix-arg >

prefix-arg          = prefix

prefix              = identifier

identifier-arg-str  = < a string that matches the rule >
                      < identifier-arg >

identifier-arg      = identifier

identifier          = (ALPHA / "_")
                      *(ALPHA / DIGIT / "_" / "-" / ".")

identifier-ref-arg-str = < a string that matches the rule >
                         < identifier-ref-arg >

identifier-ref-arg  = identifier-ref

identifier-ref      = [prefix ":"] identifier

string              = < an unquoted string, as returned by >
                      < the scanner, that matches the rule >
                      < yang-string >

yang-string         = *yang-char

;; any Unicode or ISO/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 = %x09 / %x0A / %x0D / %x20-D7FF /
                            ; exclude surrogate blocks %xD800-DFFF
           %xE000-FDCF /    ; exclude noncharacters %xFDD0-FDEF
           %xFDF0-FFFD /    ; exclude noncharacters %xFFFE-FFFF
           %x10000-1FFFD /  ; exclude noncharacters %x1FFFE-1FFFF
           %x20000-2FFFD /  ; exclude noncharacters %x2FFFE-2FFFF
           %x30000-3FFFD /  ; exclude noncharacters %x3FFFE-3FFFF
           %x40000-4FFFD /  ; exclude noncharacters %x4FFFE-4FFFF
           %x50000-5FFFD /  ; exclude noncharacters %x5FFFE-5FFFF
           %x60000-6FFFD /  ; exclude noncharacters %x6FFFE-6FFFF
           %x70000-7FFFD /  ; exclude noncharacters %x7FFFE-7FFFF
           %x80000-8FFFD /  ; exclude noncharacters %x8FFFE-8FFFF
           %x90000-9FFFD /  ; exclude noncharacters %x9FFFE-9FFFF
           %xA0000-AFFFD /  ; exclude noncharacters %xAFFFE-AFFFF
           %xB0000-BFFFD /  ; exclude noncharacters %xBFFFE-BFFFF
           %xC0000-CFFFD /  ; exclude noncharacters %xCFFFE-CFFFF
           %xD0000-DFFFD /  ; exclude noncharacters %xDFFFE-DFFFF
           %xE0000-EFFFD /  ; exclude noncharacters %xEFFFE-EFFFF
           %xF0000-FFFFD /  ; exclude noncharacters %xFFFFE-FFFFF
           %x100000-10FFFD  ; exclude noncharacters %x10FFFE-10FFFF

integer-value       = ("-" non-negative-integer-value) /
                       non-negative-integer-value

non-negative-integer-value = "0" / positive-integer-value

positive-integer-value = (non-zero-digit *DIGIT)

zero-integer-value  = 1*DIGIT

stmtend             = optsep (";" / "{" stmtsep "}") stmtsep

sep                 = 1*(WSP / line-break)
                      ; unconditional separator

optsep              = *(WSP / line-break)

stmtsep             = *(WSP / line-break / unknown-statement)

line-break          = CRLF / LF

non-zero-digit      = %x31-39

decimal-value       = integer-value ("." zero-integer-value)

SQUOTE              = %x27
                      ; single quote

;;; core rules from RFC 5234

ALPHA               = %x41-5A / %x61-7A
                      ; A-Z / a-z

CR                  = %x0D
                      ; carriage return

CRLF                = CR LF
                      ; Internet standard newline

DIGIT               = %x30-39
                      ; 0-9

DQUOTE              = %x22
                      ; double quote

HTAB                = %x09
                      ; horizontal tab

LF                  = %x0A
                      ; line feed

SP                  = %x20
                      ; space

WSP                 = SP / HTAB
                      ; whitespace

<CODE ENDS>

results matching ""

    No results matching ""