Skip to content

Commit

Permalink
Update Prism to 1.27.0
Browse files Browse the repository at this point in the history
There are now 277 (from 276) syntaxes supported.

See: <https://github.com/PrismJS/prism/blob/master/CHANGELOG.md#1270-2022-02-17>
  • Loading branch information
wooorm committed Feb 19, 2022
1 parent 4b72dd6 commit 9a8cfdc
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lang/autoit.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function autoit(Prism) {
}
},
directive: {
pattern: /(^[\t ]*)#\w+/m,
pattern: /(^[\t ]*)#[\w-]+/m,
lookbehind: true,
alias: 'keyword'
},
Expand Down
2 changes: 1 addition & 1 deletion lang/editorconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function editorconfig(Prism) {
section: {
pattern: /(^[ \t]*)\[.+\]/m,
lookbehind: true,
alias: 'keyword',
alias: 'selector',
inside: {
regex: /\\\\[\[\]{},!?.*]/,
// Escape special characters with '\\'
Expand Down
2 changes: 1 addition & 1 deletion lang/ini.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function ini(Prism) {
pattern: /(^[ \f\t\v]*)[#;][^\n\r]*/m,
lookbehind: true
},
header: {
section: {
pattern: /(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,
lookbehind: true,
inside: {
Expand Down
15 changes: 13 additions & 2 deletions lang/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export default function mongodb(Prism) {
'$sortByCount',
'$unionWith',
'$unset',
'$unwind', // aggregation pipeline operators
'$unwind',
'$setWindowFields', // aggregation pipeline operators
'$abs',
'$accumulator',
'$acos',
Expand Down Expand Up @@ -223,7 +224,17 @@ export default function mongodb(Prism) {
'$type',
'$week',
'$year',
'$zip', // aggregation pipeline query modifiers
'$zip',
'$count',
'$dateAdd',
'$dateDiff',
'$dateSubtract',
'$dateTrunc',
'$getField',
'$rand',
'$sampleRate',
'$setField',
'$unsetField', // aggregation pipeline query modifiers
'$comment',
'$explain',
'$hint',
Expand Down
4 changes: 2 additions & 2 deletions lang/purebasic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ slightly changed to pass all tests
Prism.languages.purebasic = Prism.languages.extend('clike', {
comment: /;.*/,
keyword:
/\b(?:align|and|as|break|calldebugger|case|compilercase|compilerdefault|compilerelse|compilerelseif|compilerendif|compilerendselect|compilererror|compilerif|compilerselect|continue|data|datasection|debug|debuglevel|declare|declarec|declarecdll|declaredll|declaremodule|default|define|dim|disableasm|disabledebugger|disableexplicit|else|elseif|enableasm|enabledebugger|enableexplicit|end|enddatasection|enddeclaremodule|endenumeration|endif|endimport|endinterface|endmacro|endmodule|endprocedure|endselect|endstructure|endstructureunion|endwith|enumeration|extends|fakereturn|for|foreach|global|gosub|goto|if|import|importc|includebinary|includefile|includepath|interface|macro|module|newlist|newmap|next|not|or|procedure|procedurec|procedurecdll|proceduredll|procedurereturn|protected|prototype|prototypec|read|redim|repeat|restore|return|runtime|select|shared|static|step|structure|structureunion|swap|threaded|to|until|wend|while|with|xincludefile|xor)\b/i,
/\b(?:align|and|as|break|calldebugger|case|compilercase|compilerdefault|compilerelse|compilerelseif|compilerendif|compilerendselect|compilererror|compilerif|compilerselect|continue|data|datasection|debug|debuglevel|declare|declarec|declarecdll|declaredll|declaremodule|default|define|dim|disableasm|disabledebugger|disableexplicit|else|elseif|enableasm|enabledebugger|enableexplicit|end|enddatasection|enddeclaremodule|endenumeration|endif|endimport|endinterface|endmacro|endmodule|endprocedure|endselect|endstructure|endstructureunion|endwith|enumeration|extends|fakereturn|for|foreach|forever|global|gosub|goto|if|import|importc|includebinary|includefile|includepath|interface|macro|module|newlist|newmap|next|not|or|procedure|procedurec|procedurecdll|proceduredll|procedurereturn|protected|prototype|prototypec|read|redim|repeat|restore|return|runtime|select|shared|static|step|structure|structureunion|swap|threaded|to|until|wend|while|with|xincludefile|xor)\b/i,
function: /\b\w+(?:\.\w+)?\s*(?=\()/,
number: /(?:\$[\da-f]+|\b-?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\b/i,
operator:
/(?:@\*?|\?|\*)\w+|-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*/@]/
})
Prism.languages.insertBefore('purebasic', 'keyword', {
tag: /#\w+/,
tag: /#\w+\$?/,
asm: {
pattern: /(^[\t ]*)!.*/m,
lookbehind: true,
Expand Down
31 changes: 31 additions & 0 deletions lang/scala.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,37 @@ export default function scala(Prism) {
/\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
symbol: /'[^\d\s\\]\w*/
})
Prism.languages.insertBefore('scala', 'triple-quoted-string', {
'string-interpolation': {
pattern:
/\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
greedy: true,
inside: {
id: {
pattern: /^\w+/,
greedy: true,
alias: 'function'
},
escape: {
pattern: /\\\$"|\$[$"]/,
greedy: true,
alias: 'symbol'
},
interpolation: {
pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
greedy: true,
inside: {
punctuation: /^\$\{?|\}$/,
expression: {
pattern: /[\s\S]+/,
inside: Prism.languages.scala
}
}
},
string: /[\s\S]+/
}
}
})
delete Prism.languages.scala['class-name']
delete Prism.languages.scala['function']
}
2 changes: 1 addition & 1 deletion lang/systemd.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function systemd(Prism) {
}
}
},
operator: /=/
punctuation: /=/
}
})(Prism)
}
60 changes: 60 additions & 0 deletions lang/uorazor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// @ts-nocheck
uorazor.displayName = 'uorazor'
uorazor.aliases = []

/** @type {import('../core.js').Syntax} */
export default function uorazor(Prism) {
Prism.languages.uorazor = {
'comment-hash': {
pattern: /#.*/,
alias: 'comment',
greedy: true
},
'comment-slash': {
pattern: /\/\/.*/,
alias: 'comment',
greedy: true
},
string: {
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
inside: {
punctuation: /^['"]|['"]$/
},
greedy: true
},
'source-layers': {
pattern:
/\b(?:arms|backpack|blue|bracelet|cancel|clear|cloak|criminal|earrings|enemy|facialhair|friend|friendly|gloves|gray|grey|ground|hair|head|innerlegs|innertorso|innocent|lefthand|middletorso|murderer|neck|nonfriendly|onehandedsecondary|outerlegs|outertorso|pants|red|righthand|ring|self|shirt|shoes|talisman|waist)\b/i,
alias: 'function'
},
'source-commands': {
pattern:
/\b(?:alliance|attack|cast|clearall|clearignore|clearjournal|clearlist|clearsysmsg|createlist|createtimer|dclick|dclicktype|dclickvar|dress|dressconfig|drop|droprelloc|emote|getlabel|guild|gumpclose|gumpresponse|hotkey|ignore|lasttarget|lift|lifttype|menu|menuresponse|msg|org|organize|organizer|overhead|pause|poplist|potion|promptresponse|pushlist|removelist|removetimer|rename|restock|say|scav|scavenger|script|setability|setlasttarget|setskill|settimer|setvar|sysmsg|target|targetloc|targetrelloc|targettype|undress|unignore|unsetvar|useobject|useonce|useskill|usetype|virtue|wait|waitforgump|waitformenu|waitforprompt|waitforstat|waitforsysmsg|waitfortarget|walk|wfsysmsg|wft|whisper|yell)\b/,
alias: 'function'
},
'tag-name': {
pattern: /(^\{%-?\s*)\w+/,
lookbehind: true,
alias: 'keyword'
},
delimiter: {
pattern: /^\{[{%]-?|-?[%}]\}$/,
alias: 'punctuation'
},
function:
/\b(?:atlist|close|closest|count|counter|counttype|dead|dex|diffhits|diffmana|diffstam|diffweight|find|findbuff|finddebuff|findlayer|findtype|findtypelist|followers|gumpexists|hidden|hits|hp|hue|human|humanoid|ingump|inlist|insysmessage|insysmsg|int|invul|lhandempty|list|listexists|mana|maxhits|maxhp|maxmana|maxstam|maxweight|monster|mounted|name|next|noto|paralyzed|poisoned|position|prev|previous|queued|rand|random|rhandempty|skill|stam|str|targetexists|timer|timerexists|varexist|warmode|weight)\b/,
keyword:
/\b(?:and|as|break|continue|else|elseif|endfor|endif|endwhile|for|if|loop|not|or|replay|stop|while)\b/,
boolean: /\b(?:false|null|true)\b/,
number: /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,
operator: [
{
pattern:
/(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,
lookbehind: true
},
/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/
],
punctuation: /[()\[\]{}:.,]/
}
}
2 changes: 2 additions & 0 deletions lib/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ import toml from '../lang/toml.js'
import tremor from '../lang/tremor.js'
import typoscript from '../lang/typoscript.js'
import unrealscript from '../lang/unrealscript.js'
import uorazor from '../lang/uorazor.js'
import v from '../lang/v.js'
import vala from '../lang/vala.js'
import velocity from '../lang/velocity.js'
Expand Down Expand Up @@ -540,6 +541,7 @@ refractor.register(toml)
refractor.register(tremor)
refractor.register(typoscript)
refractor.register(unrealscript)
refractor.register(uorazor)
refractor.register(v)
refractor.register(vala)
refractor.register(velocity)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@types/prismjs": "^1.0.0",
"hastscript": "^7.0.0",
"parse-entities": "^4.0.0",
"prismjs": "~1.26.0"
"prismjs": "~1.27.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ That’s why there are three entry points for refractor:

* `lib/core.js` — 0 languages
* `lib/common.js` (default) — 36 languages
* `lib/all.js`276 languages
* `lib/all.js`277 languages

<!--count end-->

Expand Down Expand Up @@ -631,6 +631,7 @@ syntaxes are made to work with global variables and are not importable.
* [ ] [`twig`](https://github.com/wooorm/refractor/blob/main/lang/twig.js)
* [ ] [`typoscript`](https://github.com/wooorm/refractor/blob/main/lang/typoscript.js) — alias: `tsconfig`
* [ ] [`unrealscript`](https://github.com/wooorm/refractor/blob/main/lang/unrealscript.js) — alias: `uc`, `uscript`
* [ ] [`uorazor`](https://github.com/wooorm/refractor/blob/main/lang/uorazor.js)
* [ ] [`uri`](https://github.com/wooorm/refractor/blob/main/lang/uri.js) — alias: `url`
* [ ] [`v`](https://github.com/wooorm/refractor/blob/main/lang/v.js)
* [ ] [`vala`](https://github.com/wooorm/refractor/blob/main/lang/vala.js)
Expand Down

0 comments on commit 9a8cfdc

Please sign in to comment.