diff --git a/autotests/folding/highlight.yang.fold b/autotests/folding/highlight.yang.fold new file mode 100644 --- /dev/null +++ b/autotests/folding/highlight.yang.fold @@ -0,0 +1,38 @@ +// from: https://en.wikipedia.org/w/index.php?title=YANG&oldid=792171830#Example +module example-sports { + + namespace "http://example.com/example-sports"; + prefix sports; + + import ietf-yang-types { prefix yang; } + + typedef season { + type string; + description + "The name of a sports season, including the type and the year, e.g, + 'Champions League 2014/2015'."; + } + + container sports { + config true; + + list person { + key name; + leaf name { type string; } + leaf birthday { type yang:date-and-time; mandatory true; } + } + + list team { + key name; + leaf name { type string; } + list player { + key "name season"; + unique number; + leaf name { type leafref { path "/sports/person/name"; } } + leaf season { type season; } + leaf number { type uint16; mandatory true; } + leaf scores { type uint16; default 0; } + } + } + } +} diff --git a/autotests/html/highlight.yang.html b/autotests/html/highlight.yang.html new file mode 100644 --- /dev/null +++ b/autotests/html/highlight.yang.html @@ -0,0 +1,45 @@ + + + +highlight.yang + +
+// from: https://en.wikipedia.org/w/index.php?title=YANG&oldid=792171830#Example
+module example-sports {
+
+  namespace "http://example.com/example-sports";
+  prefix sports;
+
+  import ietf-yang-types { prefix yang; }
+
+  typedef season {
+    type string;
+    description
+      "The name of a sports season, including the type and the year, e.g,
+       'Champions League 2014/2015'.";
+  }
+
+  container sports {
+    config true;
+
+    list person {
+      key name;
+      leaf name { type string; }
+      leaf birthday { type yang:date-and-time; mandatory true; }
+    }
+
+    list team {
+      key name;
+      leaf name { type string; }
+      list player {
+        key "name season";
+        unique number;
+        leaf name { type leafref { path "/sports/person/name"; }  }
+        leaf season { type season; }
+        leaf number { type uint16; mandatory true; }
+        leaf scores { type uint16; default 0; }
+      }
+    }
+  }
+}
+
diff --git a/autotests/input/highlight.yang b/autotests/input/highlight.yang new file mode 100644 --- /dev/null +++ b/autotests/input/highlight.yang @@ -0,0 +1,38 @@ +// from: https://en.wikipedia.org/w/index.php?title=YANG&oldid=792171830#Example +module example-sports { + + namespace "http://example.com/example-sports"; + prefix sports; + + import ietf-yang-types { prefix yang; } + + typedef season { + type string; + description + "The name of a sports season, including the type and the year, e.g, + 'Champions League 2014/2015'."; + } + + container sports { + config true; + + list person { + key name; + leaf name { type string; } + leaf birthday { type yang:date-and-time; mandatory true; } + } + + list team { + key name; + leaf name { type string; } + list player { + key "name season"; + unique number; + leaf name { type leafref { path "/sports/person/name"; } } + leaf season { type season; } + leaf number { type uint16; mandatory true; } + leaf scores { type uint16; default 0; } + } + } + } +} diff --git a/autotests/reference/highlight.yang.ref b/autotests/reference/highlight.yang.ref new file mode 100644 --- /dev/null +++ b/autotests/reference/highlight.yang.ref @@ -0,0 +1,38 @@ +// from: https://en.wikipedia.org/w/index.php?title=YANG&oldid=792171830#Example
+module example-sports {
+
+ namespace "http://example.com/example-sports";
+ prefix sports;
+
+ import ietf-yang-types { prefix yang; }
+
+ typedef season {
+ type string;
+ description
+ "The name of a sports season, including the type and the year, e.g,
+ 'Champions League 2014/2015'.";
+ }
+
+ container sports {
+ config true;
+
+ list person {
+ key name;
+ leaf name { type string; }
+ leaf birthday { type yang:date-and-time; mandatory true; }
+ }
+
+ list team {
+ key name;
+ leaf name { type string; }
+ list player {
+ key "name season";
+ unique number;
+ leaf name { type leafref { path "/sports/person/name"; } }
+ leaf season { type season; }
+ leaf number { type uint16; mandatory true; }
+ leaf scores { type uint16; default 0; }
+ }
+ }
+ }
+}
diff --git a/data/syntax/yang.xml b/data/syntax/yang.xml new file mode 100644 --- /dev/null +++ b/data/syntax/yang.xml @@ -0,0 +1,155 @@ + + + + + + decimal64 + int8 + int16 + int32 + int64 + uint8 + uint16 + uint32 + uint64 + string + boolean + enumeration + bits + binary + leafref + identityref + empty + instance-identifier + + + anyxml + argument + augment + base + belongs-to + bit + case + choice + config + contact + container + default + description + enum + error-app-tag + error-message + extension + deviation + deviate + feature + fraction-digits + grouping + identity + import + include + input + key + leaf + leaf-list + length + list + mandatory + max-elements + min-elements + module + must + namespace + notification + ordered-by + organization + output + path + pattern + position + prefix + presence + range + reference + refine + require-instance + revision + revision-date + rpc + status + submodule + type + typedef + unique + units + uses + value + when + yang-version + yin-element + + + add + current + delete + deprecated + max + min + not-supported + obsolete + replace + system + unbounded + user + + + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +