-
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.
Showing
13 changed files
with
518 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,74 @@ | ||
Prism.languages.vala = Prism.languages.extend('clike', { | ||
// Classes copied from prism-csharp | ||
'class-name': [ | ||
{ | ||
// (Foo bar, Bar baz) | ||
pattern: /\b[A-Z]\w*(?:\.\w+)*\b(?=(?:\?\s+|\*?\s+\*?)\w+)/, | ||
inside: { | ||
punctuation: /\./ | ||
} | ||
}, | ||
{ | ||
// [Foo] | ||
pattern: /(\[)[A-Z]\w*(?:\.\w+)*\b/, | ||
lookbehind: true, | ||
inside: { | ||
punctuation: /\./ | ||
} | ||
}, | ||
{ | ||
// class Foo : Bar | ||
pattern: /(\b(?:class|interface)\s+[A-Z]\w*(?:\.\w+)*\s*:\s*)[A-Z]\w*(?:\.\w+)*\b/, | ||
lookbehind: true, | ||
inside: { | ||
punctuation: /\./ | ||
} | ||
}, | ||
{ | ||
// class Foo | ||
pattern: /((?:\b(?:class|interface|new|struct|enum)\s+)|(?:catch\s+\())[A-Z]\w*(?:\.\w+)*\b/, | ||
lookbehind: true, | ||
inside: { | ||
punctuation: /\./ | ||
} | ||
} | ||
], | ||
'constant': /\b[A-Z0-9_]+\b/, | ||
'function': /\w+(?=\s*\()/, | ||
'keyword': /\b(?:bool|char|double|float|null|size_t|ssize_t|string|unichar|void|int|int8|int16|int32|int64|long|short|uchar|uint|uint8|uint16|uint32|uint64|ulong|ushort|class|delegate|enum|errordomain|interface|namespace|struct|break|continue|do|for|foreach|return|while|else|if|switch|assert|case|default|abstract|const|dynamic|ensures|extern|inline|internal|override|private|protected|public|requires|signal|static|virtual|volatile|weak|async|owned|unowned|try|catch|finally|throw|as|base|construct|delete|get|in|is|lock|new|out|params|ref|sizeof|set|this|throws|typeof|using|value|var|yield)\b/i, | ||
'number': /(?:\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)(?:f|u?l?)?/i, | ||
'operator': /\+\+|--|&&|\|\||<<=?|>>=?|=>|->|~|[+\-*\/%&^|=!<>]=?|\?\??|\.\.\./, | ||
'punctuation': /[{}[\];(),.:]/ | ||
}); | ||
|
||
Prism.languages.insertBefore('vala','string', { | ||
'raw-string': { | ||
pattern: /"""[\s\S]*?"""/, | ||
greedy: true, | ||
alias: 'string' | ||
}, | ||
'template-string': { | ||
pattern: /@"[\s\S]*?"/, | ||
greedy: true, | ||
inside: { | ||
'interpolation': { | ||
pattern: /\$(?:\([^)]*\)|[a-zA-Z]\w*)/, | ||
inside: { | ||
'delimiter': { | ||
pattern: /^\$\(?|\)$/, | ||
alias: 'punctuation' | ||
}, | ||
rest: Prism.languages.vala | ||
} | ||
}, | ||
'string': /[\s\S]+/ | ||
} | ||
} | ||
}); | ||
|
||
Prism.languages.insertBefore('vala', 'keyword', { | ||
'regex': { | ||
pattern: /\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[imsx]{0,4}(?=\s*($|[\r\n,.;})\]]))/, | ||
greedy: true | ||
} | ||
}); |
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,33 @@ | ||
<h2>Comments</h2> | ||
<pre><code">// Single line comment | ||
/** Multi-line | ||
doc comment */</code></pre> | ||
|
||
<h2>Strings</h2> | ||
<pre><code">"foo \"bar\" baz" | ||
"Multi-line strings ending with a \ | ||
are supported too." | ||
"""Verbatim strings | ||
You can create | ||
multi-line strings like this too.""" | ||
@"Template string with variables $var1 $(var2 * 2)"</code></pre> | ||
|
||
<h2>Regex</h2> | ||
<pre><code">/foo?[ ]*bar/</code></pre> | ||
|
||
<h2>Full example</h2> | ||
<pre><code">using Gtk; | ||
|
||
int main (string[] args) { | ||
Gtk.init(ref args); | ||
|
||
var window = new Window(); | ||
|
||
var button = new Button.with_label("Click me!"); | ||
|
||
window.add(button); | ||
window.show_all(); | ||
|
||
Gtk.main(); | ||
return 0; | ||
}</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,37 @@ | ||
class Foo | ||
enum Bar | ||
interface BarBaz | ||
class Foo : Bar | ||
[Foobar] | ||
void Foo(Bar bar, Baz baz) | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "class"], | ||
["class-name", ["Foo"]], | ||
["keyword", "enum"], | ||
["class-name", ["Bar"]], | ||
["keyword", "interface"], | ||
["class-name", ["BarBaz"]], | ||
["keyword", "class"], | ||
["class-name", ["Foo"]], | ||
["punctuation", ":"], | ||
["class-name", ["Bar"]], | ||
["punctuation", "["], | ||
["class-name", ["Foobar"]], | ||
["punctuation", "]"], | ||
["keyword", "void"], | ||
["function", "Foo"], | ||
["punctuation", "("], | ||
["class-name", ["Bar"]], | ||
" bar", | ||
["punctuation", ","], | ||
["class-name", ["Baz"]], | ||
" baz", | ||
["punctuation", ")"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for class names. |
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,189 @@ | ||
bool | ||
char | ||
double | ||
float | ||
null | ||
size_t | ||
ssize_t | ||
string | ||
unichar | ||
void | ||
int | ||
int8 | ||
int16 | ||
int32 | ||
int64 | ||
long | ||
short | ||
uchar | ||
uint | ||
uint8 | ||
uint16 | ||
uint32 | ||
uint64 | ||
ulong | ||
ushort | ||
class | ||
delegate | ||
enum | ||
errordomain | ||
interface | ||
namespace | ||
struct | ||
break | ||
continue | ||
do | ||
for | ||
foreach | ||
return | ||
while | ||
else | ||
if | ||
switch | ||
assert | ||
case | ||
default | ||
abstract | ||
const | ||
dynamic | ||
ensures | ||
extern | ||
inline | ||
internal | ||
override | ||
private | ||
protected | ||
public | ||
requires | ||
signal | ||
static | ||
virtual | ||
volatile | ||
weak | ||
async | ||
owned | ||
unowned | ||
try | ||
catch | ||
finally | ||
throw | ||
as | ||
base | ||
construct | ||
delete | ||
get | ||
in | ||
is | ||
lock | ||
new | ||
out | ||
params | ||
ref | ||
sizeof | ||
set | ||
this | ||
throws | ||
typeof | ||
using | ||
value | ||
var | ||
yield | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "bool"], | ||
["keyword", "char"], | ||
["keyword", "double"], | ||
["keyword", "float"], | ||
["keyword", "null"], | ||
["keyword", "size_t"], | ||
["keyword", "ssize_t"], | ||
["keyword", "string"], | ||
["keyword", "unichar"], | ||
["keyword", "void"], | ||
["keyword", "int"], | ||
["keyword", "int8"], | ||
["keyword", "int16"], | ||
["keyword", "int32"], | ||
["keyword", "int64"], | ||
["keyword", "long"], | ||
["keyword", "short"], | ||
["keyword", "uchar"], | ||
["keyword", "uint"], | ||
["keyword", "uint8"], | ||
["keyword", "uint16"], | ||
["keyword", "uint32"], | ||
["keyword", "uint64"], | ||
["keyword", "ulong"], | ||
["keyword", "ushort"], | ||
["keyword", "class"], | ||
["keyword", "delegate"], | ||
["keyword", "enum"], | ||
["keyword", "errordomain"], | ||
["keyword", "interface"], | ||
["keyword", "namespace"], | ||
["keyword", "struct"], | ||
["keyword", "break"], | ||
["keyword", "continue"], | ||
["keyword", "do"], | ||
["keyword", "for"], | ||
["keyword", "foreach"], | ||
["keyword", "return"], | ||
["keyword", "while"], | ||
["keyword", "else"], | ||
["keyword", "if"], | ||
["keyword", "switch"], | ||
["keyword", "assert"], | ||
["keyword", "case"], | ||
["keyword", "default"], | ||
["keyword", "abstract"], | ||
["keyword", "const"], | ||
["keyword", "dynamic"], | ||
["keyword", "ensures"], | ||
["keyword", "extern"], | ||
["keyword", "inline"], | ||
["keyword", "internal"], | ||
["keyword", "override"], | ||
["keyword", "private"], | ||
["keyword", "protected"], | ||
["keyword", "public"], | ||
["keyword", "requires"], | ||
["keyword", "signal"], | ||
["keyword", "static"], | ||
["keyword", "virtual"], | ||
["keyword", "volatile"], | ||
["keyword", "weak"], | ||
["keyword", "async"], | ||
["keyword", "owned"], | ||
["keyword", "unowned"], | ||
["keyword", "try"], | ||
["keyword", "catch"], | ||
["keyword", "finally"], | ||
["keyword", "throw"], | ||
["keyword", "as"], | ||
["keyword", "base"], | ||
["keyword", "construct"], | ||
["keyword", "delete"], | ||
["keyword", "get"], | ||
["keyword", "in"], | ||
["keyword", "is"], | ||
["keyword", "lock"], | ||
["keyword", "new"], | ||
["keyword", "out"], | ||
["keyword", "params"], | ||
["keyword", "ref"], | ||
["keyword", "sizeof"], | ||
["keyword", "set"], | ||
["keyword", "this"], | ||
["keyword", "throws"], | ||
["keyword", "typeof"], | ||
["keyword", "using"], | ||
["keyword", "value"], | ||
["keyword", "var"], | ||
["keyword", "yield"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
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,27 @@ | ||
42 | ||
3.14159 | ||
5ul | ||
0.75f | ||
4e10 | ||
2.1e-10 | ||
0.4e+2 | ||
0xbabe | ||
0xBABE | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["number", "42"], | ||
["number", "3.14159"], | ||
["number", "5ul"], | ||
["number", "0.75f"], | ||
["number", "4e10"], | ||
["number", "2.1e-10"], | ||
["number", "0.4e+2"], | ||
["number", "0xbabe"], | ||
["number", "0xBABE"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for decimal numbers and hexadecimal numbers. |
Oops, something went wrong.