Skip to content

Commit 4d31e22

Browse files
authoredSep 11, 2020
Added support for Birb (#2542)
1 parent bfb3674 commit 4d31e22

12 files changed

+184
-2
lines changed
 

‎components.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎components.json

+5
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@
179179
},
180180
"owner": "RunDevelopment"
181181
},
182+
"birb": {
183+
"title": "Birb",
184+
"require": "clike",
185+
"owner": "Calamity210"
186+
},
182187
"bison": {
183188
"title": "Bison",
184189
"require": "c",

‎components/prism-birb.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Prism.languages.birb = Prism.languages.extend('clike', {
2+
'class-name': [
3+
/\b[A-Z](?:[\d_]*[a-zA-Z]\w*)?\b/,
4+
5+
// matches variable and function return types (parameters as well).
6+
/\b[A-Z]\w*(?=\s+\w+\s*[;,=()])/
7+
],
8+
'string': {
9+
pattern: /r?("|')(?:\\.|(?!\1)[^\\])*\1/,
10+
greedy: true
11+
},
12+
'keyword': /\b(?:assert|break|case|class|const|default|else|enum|final|follows|for|grab|if|nest|next|new|noSeeb|return|static|switch|throw|var|void|while)\b/,
13+
'variable': /\b[a-z_]\w*\b/,
14+
'operator': /\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?|:/,
15+
});
16+
17+
Prism.languages.insertBefore('birb','function',{
18+
'metadata': {
19+
pattern: /<\w+>/,
20+
greedy: true,
21+
alias: 'symbol'
22+
}
23+
});

‎components/prism-birb.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎examples/prism-birb.html

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<h2>Comments</h2>
2+
<pre><code>// Single line comment
3+
/* Block comment
4+
on multiple lines */</code></pre>
5+
6+
<h2>Annotations</h2>
7+
<pre><code>&lt;Supersede&gt; // marks an instance member as overriding a superclass</code></pre>
8+
9+
<h2>Numbers</h2>
10+
<pre><code>int x = 1;
11+
double y = 1.1;
12+
</code></pre>
13+
14+
<h2>Strings</h2>
15+
<pre><code>String s1 = 'Strings allow single quotes';
16+
String s2 = "as well as double quotes";
17+
var s2 = 'Birb strings are
18+
multiline by default';</code></pre>
19+
20+
<h2>Full example</h2>
21+
<pre><code>class Birb {
22+
final String name;
23+
int age = 19;
24+
25+
void construct(String newName){
26+
nest.name = newName;
27+
}
28+
}
29+
Birb.construct('Yoko');
30+
screm(Birb.name);
31+
</code></pre>

‎plugins/autoloader/prism-autoloader.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"markup",
1717
"csharp"
1818
],
19+
"birb": "clike",
1920
"bison": "c",
2021
"c": "clike",
2122
"csharp": "clike",

‎plugins/autoloader/prism-autoloader.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
void foo(int a) {}
2+
foo(0);
3+
4+
----------------------------------------------------
5+
6+
[
7+
["keyword", "void"],
8+
["function", "foo"],
9+
["punctuation", "("],
10+
["variable", "int"],
11+
["variable", "a"],
12+
["punctuation", ")"],
13+
["punctuation", "{"],
14+
["punctuation", "}"],
15+
16+
["function", "foo"],
17+
["punctuation", "("],
18+
["number", "0"],
19+
["punctuation", ")"],
20+
["punctuation", ";"]
21+
]
22+
23+
----------------------------------------------------
24+
25+
Checks for functions.
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
assert break case
2+
class;
3+
const default
4+
else enum
5+
final
6+
follows;
7+
for grab
8+
if nest
9+
next;
10+
new;
11+
noSeeb return
12+
static switch
13+
throw var
14+
void while
15+
16+
----------------------------------------------------
17+
18+
[
19+
["keyword", "assert"], ["keyword", "break"], ["keyword", "case"],
20+
["keyword", "class"], ["punctuation", ";"],
21+
["keyword", "const"], ["keyword", "default"],
22+
["keyword", "else"], ["keyword", "enum"],
23+
["keyword", "final"],
24+
["keyword", "follows"], ["punctuation", ";"],
25+
["keyword", "for"], ["keyword", "grab"],
26+
["keyword", "if"], ["keyword", "nest"],
27+
["keyword", "next"], ["punctuation", ";"],
28+
["keyword", "new"], ["punctuation", ";"],
29+
["keyword", "noSeeb"], ["keyword", "return"],
30+
["keyword", "static"], ["keyword", "switch"],
31+
["keyword", "throw"], ["keyword", "var"],
32+
["keyword", "void"], ["keyword", "while"]
33+
]
34+
35+
----------------------------------------------------
36+
37+
Checks for all keywords.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Supersede>
2+
3+
----------------------------------------------------
4+
5+
[
6+
["metadata", "<Supersede>"]
7+
]
8+
9+
----------------------------------------------------
10+
11+
Checks for metadata.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
++ --
2+
* / % ~/
3+
+ - ! ~
4+
<< >> ? :
5+
& ^ |
6+
>= > <= <
7+
== != && ||
8+
= *= /=
9+
%= += -=
10+
11+
----------------------------------------------------
12+
13+
[
14+
["operator", "++"], ["operator", "--"],
15+
["operator", "*"], ["operator", "/"], ["operator", "%"], ["operator", "~/"],
16+
["operator", "+"], ["operator", "-"], ["operator", "!"], ["operator", "~"],
17+
["operator", "<<"], ["operator", ">>"], ["operator", "?"], ["operator", ":"],
18+
["operator", "&"], ["operator", "^"], ["operator", "|"],
19+
["operator", ">="], ["operator", ">"], ["operator", "<="], ["operator", "<"],
20+
["operator", "=="], ["operator", "!="], ["operator", "&&"], ["operator", "||"],
21+
["operator", "="], ["operator", "*="], ["operator", "/="],
22+
["operator", "%="], ["operator", "+="], ["operator", "-="]
23+
]
24+
25+
----------------------------------------------------
26+
27+
Checks for all operators.
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"" ''
2+
r"" r''
3+
"fo\"o" 'fo\'o'
4+
'foo
5+
bar'
6+
"foo
7+
bar"
8+
9+
----------------------------------------------------
10+
11+
[
12+
["string", "\"\""], ["string", "''"],
13+
["string", "r\"\""], ["string", "r''"],
14+
["string", "\"fo\\\"o\""], ["string", "'fo\\'o'"],
15+
["string", "'foo\r\nbar'"],
16+
["string", "\"foo\r\nbar\""]
17+
]
18+
19+
----------------------------------------------------
20+
21+
Checks for single quoted, double quoted, and multiline strings

0 commit comments

Comments
 (0)
Please sign in to comment.