-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
447429f
commit ed1df1e
Showing
12 changed files
with
198 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Prism.languages.yang = { | ||
// https://tools.ietf.org/html/rfc6020#page-34 | ||
// http://www.yang-central.org/twiki/bin/view/Main/YangExamples | ||
'comment': /\/\*[\s\S]*?\*\/|\/\/.*/, | ||
'string': { | ||
pattern: /"(?:[^\\"]|\\.)*"|'[^']*'/, | ||
greedy: true | ||
}, | ||
'keyword': { | ||
pattern: /(^|[{};\r\n][ \t]*)[a-z_][\w.-]*/i, | ||
lookbehind: true | ||
}, | ||
'namespace': { | ||
pattern: /(\s)[a-z_][\w.-]*(?=:)/i, | ||
lookbehind: true | ||
}, | ||
'boolean': /\b(?:false|true)\b/, | ||
'operator': /\+/, | ||
'punctuation': /[{};:]/ | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<h2>Full example</h2> | ||
<p><a href="http://www.yang-central.org/twiki/bin/view/Main/YangExamplesExecdDns">Source</a></p> | ||
<pre><code>submodule execd-dns { | ||
|
||
belongs-to execd { prefix execd; } | ||
|
||
import inet-types { prefix inet; } | ||
|
||
include execd-types; | ||
|
||
description | ||
"The 'dns' component provides support for configuring the DNS resolver. | ||
|
||
The 'domain' keyword of /etc/resolv.conf is not supported, since | ||
it is equivalent to 'search' with a single domain. I.e. in terms | ||
of the data model, the domains are always configured as 'search' | ||
elements, even if there is only one. The set of available options | ||
has been limited to those that are generally available across | ||
different resolver implementations, and generally useful."; | ||
|
||
revision "2008-11-04" { | ||
description "draft-ietf-netmod-yang-02 compatible."; | ||
} | ||
revision "2007-08-29" { | ||
description "Syntax fixes after pyang validation."; | ||
} | ||
revision "2007-06-08" { | ||
description "Initial revision."; | ||
} | ||
|
||
grouping dns { | ||
list search { | ||
key name; | ||
max-elements 3; | ||
leaf name { type int32; } | ||
leaf domain { type inet:host; } | ||
} | ||
list server { | ||
key address; | ||
max-elements 3; | ||
ordered-by user; | ||
leaf address { type inet:ip-address; } | ||
} | ||
container options { | ||
leaf ndots { type uint8; } | ||
leaf timeout { type uint8; } | ||
leaf attempts { type uint8; } | ||
} | ||
} | ||
}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
true | ||
false | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "true"], | ||
["keyword", "false"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for booleans. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// comment | ||
/* | ||
comment | ||
*/ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "// comment"], | ||
["comment", "/*\n comment\n*/"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
submodule execd-ntp { | ||
|
||
key name; | ||
|
||
leaf stratum { type ntpStratum; default 10; } | ||
|
||
leaf version { type int8 { range "1..4"; } default 4; } | ||
|
||
} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "submodule"], | ||
" execd-ntp ", | ||
["punctuation", "{"], | ||
|
||
["keyword", "key"], | ||
" name", | ||
["punctuation", ";"], | ||
|
||
["keyword", "leaf"], | ||
" stratum ", | ||
["punctuation", "{"], | ||
["keyword", "type"], | ||
" ntpStratum", | ||
["punctuation", ";"], | ||
["keyword", "default"], | ||
" 10", | ||
["punctuation", ";"], | ||
["punctuation", "}"], | ||
|
||
["keyword", "leaf"], | ||
" version ", | ||
["punctuation", "{"], | ||
["keyword", "type"], | ||
" int8 ", | ||
["punctuation", "{"], | ||
["keyword", "range"], | ||
["string", "\"1..4\""], | ||
["punctuation", ";"], | ||
["punctuation", "}"], | ||
["keyword", "default"], | ||
" 4", | ||
["punctuation", ";"], | ||
["punctuation", "}"], | ||
|
||
["punctuation", "}"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for keywords. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type foo:type | ||
type _foo.-bar:type | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "type"], | ||
["namespace", "foo"], | ||
["punctuation", ":"], | ||
"type\n", | ||
["keyword", "type"], | ||
["namespace", "_foo.-bar"], | ||
["punctuation", ":"], | ||
"type" | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for namespace prefixes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
" | ||
|
||
\"'foo'\" | ||
|
||
" | ||
'fo | ||
"" | ||
o' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", "\"\n\n\\\"'foo'\\\"\n\n\""], | ||
["string", "'fo\n\"\"\no'"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for string. |