-
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
e32e043
commit f84c49c
Showing
10 changed files
with
283 additions
and
1 deletion.
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,125 @@ | ||
Prism.languages.nevod = { | ||
'comment': /\/\/.*|(?:\/\*[\s\S]*?(?:\*\/|$))/, | ||
'string': { | ||
pattern: /(?:"(?:""|[^"])*"(?!")|'(?:''|[^'])*'(?!'))!?\*?/, | ||
greedy: true, | ||
inside: { | ||
'string-attrs': /!$|!\*$|\*$/, | ||
}, | ||
}, | ||
'namespace': { | ||
pattern: /(@namespace\s+)[a-zA-Z0-9\-.]+(?=\s*{)/, | ||
lookbehind: true, | ||
}, | ||
'pattern': { | ||
pattern: /(@pattern\s+)?#?[a-zA-Z0-9\-.]+(?:\s*[(]\s*(?:~\s*)?[a-zA-Z0-9\-.]+\s*(?:,\s*(?:~\s*)?[a-zA-Z0-9\-.]*)*[)])?(?=\s*=)/, | ||
lookbehind: true, | ||
inside: { | ||
'pattern-name': { | ||
pattern: /^#?[a-zA-Z0-9\-.]+/, | ||
alias: 'class-name', | ||
}, | ||
'fields': { | ||
pattern: /\(.*\)/, | ||
inside: { | ||
'field-name': { | ||
pattern: /[a-zA-Z0-9\-.]+/, | ||
alias: 'variable', | ||
}, | ||
'punctuation': /[,()]/, | ||
'operator': { | ||
pattern: /~/, | ||
alias: 'field-hidden-mark', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
'search': { | ||
pattern: /(@search\s+|#)[a-zA-Z0-9\-.]+(?:\.\*)?(?=\s*;)/, | ||
alias: 'function', | ||
lookbehind: true, | ||
}, | ||
'keyword': /@(?:require|namespace|pattern|search|inside|outside|having|where)\b/, | ||
'standard-pattern': { | ||
pattern: /\b(?:Word|Punct|Symbol|Space|LineBreak|Start|End|Alpha|AlphaNum|Num|NumAlpha|Blank|WordBreak|Any)(?:\([a-zA-Z0-9\-.,\s+]*\))?/, | ||
inside: { | ||
'standard-pattern-name': { | ||
pattern: /^[a-zA-Z0-9\-.]+/, | ||
alias: 'builtin', | ||
}, | ||
'quantifier': { | ||
pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/, | ||
alias: 'number', | ||
}, | ||
'standard-pattern-attr': { | ||
pattern: /[a-zA-Z0-9\-.]+/, | ||
alias: 'builtin', | ||
}, | ||
'punctuation': /[,()]/, | ||
}, | ||
}, | ||
'quantifier': { | ||
pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/, | ||
alias: 'number', | ||
}, | ||
'operator': [ | ||
{ | ||
pattern: /=/, | ||
alias: 'pattern-def', | ||
}, | ||
{ | ||
pattern: /&/, | ||
alias: 'conjunction', | ||
}, | ||
{ | ||
pattern: /~/, | ||
alias: 'exception', | ||
}, | ||
{ | ||
pattern: /\?/, | ||
alias: 'optionality', | ||
}, | ||
{ | ||
pattern: /[[\]]/, | ||
alias: 'repetition', | ||
}, | ||
{ | ||
pattern: /[{}]/, | ||
alias: 'variation', | ||
}, | ||
{ | ||
pattern: /[+_]/, | ||
alias: 'sequence', | ||
}, | ||
{ | ||
pattern: /\.{2,3}/, | ||
alias: 'span', | ||
}, | ||
], | ||
'field-capture': [ | ||
{ | ||
pattern: /([a-zA-Z0-9\-.]+\s*\()\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+(?:\s*,\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+)*(?=\s*\))/, | ||
lookbehind: true, | ||
inside: { | ||
'field-name': { | ||
pattern: /[a-zA-Z0-9\-.]+/, | ||
alias: 'variable', | ||
}, | ||
'colon': /:/, | ||
}, | ||
}, | ||
{ | ||
pattern: /[a-zA-Z0-9\-.]+\s*:/, | ||
inside: { | ||
'field-name': { | ||
pattern: /[a-zA-Z0-9\-.]+/, | ||
alias: 'variable', | ||
}, | ||
'colon': /:/, | ||
}, | ||
}, | ||
], | ||
'punctuation': /[:;,()]/, | ||
'name': /[a-zA-Z0-9\-.]+/ | ||
} |
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,59 @@ | ||
<h2>Comment</h2> | ||
<pre><code>/* This is | ||
multi-line | ||
comment */ | ||
// This is single-line comment</code></pre> | ||
|
||
<h2>String</h2> | ||
<pre><code>"text in double quotes" | ||
'text in single quotes' | ||
'case-sensitive text'! | ||
'text ''Nevod'' in quotes' | ||
"text ""Nevod"" in double quotes" | ||
'text prefix'* | ||
'case-sensitive text prefix'!*</code></pre> | ||
|
||
<h2>Keyword</h2> | ||
<pre><code>@inside | ||
@outside | ||
@having | ||
@search | ||
@where</code></pre> | ||
|
||
<h2>Package Import</h2> | ||
<pre><code>@require "Common/DateTime.np" | ||
@require "Common/Url.np"</code></pre> | ||
|
||
<h2>Namespace</h2> | ||
<pre><code>@namespace My { } | ||
@namespace My.Domain { }</code></pre> | ||
|
||
<h2>Pattern</h2> | ||
<pre><code>@pattern #Percentage = Num + ?Space + {'%', 'pct.', 'pct', 'percent'}; | ||
@pattern #GUID = Word(8) + [3 '-' + Word(4)] + '-' + Word(12); | ||
@pattern #HashTag = '#' + {AlphaNum, Alpha, '_'} + [0+ {Word, '_'}];</code></pre> | ||
|
||
<h2>Full Example</h2> | ||
<pre><code>@namespace Common | ||
{ | ||
@search @pattern Url(Domain, Path, Query, Anchor) = | ||
Method + Domain:Url.Domain + ?Port + ?Path:Url.Path + | ||
?Query:Url.Query + ?Anchor:Url.Anchor | ||
@where | ||
{ | ||
Method = {'http', 'https' , 'ftp', 'mailto', 'file', 'data', 'irc'} + '://'; | ||
Domain = Word + [1+ '.' + Word + [0+ {Word, '_', '-'}]]; | ||
Port = ':' + Num; | ||
Path = ?'/' + [0+ {Word, '/', '_', '+', '-', '%', '.'}]; | ||
Query = '?' + ?(Param + [0+ '&' + Param]) | ||
@where | ||
{ | ||
Param = Identifier + '=' + Identifier | ||
@where | ||
{ | ||
Identifier = {Alpha, AlphaNum, '_'} + [0+ {Word, '_'}]; | ||
}; | ||
}; | ||
Anchor(Value) = '#' + Value:{Word}; | ||
}; | ||
}</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
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 @@ | ||
/* Comment */ | ||
/* Multi-line | ||
comment */ | ||
/**/ | ||
// | ||
// Single-line comment | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "/* Comment */"], | ||
["comment", "/* Multi-line\r\ncomment */"], | ||
["comment", "/**/"], | ||
["comment", "//"], | ||
["comment", "// Single-line comment"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
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,15 @@ | ||
@require @namespace @pattern @search | ||
@inside @outside @having | ||
@where | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "@require"], ["keyword", "@namespace"], ["keyword", "@pattern"], ["keyword", "@search"], | ||
["keyword", "@inside"], ["keyword", "@outside"], ["keyword", "@having"], | ||
["keyword", "@where"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for all 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,25 @@ | ||
( , ) ; | ||
+ _ | ||
.. ... | ||
[ 0-5 ] | ||
& | ||
~ | ||
? | ||
{} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["punctuation", "("], ["punctuation", ","], ["punctuation", ")"], ["punctuation", ";"], | ||
["operator", "+"], ["operator", "_"], | ||
["operator", ".."], ["operator", "..."], | ||
["operator", "["], ["quantifier", "0-5"], ["operator", "]"], | ||
["operator", "&"], | ||
["operator", "~"], | ||
["operator", "?"], | ||
["operator", "{"], ["operator", "}"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for operators. |
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,27 @@ | ||
"text in double quotes" | ||
"" | ||
'text in single quotes' | ||
'case-sensitive text'! | ||
'text ''Nevod'' in quotes' | ||
"text ""Nevod"" in double quotes" | ||
'text prefix'* | ||
'case-sensitive text prefix'!* | ||
'' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string", ["\"text in double quotes\""]], | ||
["string", ["\"\""]], | ||
["string", ["'text in single quotes'"]], | ||
["string", ["'case-sensitive text'", ["string-attrs", "!"]]], | ||
["string", ["'text ''Nevod'' in quotes'"]], | ||
["string", ["\"text \"\"Nevod\"\" in double quotes\""]], | ||
["string", ["'text prefix'", ["string-attrs", "*"]]], | ||
["string", ["'case-sensitive text prefix'", ["string-attrs", "!*"]]], | ||
["string", ["''"]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for various text strings. |