Skip to content

Commit 99a21dc

Browse files
authored
Added support for False (#2802)
1 parent a68f1fb commit 99a21dc

13 files changed

+307
-1
lines changed

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@
396396
"title": "Factor",
397397
"owner": "catb0t"
398398
},
399+
"false": {
400+
"title": "False",
401+
"owner": "edukisto"
402+
},
399403
"firestore-security-rules": {
400404
"title": "Firestore security rules",
401405
"require": "clike",

components/prism-false.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
(function (Prism) {
2+
/**
3+
* Based on the manual by Wouter van Oortmerssen.
4+
*
5+
* @see {@link https://github.com/PrismJS/prism/issues/2801#issue-829717504}
6+
*/
7+
Prism.languages['false'] = {
8+
'comment': {
9+
pattern: /\{[^}]*\}/
10+
},
11+
'string': {
12+
pattern: /"[^"]*"/,
13+
greedy: true
14+
},
15+
'character-code': {
16+
pattern: /'[\S\s]/,
17+
alias: 'number'
18+
},
19+
'assembler-code': {
20+
pattern: /\d+`/,
21+
alias: 'important'
22+
},
23+
'number': /\d+/,
24+
'operator': /[-!#$%&'*+,./:;=>?@\\^_`|~ßø]/,
25+
'punctuation': /\[|\]/,
26+
'variable': /[a-z]/,
27+
'non-standard': {
28+
pattern: /[()<BDO®]/,
29+
alias: 'bold'
30+
}
31+
};
32+
}(Prism));

components/prism-false.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-false.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<h2>Hello, world!</h2>
2+
3+
<pre><code>"Hello, world!"</code></pre>
4+
5+
<h2>Lambda functions</h2>
6+
7+
<h3>Increment</h3>
8+
9+
<pre><code>5 [7+]! . {Outputs 12.}</code></pre>
10+
11+
<h3>Square numbers</h3>
12+
13+
<pre><code>[$*] s: 7s;! . {Outputs 49.}</code></pre>
14+
15+
<h2>Conditions</h2>
16+
17+
<h3>Equal, less, or greater than</h3>
18+
19+
<pre><code>5x:
20+
7y:
21+
x;y;=
22+
$
23+
x;
24+
.
25+
[" equals "]?
26+
~[
27+
x;y;>
28+
$
29+
[" is greater than "]?
30+
~[" is less than "]?
31+
]?
32+
y;
33+
.</code></pre>
34+
35+
<h2>Loops</h2>
36+
37+
<h3>English alphabet</h3>
38+
39+
<pre><code>'Ai: 'Zm: 1m;+ m: [m;i;>][i;, 1i;+ i:]#</code></pre>
40+
41+
<h3>Ten Green Bottles</h3>
42+
43+
<pre><code>[$ . " green bottle" 1> ["s"]? ".
44+
"] f:
45+
10n: [n;0>][n;f;! n;1- n:]#</code></pre>
46+
47+
<h2>User input</h2>
48+
49+
<h3>Reverse a string</h3>
50+
51+
<pre><code>"Enter the string character by character (or a space to finish):
52+
"0i: [ß ^ $ 32=~][i;1+ i:]# % "Reverse: " [i;0>][, i;1- i:]#</code></pre>

tests/identifier-test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ const testOptions = {
3535
template: false
3636
},
3737

38+
'false': {
39+
word: false,
40+
template: false
41+
},
42+
3843
// LilyPond doesn't tokenize based on words
3944
'lilypond': {
4045
word: false,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
0`
2+
65535`
3+
4+
----------------------------------------------------
5+
6+
[
7+
["assembler-code", "0`"],
8+
["assembler-code", "65535`"]
9+
]
10+
11+
----------------------------------------------------
12+
13+
Checks for assembler codes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'
2+
'
3+
'
4+
''
5+
6+
----------------------------------------------------
7+
8+
[
9+
["character-code", "'\n"], ["character-code", "'\t"],
10+
["character-code", "' "],
11+
["character-code", "''"]
12+
]
13+
14+
----------------------------------------------------
15+
16+
Checks for character codes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
}
3+
{!#$%&'*+,-./:;=>?@[\]^_`|~ßø}
4+
{""}
5+
{foo}
6+
{{}
7+
{}
8+
{}{}
9+
{}}
10+
11+
----------------------------------------------------
12+
13+
[
14+
["comment", "{\n}"],
15+
["comment", "{!#$%&'*+,-./:;=>?@[\\]^_`|~ßø}"],
16+
["comment", "{\"\"}"],
17+
["comment", "{foo}"],
18+
["comment", "{{}"],
19+
["comment", "{}"],
20+
["comment", "{}"], ["comment", "{}"],
21+
["comment", "{}"], "}"
22+
]
23+
24+
----------------------------------------------------
25+
26+
Checks for comments.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
!
2+
#
3+
$
4+
%
5+
&
6+
*
7+
+
8+
,
9+
-
10+
.
11+
/
12+
:
13+
;
14+
=
15+
>
16+
?
17+
@
18+
\
19+
^
20+
_
21+
`
22+
|
23+
~
24+
ß
25+
ø
26+
27+
----------------------------------------------------
28+
29+
[
30+
["operator", "!"],
31+
["operator", "#"],
32+
["operator", "$"],
33+
["operator", "%"],
34+
["operator", "&"],
35+
["operator", "*"],
36+
["operator", "+"],
37+
["operator", ","],
38+
["operator", "-"],
39+
["operator", "."],
40+
["operator", "/"],
41+
["operator", ":"],
42+
["operator", ";"],
43+
["operator", "="],
44+
["operator", ">"],
45+
["operator", "?"],
46+
["operator", "@"],
47+
["operator", "\\"],
48+
["operator", "^"],
49+
["operator", "_"],
50+
["operator", "`"],
51+
["operator", "|"],
52+
["operator", "~"],
53+
["operator", "ß"],
54+
["operator", "ø"]
55+
]
56+
57+
----------------------------------------------------
58+
59+
Checks for operators.

0 commit comments

Comments
 (0)