LocalCDN-Firefox-Chrome-Brave/resources/highlight.js/11.10.0/elixir.min.jsm

34 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-07-13 07:40:24 +02:00
/*! `elixir` grammar compiled for Highlight.js 11.10.0 */
2021-10-18 07:02:03 +02:00
(()=>{var e=(()=>{"use strict";return e=>{
2022-03-13 06:56:23 +01:00
const n=e.regex,a="[a-zA-Z_][a-zA-Z0-9_.]*(!|\\?)?",i={$pattern:a,
keyword:["after","alias","and","case","catch","cond","defstruct","defguard","do","else","end","fn","for","if","import","in","not","or","quote","raise","receive","require","reraise","rescue","try","unless","unquote","unquote_splicing","use","when","with|0"],
2021-10-18 07:02:03 +02:00
literal:["false","nil","true"]},s={className:"subst",begin:/#\{/,end:/\}/,
keywords:i},c={match:/\\[\s\S]/,scope:"char.escape",relevance:0
},r="[/|([{<\"']",t=[{begin:/"/,end:/"/},{begin:/'/,end:/'/},{begin:/\//,
end:/\//},{begin:/\|/,end:/\|/},{begin:/\(/,end:/\)/},{begin:/\[/,end:/\]/},{
begin:/\{/,end:/\}/},{begin:/</,end:/>/}],d=e=>({scope:"char.escape",
begin:n.concat(/\\/,e),relevance:0}),o={className:"string",
begin:"~[a-z](?="+r+")",contains:t.map((n=>e.inherit(n,{contains:[d(n.end),c,s]
})))},b={className:"string",begin:"~[A-Z](?="+r+")",
contains:t.map((n=>e.inherit(n,{contains:[d(n.end)]})))},g={className:"regex",
variants:[{begin:"~r(?="+r+")",contains:t.map((a=>e.inherit(a,{
end:n.concat(a.end,/[uismxfU]{0,7}/),contains:[d(a.end),c,s]})))},{
begin:"~R(?="+r+")",contains:t.map((a=>e.inherit(a,{
end:n.concat(a.end,/[uismxfU]{0,7}/),contains:[d(a.end)]})))}]},l={
2021-10-18 07:02:03 +02:00
className:"string",contains:[e.BACKSLASH_ESCAPE,s],variants:[{begin:/"""/,
end:/"""/},{begin:/'''/,end:/'''/},{begin:/~S"""/,end:/"""/,contains:[]},{
begin:/~S"/,end:/"/,contains:[]},{begin:/~S'''/,end:/'''/,contains:[]},{
begin:/~S'/,end:/'/,contains:[]},{begin:/'/,end:/'/},{begin:/"/,end:/"/}]},m={
2021-10-18 07:02:03 +02:00
className:"function",beginKeywords:"def defp defmacro defmacrop",end:/\B\b/,
contains:[e.inherit(e.TITLE_MODE,{begin:a,endsParent:!0})]},u=e.inherit(m,{
2021-10-18 07:02:03 +02:00
className:"class",beginKeywords:"defimpl defmodule defprotocol defrecord",
end:/\bdo\b|$|;/}),f=[l,g,b,o,e.HASH_COMMENT_MODE,u,m,{begin:"::"},{
className:"symbol",begin:":(?![\\s:])",contains:[l,{
2021-10-18 07:02:03 +02:00
begin:"[a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?"
2022-03-13 06:56:23 +01:00
}],relevance:0},{className:"symbol",begin:a+":(?!:)",relevance:0},{
className:"title.class",begin:/(\b[A-Z][a-zA-Z0-9_]+)/,relevance:0},{
2021-10-18 07:02:03 +02:00
className:"number",
begin:"(\\b0o[0-7_]+)|(\\b0b[01_]+)|(\\b0x[0-9a-fA-F_]+)|(-?\\b[0-9][0-9_]*(\\.[0-9_]+([eE][-+]?[0-9]+)?)?)",
2022-01-09 09:04:16 +01:00
relevance:0},{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))"}]
;return s.contains=f,{name:"Elixir",aliases:["ex","exs"],keywords:i,contains:f}}
2022-01-09 09:04:16 +01:00
})();hljs.registerLanguage("elixir",e)})();