Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Arturo #3403

Merged
merged 73 commits into from Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
2c24ce8
add initial Arturo component
drkameleon Mar 19, 2022
835c858
add initial Arturo example file
drkameleon Mar 19, 2022
f1c7cf4
added Arturo components list
drkameleon Mar 19, 2022
ec1c4ae
added proper Arturo example (full example from "In A Nutshell" section)
drkameleon Mar 19, 2022
f4505cf
added test for comments
drkameleon Mar 19, 2022
0c4e6e4
added alias to components.json
drkameleon Mar 19, 2022
6b6d155
properly escape `<`s & `>`s in example
drkameleon Mar 19, 2022
aa917cf
added initial definitions
drkameleon Mar 19, 2022
8fba5b5
re-build
drkameleon Mar 19, 2022
fef38e1
added complete syntax support
drkameleon Mar 19, 2022
05deb9a
added more tests
drkameleon Mar 19, 2022
c64206d
added another test
drkameleon Mar 19, 2022
746de83
updated syntax
drkameleon Mar 19, 2022
5f10fdb
rebuild
drkameleon Mar 19, 2022
fd9bcdd
fixed lint error: '\-' already covered
drkameleon Mar 19, 2022
f102467
fixed: added + updated tests for `keyword1` & `keyword2`
drkameleon Mar 19, 2022
9db621e
minor fix: removed redundant keywords
drkameleon Mar 19, 2022
5596e04
rebuild
drkameleon Mar 19, 2022
e2f6cc7
removed unnecessary indentation from example
drkameleon Mar 19, 2022
7b86d78
updated pattern for symbols
drkameleon Mar 19, 2022
92f3075
updated aliases using standard tokens
drkameleon Mar 19, 2022
a083b26
rebuild
drkameleon Mar 19, 2022
162b2cd
lint: minor fixes
drkameleon Mar 19, 2022
81281dd
rebuild
drkameleon Mar 19, 2022
a20cc4e
add `true`, `maybe`, `false` as a separate entity (boolean)
drkameleon Mar 19, 2022
2867f1f
updated keyword2_test (to remove the boolean values)
drkameleon Mar 19, 2022
6391758
added separate test for boolean values
drkameleon Mar 19, 2022
884be38
added pattern for number values (covers `:integer`, `:floating` & `:v…
drkameleon Mar 19, 2022
0e4b7f8
re-order rules
drkameleon Mar 19, 2022
de839fd
updated test for booleans (removed redundant trailing comma)
drkameleon Mar 19, 2022
304838d
added test for numbers
drkameleon Mar 19, 2022
3e88e42
minor fix
drkameleon Mar 19, 2022
6bb2a0e
updated string regex
drkameleon Mar 19, 2022
4964962
added pattern for `:regex` values
drkameleon Mar 19, 2022
faff3a0
added test for regexes
drkameleon Mar 19, 2022
f7d8af8
added newline at the end
drkameleon Mar 19, 2022
0240560
removed redundant escapes
drkameleon Mar 19, 2022
980019c
rebuild
drkameleon Mar 19, 2022
5228904
better string support
drkameleon Mar 19, 2022
c39080d
added support for curly strings
drkameleon Mar 19, 2022
62b33d0
added test for curly strings
drkameleon Mar 19, 2022
fbdfae9
rebuild
drkameleon Mar 19, 2022
f821de0
removed trailing spaces
drkameleon Mar 19, 2022
5c2f306
fixed regex for numbers
drkameleon Mar 19, 2022
fcfeae1
rebuild
drkameleon Mar 19, 2022
96eedbe
added support for curly strings with embedded code highlighting
drkameleon Mar 19, 2022
7cb8cbf
Update components/prism-arturo.js
drkameleon Mar 19, 2022
95386aa
Merge branch 'master' of https://github.com/drkameleon/prism
drkameleon Mar 19, 2022
6b64a3e
added tests for curly strings with embedded syntaxes
drkameleon Mar 19, 2022
0ffa70f
added better support for `:version` values
drkameleon Mar 19, 2022
a525afd
updated tests
drkameleon Mar 19, 2022
32cf13c
renamed tests
drkameleon Mar 19, 2022
7d5ff0c
renamed `keyword1` & `keyword2` + minor fixes
drkameleon Mar 19, 2022
58847c5
updated tests
drkameleon Mar 19, 2022
e67ad20
rebuild
drkameleon Mar 19, 2022
9e4bc17
wrap code into iife
drkameleon Mar 21, 2022
2333771
added optional dependencies
drkameleon Mar 21, 2022
134411f
move embedded-syntax string tests to separate folders
drkameleon Mar 21, 2022
9daf9ee
added support for `:color` literal values
drkameleon Mar 21, 2022
f0844d9
added test for colors
drkameleon Mar 21, 2022
8b1440f
added support for punctuation
drkameleon Mar 21, 2022
9df62ec
added tests for punctuation
drkameleon Mar 21, 2022
510435a
added missing comma
drkameleon Mar 21, 2022
083928f
fixed expected tokens for embedded-syntax string tests
drkameleon Mar 21, 2022
37a50bd
rebuild
drkameleon Mar 21, 2022
c9f83d0
changed aliases so that we - semantically - abide by the Standard Tok…
drkameleon Mar 21, 2022
84c0ef1
rebuild
drkameleon Mar 21, 2022
15ac1d7
renamed `sh` to `shell`
drkameleon Mar 21, 2022
1bc2aca
remove
drkameleon Mar 21, 2022
6a82cfe
Merge branch 'master' of https://github.com/PrismJS/prism into PrismJ…
drkameleon Mar 21, 2022
6f74fc2
rebuild
drkameleon Mar 21, 2022
cfcf7e8
Merge pull request #2 from drkameleon/PrismJS-master
drkameleon Mar 21, 2022
85b9e31
lint: minor fixes
drkameleon Mar 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions components.json
Expand Up @@ -139,6 +139,11 @@
"title": "ARFF",
"owner": "Golmote"
},
"arturo": {
"title": "Arturo",
"alias": "art",
"owner": "drkameleon"
},
"asciidoc": {
"alias": "adoc",
"title": "AsciiDoc",
Expand Down
99 changes: 99 additions & 0 deletions components/prism-arturo.js
@@ -0,0 +1,99 @@
/**
* @param {string} lang
* @param {string} pattern
*/
function createLanguageString(lang, pattern) {
drkameleon marked this conversation as resolved.
Show resolved Hide resolved
return {
pattern: RegExp(/\{!/.source + '(?:' + (pattern || lang)+ ')' + /$[\s\S]*\}/.source, 'm'),
greedy: true,
inside: {
'embedded': {
pattern: /(^\{!\w+\b)[\s\S]+(?=\}$)/,
lookbehind: true,
alias: 'language-' + lang,
inside: Prism.languages[lang]
},
'string': /[\s\S]+/
}
}
}

Prism.languages.arturo = {
'comment': {
pattern: /;.*/,
greedy: true
},

'character': {
pattern: /`.`/,
alias: 'char',
greedy: true
},

'number': {
pattern: /\b\d+(?:\.\d+(?:\.\d+(?:-[\w+-]+)?)?)?\b/,
},

'string': {
pattern: /"(?:[^"\\\r\n]|\\.)*"/,
greedy: true
},

'regex': {
pattern: /\{\/.*?\/\}/,
greedy: true
},

'html-string': createLanguageString('html'),
'css-string': createLanguageString('css'),
'js-string': createLanguageString('js'),
'md-string': createLanguageString('md'),
'sql-string': createLanguageString('sql'),
'sh-string': createLanguageString('sh'),

'multistring': {
pattern: /».*|\{:[\s\S]*?:\}|\{[\s\S]*?\}|^-{6}$[\s\S]*/m,
alias: 'string',
greedy: true
},

'label': {
pattern: /\w+\b\??:/,
alias: 'class-name'
},

'literal': {
pattern: /'(?:\w+\b\??:?)/,
alias: 'boolean'
},

'type': {
pattern: /:(?:\w+\b\??:?)/,
alias: 'boolean'
},

'predicate': {
pattern: /\b(?:all|and|any|ascii|attr|attribute|attributeLabel|binary|block|char|contains|database|date|dictionary|empty|equal|even|every|exists|false|floating|function|greater|greaterOrEqual|if|in|inline|integer|is|key|label|leap|less|lessOrEqual|literal|logical|lower|nand|negative|nor|not|notEqual|null|numeric|odd|or|path|pathLabel|positive|prefix|prime|regex|same|set|some|sorted|standalone|string|subset|suffix|superset|symbol|symbolLiteral|true|try|type|unless|upper|when|whitespace|word|xnor|xor|zero)\?/,
alias: 'keyword'
},

'builtin-function': {
pattern: /\b(?:abs|acos|acosh|acsec|acsech|actan|actanh|add|after|alert|alias|and|angle|append|arg|args|arity|array|as|asec|asech|asin|asinh|atan|atan2|atanh|attr|attrs|average|before|benchmark|blend|break|call|capitalize|case|ceil|chop|clear|clip|close|color|combine|conj|continue|copy|cos|cosh|crc|csec|csech|ctan|ctanh|cursor|darken|dec|decode|define|delete|desaturate|deviation|dialog|dictionary|difference|digest|digits|div|do|download|drop|dup|e|else|empty|encode|ensure|env|escape|execute|exit|exp|extend|extract|factors|fdiv|filter|first|flatten|floor|fold|from|function|gamma|gcd|get|goto|hash|hypot|if|inc|indent|index|infinity|info|input|insert|inspect|intersection|invert|jaro|join|keys|kurtosis|last|let|levenshtein|lighten|list|ln|log|loop|lower|mail|map|match|max|median|min|mod|module|mul|nand|neg|new|nor|normalize|not|now|null|open|or|outdent|pad|palette|panic|path|pause|permissions|permutate|pi|pop|popup|pow|powerset|powmod|prefix|print|prints|process|product|query|random|range|read|relative|remove|rename|render|repeat|replace|request|return|reverse|round|sample|saturate|script|sec|sech|select|serve|set|shl|shr|shuffle|sin|sinh|size|skewness|slice|sort|spin|split|sqrt|squeeze|stack|strip|sub|suffix|sum|switch|symbols|symlink|sys|take|tan|tanh|terminal|terminate|to|truncate|try|type|unclip|union|unique|unless|until|unzip|upper|values|var|variance|volume|webview|while|with|wordwrap|write|xnor|xor|zip)\b/,
alias: 'keyword'
},

'sugar': {
pattern: /->|=>|\||::/,
alias: 'important'
},

'symbol': {
pattern: /<:|-:|ø|@|#|\+|\||\*|\$|---|-|%|\/|\.\.|\^|~|=|<|>|\\/
},

'boolean': {
pattern: /\b(?:false|maybe|true)\b/
}
};

Prism.languages.art = Prism.languages['arturo'];
1 change: 1 addition & 0 deletions components/prism-arturo.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.