Added support for False (#2802)

This commit is contained in:
edukisto 2021-03-13 18:11:19 +03:00 committed by GitHub
parent a68f1fb6e2
commit 99a21dc52b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 307 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -396,6 +396,10 @@
"title": "Factor",
"owner": "catb0t"
},
"false": {
"title": "False",
"owner": "edukisto"
},
"firestore-security-rules": {
"title": "Firestore security rules",
"require": "clike",

32
components/prism-false.js Normal file
View File

@ -0,0 +1,32 @@
(function (Prism) {
/**
* Based on the manual by Wouter van Oortmerssen.
*
* @see {@link https://github.com/PrismJS/prism/issues/2801#issue-829717504}
*/
Prism.languages['false'] = {
'comment': {
pattern: /\{[^}]*\}/
},
'string': {
pattern: /"[^"]*"/,
greedy: true
},
'character-code': {
pattern: /'[\S\s]/,
alias: 'number'
},
'assembler-code': {
pattern: /\d+`/,
alias: 'important'
},
'number': /\d+/,
'operator': /[-!#$%&'*+,./:;=>?@\\^_`|~ßø]/,
'punctuation': /\[|\]/,
'variable': /[a-z]/,
'non-standard': {
pattern: /[()<BDO®]/,
alias: 'bold'
}
};
}(Prism));

1
components/prism-false.min.js vendored Normal file
View File

@ -0,0 +1 @@
Prism.languages.false={comment:{pattern:/\{[^}]*\}/},string:{pattern:/"[^"]*"/,greedy:!0},"character-code":{pattern:/'[\S\s]/,alias:"number"},"assembler-code":{pattern:/\d+`/,alias:"important"},number:/\d+/,operator:/[-!#$%&'*+,./:;=>?@\\^_`|~ßø]/,punctuation:/\[|\]/,variable:/[a-z]/,"non-standard":{pattern:/[()<BDO®]/,alias:"bold"}};

52
examples/prism-false.html Normal file
View File

@ -0,0 +1,52 @@
<h2>Hello, world!</h2>
<pre><code>"Hello, world!"</code></pre>
<h2>Lambda functions</h2>
<h3>Increment</h3>
<pre><code>5 [7+]! . {Outputs 12.}</code></pre>
<h3>Square numbers</h3>
<pre><code>[$*] s: 7s;! . {Outputs 49.}</code></pre>
<h2>Conditions</h2>
<h3>Equal, less, or greater than</h3>
<pre><code>5x:
7y:
x;y;=
$
x;
.
[" equals "]?
~[
x;y;>
$
[" is greater than "]?
~[" is less than "]?
]?
y;
.</code></pre>
<h2>Loops</h2>
<h3>English alphabet</h3>
<pre><code>'Ai: 'Zm: 1m;+ m: [m;i;>][i;, 1i;+ i:]#</code></pre>
<h3>Ten Green Bottles</h3>
<pre><code>[$ . " green bottle" 1> ["s"]? ".
"] f:
10n: [n;0>][n;f;! n;1- n:]#</code></pre>
<h2>User input</h2>
<h3>Reverse a string</h3>
<pre><code>"Enter the string character by character (or a space to finish):
"0i: [ß ^ $ 32=~][i;1+ i:]# % "Reverse: " [i;0>][, i;1- i:]#</code></pre>

View File

@ -35,6 +35,11 @@ const testOptions = {
template: false
},
'false': {
word: false,
template: false
},
// LilyPond doesn't tokenize based on words
'lilypond': {
word: false,

View File

@ -0,0 +1,13 @@
0`
65535`
----------------------------------------------------
[
["assembler-code", "0`"],
["assembler-code", "65535`"]
]
----------------------------------------------------
Checks for assembler codes.

View File

@ -0,0 +1,16 @@
'
'
'
''
----------------------------------------------------
[
["character-code", "'\n"], ["character-code", "'\t"],
["character-code", "' "],
["character-code", "''"]
]
----------------------------------------------------
Checks for character codes.

View File

@ -0,0 +1,26 @@
{
}
{!#$%&'*+,-./:;=>?@[\]^_`|~ßø}
{""}
{foo}
{{}
{}
{}{}
{}}
----------------------------------------------------
[
["comment", "{\n}"],
["comment", "{!#$%&'*+,-./:;=>?@[\\]^_`|~ßø}"],
["comment", "{\"\"}"],
["comment", "{foo}"],
["comment", "{{}"],
["comment", "{}"],
["comment", "{}"], ["comment", "{}"],
["comment", "{}"], "}"
]
----------------------------------------------------
Checks for comments.

View File

@ -0,0 +1,59 @@
!
#
$
%
&
*
+
,
-
.
/
:
;
=
>
?
@
\
^
_
`
|
~
ß
ø
----------------------------------------------------
[
["operator", "!"],
["operator", "#"],
["operator", "$"],
["operator", "%"],
["operator", "&"],
["operator", "*"],
["operator", "+"],
["operator", ","],
["operator", "-"],
["operator", "."],
["operator", "/"],
["operator", ":"],
["operator", ";"],
["operator", "="],
["operator", ">"],
["operator", "?"],
["operator", "@"],
["operator", "\\"],
["operator", "^"],
["operator", "_"],
["operator", "`"],
["operator", "|"],
["operator", "~"],
["operator", "ß"],
["operator", "ø"]
]
----------------------------------------------------
Checks for operators.

View File

@ -0,0 +1,13 @@
[
]
----------------------------------------------------
[
["punctuation", "["],
["punctuation", "]"]
]
----------------------------------------------------
Checks for punctuation marks.

View File

@ -0,0 +1,22 @@
"
"
"!#$%&'*+,-./:;=>?@[\]^_`|~ßø"
""
""""
"foo"
"{}"
----------------------------------------------------
[
["string", "\"\n\""],
["string", "\"!#$%&'*+,-./:;=>?@[\\]^_`|~ßø\""],
["string", "\"\""],
["string", "\"\""], ["string", "\"\""],
["string", "\"foo\""],
["string", "\"{}\""]
]
----------------------------------------------------
Checks for strings.

View File

@ -0,0 +1,63 @@
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
zzz
----------------------------------------------------
[
["variable", "a"],
["variable", "b"],
["variable", "c"],
["variable", "d"],
["variable", "e"],
["variable", "f"],
["variable", "g"],
["variable", "h"],
["variable", "i"],
["variable", "j"],
["variable", "k"],
["variable", "l"],
["variable", "m"],
["variable", "n"],
["variable", "o"],
["variable", "p"],
["variable", "q"],
["variable", "r"],
["variable", "s"],
["variable", "t"],
["variable", "u"],
["variable", "v"],
["variable", "w"],
["variable", "x"],
["variable", "y"],
["variable", "z"],
["variable", "z"], ["variable", "z"], ["variable", "z"]
]
----------------------------------------------------
Checks for variables.