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

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

components.json

+4
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

+32
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

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

examples/prism-false.html

+52
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

+5
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,
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.
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.
+26
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.
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
]
3+
4+
----------------------------------------------------
5+
6+
[
7+
["punctuation", "["],
8+
["punctuation", "]"]
9+
]
10+
11+
----------------------------------------------------
12+
13+
Checks for punctuation marks.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"
2+
"
3+
"!#$%&'*+,-./:;=>?@[\]^_`|~ßø"
4+
""
5+
""""
6+
"foo"
7+
"{}"
8+
9+
----------------------------------------------------
10+
11+
[
12+
["string", "\"\n\""],
13+
["string", "\"!#$%&'*+,-./:;=>?@[\\]^_`|~ßø\""],
14+
["string", "\"\""],
15+
["string", "\"\""], ["string", "\"\""],
16+
["string", "\"foo\""],
17+
["string", "\"{}\""]
18+
]
19+
20+
----------------------------------------------------
21+
22+
Checks for strings.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
a
2+
b
3+
c
4+
d
5+
e
6+
f
7+
g
8+
h
9+
i
10+
j
11+
k
12+
l
13+
m
14+
n
15+
o
16+
p
17+
q
18+
r
19+
s
20+
t
21+
u
22+
v
23+
w
24+
x
25+
y
26+
z
27+
zzz
28+
29+
----------------------------------------------------
30+
31+
[
32+
["variable", "a"],
33+
["variable", "b"],
34+
["variable", "c"],
35+
["variable", "d"],
36+
["variable", "e"],
37+
["variable", "f"],
38+
["variable", "g"],
39+
["variable", "h"],
40+
["variable", "i"],
41+
["variable", "j"],
42+
["variable", "k"],
43+
["variable", "l"],
44+
["variable", "m"],
45+
["variable", "n"],
46+
["variable", "o"],
47+
["variable", "p"],
48+
["variable", "q"],
49+
["variable", "r"],
50+
["variable", "s"],
51+
["variable", "t"],
52+
["variable", "u"],
53+
["variable", "v"],
54+
["variable", "w"],
55+
["variable", "x"],
56+
["variable", "y"],
57+
["variable", "z"],
58+
["variable", "z"], ["variable", "z"], ["variable", "z"]
59+
]
60+
61+
----------------------------------------------------
62+
63+
Checks for variables.

0 commit comments

Comments
 (0)