-
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.
Co-authored-by: Michael Schmidt <[email protected]> Co-authored-by: edukisto <[email protected]>
- Loading branch information
1 parent
cb5229a
commit 8a3fef6
Showing
20 changed files
with
1,044 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,99 @@ | ||
(function (Prism) { | ||
var escapes = /\\(?:["'\\abefnrtv]|0[0-7]{2}|U[\dA-Fa-f]{6}|u[\dA-Fa-f]{4}|x[\dA-Fa-f]{2})/; | ||
|
||
Prism.languages.odin = { | ||
/** | ||
* The current implementation supports only 1 level of nesting. | ||
* | ||
* @author Michael Schmidt | ||
* @author edukisto | ||
*/ | ||
'comment': [ | ||
{ | ||
pattern: /\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:\*(?!\/)|[^*])*(?:\*\/|$))*(?:\*\/|$)/, | ||
greedy: true | ||
}, | ||
{ | ||
pattern: /#![^\n\r]*/, | ||
greedy: true | ||
}, | ||
{ | ||
pattern: /\/\/[^\n\r]*/, | ||
greedy: true | ||
} | ||
], | ||
|
||
/** | ||
* Should be found before strings because of '"'"- and '`'`-like sequences. | ||
*/ | ||
'char': { | ||
pattern: /'(?:\\(?:.|[0Uux][0-9A-Fa-f]{1,6})|[^\n\r'\\])'/, | ||
greedy: true, | ||
inside: { | ||
'symbol': escapes | ||
} | ||
}, | ||
|
||
'string': [ | ||
{ | ||
pattern: /`[^`]*`/, | ||
greedy: true | ||
}, | ||
{ | ||
pattern: /"(?:\\.|[^\n\r"\\])*"/, | ||
greedy: true, | ||
inside: { | ||
'symbol': escapes | ||
} | ||
} | ||
], | ||
|
||
'directive': { | ||
pattern: /#\w+/, | ||
alias: 'property' | ||
}, | ||
|
||
'number': /\b0(?:b[01_]+|d[\d_]+|h_*(?:(?:(?:[\dA-Fa-f]_*){8}){1,2}|(?:[\dA-Fa-f]_*){4})|o[0-7_]+|x[\dA-F_a-f]+|z[\dAB_ab]+)\b|(?:\b\d+(?:\.(?!\.)\d*)?|\B\.\d+)(?:[Ee][+-]?\d*)?[ijk]?(?!\w)/, | ||
|
||
'discard': { | ||
pattern: /\b_\b/, | ||
alias: 'keyword' | ||
}, | ||
|
||
'procedure-definition': { | ||
pattern: /\b\w+(?=[ \t]*(?::\s*){2}proc\b)/, | ||
alias: 'function' | ||
}, | ||
|
||
'keyword': /\b(?:asm|auto_cast|bit_set|break|case|cast|context|continue|defer|distinct|do|dynamic|else|enum|fallthrough|for|foreign|if|import|in|map|matrix|not_in|or_else|or_return|package|proc|return|struct|switch|transmute|typeid|union|using|when|where)\b/, | ||
|
||
/** | ||
* false, nil, true can be used as procedure names. "_" and keywords can't. | ||
*/ | ||
'procedure-name': { | ||
pattern: /\b\w+(?=[ \t]*\()/, | ||
alias: 'function' | ||
}, | ||
|
||
'boolean': /\b(?:false|nil|true)\b/, | ||
|
||
'constant-parameter-sign': { | ||
pattern: /\$/, | ||
alias: 'important' | ||
}, | ||
|
||
'undefined': { | ||
pattern: /---/, | ||
alias: 'operator' | ||
}, | ||
|
||
'arrow': { | ||
pattern: /->/, | ||
alias: 'punctuation' | ||
}, | ||
|
||
'operator': /\+\+|--|\.\.[<=]?|(?:&~|[-!*+/=~]|[%&<>|]{1,2})=?|[?^]/, | ||
|
||
'punctuation': /[(),.:;@\[\]{}]/ | ||
}; | ||
}(Prism)); |
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,12 @@ | ||
<h2>Example</h2> | ||
|
||
<pre><code>package main | ||
|
||
import "core:fmt" | ||
|
||
main :: proc() { | ||
i: int | ||
for i := 0; i < 100; i += 1 { | ||
fmt.println(i, " bottles of beer on the wall.\n") | ||
} | ||
}</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
false | ||
nil | ||
true | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["boolean", "false"], | ||
["boolean", "nil"], | ||
["boolean", "true"] | ||
] |
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,147 @@ | ||
' ' | ||
'!' | ||
'"' | ||
'0' | ||
'\"' | ||
'\'' | ||
'\000' | ||
'\077' | ||
'\U000000' | ||
'\UFFFFFF' | ||
'\Uffffff' | ||
'\\' | ||
'\a' | ||
'\b' | ||
'\e' | ||
'\f' | ||
'\n' | ||
'\r' | ||
'\t' | ||
'\u0000' | ||
'\uFFFF' | ||
'\uffff' | ||
'\v' | ||
'\x00' | ||
'\xFF' | ||
'\xff' | ||
'a' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["char", ["' '"]], | ||
["char", ["'!'"]], | ||
["char", ["'\"'"]], | ||
["char", ["'0'"]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\\""], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\'"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\000"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\077"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\U000000"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\UFFFFFF"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\Uffffff"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\\\"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\a"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\b"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\e"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\f"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\n"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\r"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\t"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\u0000"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\uFFFF"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\uffff"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\v"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\x00"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\xFF"], | ||
"'" | ||
]], | ||
["char", [ | ||
"'", | ||
["symbol", "\\xff"], | ||
"'" | ||
]], | ||
["char", ["'a'"]] | ||
] |
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,92 @@ | ||
#! | ||
#! A comment | ||
#!! | ||
#!"" | ||
#!#! | ||
#!' ' | ||
#!/**/ | ||
#!// | ||
#!0 | ||
#!`` | ||
#!false | ||
#!if | ||
/* | ||
*/ | ||
/* 1 /* 2 */ 1 */ | ||
/* A comment */ | ||
/*!*/ | ||
/*""*/ | ||
/*"\a"*/ | ||
/*#!*/ | ||
/*' '*/ | ||
/*'\a'*/ | ||
/**/ | ||
/*/**/*/ | ||
/*0*/ | ||
/*`\a`*/ | ||
/*``*/ | ||
/*false*/ | ||
/*if*/ | ||
// | ||
// A comment | ||
//! | ||
//"" | ||
//#! | ||
//' ' | ||
///**/ | ||
//// | ||
//0 | ||
//`` | ||
//false | ||
//if | ||
Not a comment #! A comment | ||
Not a comment /* A comment */ | ||
Not a comment // A comment | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "#!"], | ||
["comment", "#! A comment"], | ||
["comment", "#!!"], | ||
["comment", "#!\"\""], | ||
["comment", "#!#!"], | ||
["comment", "#!' '"], | ||
["comment", "#!/**/"], | ||
["comment", "#!//"], | ||
["comment", "#!0"], | ||
["comment", "#!``"], | ||
["comment", "#!false"], | ||
["comment", "#!if"], | ||
["comment", "/*\r\n*/"], | ||
["comment", "/* 1 /* 2 */ 1 */"], | ||
["comment", "/* A comment */"], | ||
["comment", "/*!*/"], | ||
["comment", "/*\"\"*/"], | ||
["comment", "/*\"\\a\"*/"], | ||
["comment", "/*#!*/"], | ||
["comment", "/*' '*/"], | ||
["comment", "/*'\\a'*/"], | ||
["comment", "/**/"], | ||
["comment", "/*/**/*/"], | ||
["comment", "/*0*/"], | ||
["comment", "/*`\\a`*/"], | ||
["comment", "/*``*/"], | ||
["comment", "/*false*/"], | ||
["comment", "/*if*/"], | ||
["comment", "//"], | ||
["comment", "// A comment"], | ||
["comment", "//!"], | ||
["comment", "//\"\""], | ||
["comment", "//#!"], | ||
["comment", "//' '"], | ||
["comment", "///**/"], | ||
["comment", "////"], | ||
["comment", "//0"], | ||
["comment", "//``"], | ||
["comment", "//false"], | ||
["comment", "//if"], | ||
"\r\nNot a comment ", ["comment", "#! A comment"], | ||
"\r\nNot a comment ", ["comment", "/* A comment */"], | ||
"\r\nNot a comment ", ["comment", "// A comment"] | ||
] |
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,7 @@ | ||
$ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["constant-parameter-sign", "$"] | ||
] |
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,9 @@ | ||
#assert | ||
#no_bounds_check | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive", "#assert"], | ||
["directive", "#no_bounds_check"] | ||
] |
Oops, something went wrong.