This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprism-phoo.js
75 lines (74 loc) · 2.46 KB
/
prism-phoo.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////// added by me //////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
Prism.languages.phoo = {
comment: [
{
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true,
greedy: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
punctuation: {
pattern: /(\s|^)([\[\]]|do|end)(?=\s|$)/,
lookbehind: true,
},
boolean: {
pattern: /(\s|^)(true|false)(?=\s|$)/,
lookbehind: true,
},
number: [
{
pattern: /(\s|^)[-+]?(([0-9]*\.?[0-9]+([Ee][-+]?[0-9]+)?)|(Infinity)|(NaN))(?=\s|$)/,
lookbehind: true,
},
{
pattern: /(\s|^)[-+]?(?:(?:0x[0-9a-f]+)|(?:[0-9]+))n?(?=\s|$)/i,
lookbehind: true,
},
{
pattern: /(\s|^)[0-9]{1,2}#[a-z0-9]+(-n)?(?=\s|$)/i,
lookbehind: true,
},
],
'function-name': {
pattern: /((\s|^)(to|macro|alias)\s+)\S+(?=\s|$)/,
lookbehind: true,
},
builtin: [
{
pattern: /(\s|^)(to|macro|alias|pick|roll|2?drop|1?[+-]|\*\*?|[/&|^~=<>]|negate|\/?mod|nand|<<|>>|put|take|lower|upper|\+\+|\[]|\{}|concat|split|peek|poke|find|die|num>\$|\$>num|chr|type|big|compile|time|nestdepth|get|set|call@?|await|new@?|word|name|resolve|self|stacksize|window|promise|functionize)(?=\s|$)/,
lookbehind: true,
},
{
pattern: /(\s|^)(protect|noop|2?dup|2?over|2?swap|rot|unrot|nip|tuck|pack|unpack|dip|abs|\/~|[!<>]=|min|max|clamp|within|\$[<>]|not|and|or|xor|bit|release|copy|replace|move|tally|this|run|recurse|i\^?|n?range|step|restart|break|printable\?|trim|nextword|split\$|nested|len|pluck|stuff|behead|join|of|reverse\$?|reflect|makewith|witheach|foldr?|map|filter|matchitem|findwith|findseq|found\?|sortwith|sort\$?|(to|new|now|not)-do|do-now|add-to|ord|isa\?|isoneof\?|stringify|arayify|phoo|new!|!!todo!!)(?=\s|$)/,
lookbehind: true,
}
],
symbol: {
pattern: /(\s|^)(stack|table|const|now!|var,?|is)(?=\s|$)/,
lookbehind: true,
},
keyword: {
pattern: /(\s|^)(done|again|iff?|else|until|while|switch|case|default|'|times|try|in_scope|(?:re)?use)(?=\s|$)/,
lookbehind: true,
},
meta: {
alias: 'tag',
pattern: /(\s|^)\]\S+\[(?=\s|$)/,
lookbehind: true,
},
string: {
pattern: /(\s|^)\$\s+(\S)((?!\2)[\s\S])+?\2\S*(?=\s|$)/,
lookbehind: true,
},
'attr-value': {
pattern: /(\s|^)\.\S+(?=\s|$)/,
lookbehind: true,
}
};