diff --git a/components.js b/components.js index c254a13af7..5da15951a2 100644 --- a/components.js +++ b/components.js @@ -294,6 +294,10 @@ var components = { "require": "css", "owner": "Golmote" }, + "livescript": { + "title": "LiveScript", + "owner": "Golmote" + }, "lolcode": { "title": "LOLCODE", "owner": "Golmote" diff --git a/components/prism-livescript.js b/components/prism-livescript.js new file mode 100644 index 0000000000..97bee4aeb6 --- /dev/null +++ b/components/prism-livescript.js @@ -0,0 +1,118 @@ +Prism.languages.livescript = { + 'interpolated-string': { + pattern: /("""|")(?:\\[\s\S]|(?!\1)[^\\])*\1/, + greedy: true, + inside: { + 'variable': { + pattern: /(^|[^\\])#[a-z_](?:-?[a-z]|\d)*/m, + lookbehind: true + }, + 'interpolation': { + pattern: /(^|[^\\])#\{[^}]+\}/m, + lookbehind: true, + inside: { + 'interpolation-punctuation': { + pattern: /^#\{|\}$/, + alias: 'variable' + } + // See rest below + } + }, + 'string': /[\s\S]+/ + } + }, + 'comment': [ + { + pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, + lookbehind: true, + greedy: true + }, + { + pattern: /(^|[^\\])#.*/, + lookbehind: true, + greedy: true + } + ], + 'string': [ + { + pattern: /('''|')(?:\\[\s\S]|(?!\1)[^\\])*\1/, + greedy: true + }, + { + pattern: /<\[[\s\S]*?\]>/, + greedy: true + }, + /\\[^\s,;\])}]+/ + ], + 'regex': [ + { + pattern: /\/\/(\[.+?]|\\.|(?!\/\/)[^\\])+\/\/[gimyu]{0,5}/, + greedy: true, + inside: { + 'comment': { + pattern: /(^|[^\\])#.*/, + lookbehind: true + } + } + }, + { + pattern: /\/(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}/, + greedy: true + } + ], + 'keyword': { + pattern: /(^|(?!-).)\b(?:break|case|catch|class|const|continue|default|do|else|extends|fallthrough|finally|for(?: ever)?|function|if|implements|it|let|loop|new|null|otherwise|own|return|super|switch|that|then|this|throw|try|unless|until|var|void|when|while|yield)(?!-)\b/m, + lookbehind: true + }, + 'keyword-operator': { + pattern: /(^|[^-])\b(?:(?:delete|require|typeof)!|(?:and|by|delete|export|from|import(?: all)?|in|instanceof|is(?:nt| not)?|not|of|or|til|to|typeof|with|xor)(?!-)\b)/m, + lookbehind: true, + alias: 'operator' + }, + 'boolean': { + pattern: /(^|[^-])\b(?:false|no|off|on|true|yes)(?!-)\b/m, + lookbehind: true + }, + 'argument': { + // Don't match .&. nor && + pattern: /(^|(?!\.&\.)[^&])&(?!&)\d*/m, + lookbehind: true, + alias: 'variable' + }, + 'number': /\b(?:\d+~[\da-z]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[a-z]\w*)?)/i, + 'identifier': /[a-z_](?:-?[a-z]|\d)*/i, + 'operator': [ + // Spaced . + { + pattern: /( )\.(?= )/, + lookbehind: true + }, + // Full list, in order: + // .= .~ .. ... + // .&. .^. .<<. .>>. .>>>. + // := :: ::= + // && + // || |> + // < << <<< <<<< + // <- <-- <-! <--! + // <~ <~~ <~! <~~! + // <| <= >> >= >? + // - -- -> --> + // + ++ + // @ @@ + // % %% + // * ** + // ! != !~= + // !~> !~~> + // !-> !--> + // ~ ~> ~~> ~= + // = == + // ^ ^^ + // / ? + /\.(?:[=~]|\.\.?)|\.(?:[&|^]|<<|>>>?)\.|:(?:=|:=?)|&&|\|[|>]|<(?:<[>=?]?|-(?:->?|>)?|\+\+?|@@?|%%?|\*\*?|!(?:~?=|--?>|~?~>)?|~(?:~?>|=)?|==?|\^\^?|[\/?]/ + ], + 'punctuation': /[(){}\[\]|.,:;`]/ +}; + +Prism.languages.livescript['interpolated-string'].inside['interpolation'].inside.rest = Prism.languages.livescript; \ No newline at end of file diff --git a/components/prism-livescript.min.js b/components/prism-livescript.min.js new file mode 100644 index 0000000000..b79f8157fd --- /dev/null +++ b/components/prism-livescript.min.js @@ -0,0 +1 @@ +Prism.languages.livescript={"interpolated-string":{pattern:/("""|")(?:\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0,inside:{variable:{pattern:/(^|[^\\])#[a-z_](?:-?[a-z]|\d)*/m,lookbehind:!0},interpolation:{pattern:/(^|[^\\])#\{[^}]+\}/m,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^#\{|\}$/,alias:"variable"}}},string:/[\s\S]+/}},comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:/('''|')(?:\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0},{pattern:/<\[[\s\S]*?\]>/,greedy:!0},/\\[^\s,;\])}]+/],regex:[{pattern:/\/\/(\[.+?]|\\.|(?!\/\/)[^\\])+\/\/[gimyu]{0,5}/,greedy:!0,inside:{comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0}}},{pattern:/\/(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}/,greedy:!0}],keyword:{pattern:/(^|(?!-).)\b(?:break|case|catch|class|const|continue|default|do|else|extends|fallthrough|finally|for(?: ever)?|function|if|implements|it|let|loop|new|null|otherwise|own|return|super|switch|that|then|this|throw|try|unless|until|var|void|when|while|yield)(?!-)\b/m,lookbehind:!0},"keyword-operator":{pattern:/(^|[^-])\b(?:(?:delete|require|typeof)!|(?:and|by|delete|export|from|import(?: all)?|in|instanceof|is(?:nt| not)?|not|of|or|til|to|typeof|with|xor)(?!-)\b)/m,lookbehind:!0,alias:"operator"},"boolean":{pattern:/(^|[^-])\b(?:false|no|off|on|true|yes)(?!-)\b/m,lookbehind:!0},argument:{pattern:/(^|(?!\.&\.)[^&])&(?!&)\d*/m,lookbehind:!0,alias:"variable"},number:/\b(?:\d+~[\da-z]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[a-z]\w*)?)/i,identifier:/[a-z_](?:-?[a-z]|\d)*/i,operator:[{pattern:/( )\.(?= )/,lookbehind:!0},/\.(?:[=~]|\.\.?)|\.(?:[&|^]|<<|>>>?)\.|:(?:=|:=?)|&&|\|[|>]|<(?:<[>=?]?|-(?:->?|>)?|\+\+?|@@?|%%?|\*\*?|!(?:~?=|--?>|~?~>)?|~(?:~?>|=)?|==?|\^\^?|[\/?]/],punctuation:/[(){}\[\]|.,:;`]/},Prism.languages.livescript["interpolated-string"].inside.interpolation.inside.rest=Prism.languages.livescript; \ No newline at end of file diff --git a/components/prism-powershell.min.js b/components/prism-powershell.min.js index dd0bcb7885..13e6e146f0 100644 --- a/components/prism-powershell.min.js +++ b/components/prism-powershell.min.js @@ -1 +1 @@ -Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(`?[\w\W])*?"/,greedy:!0,inside:{"function":{pattern:/[^`]\$\(.*?\)/,inside:{}}}},{pattern:/'([^']|'')*'/,greedy:!0}],namespace:/\[[a-z][\w\W]*?\]/i,"boolean":/\$(true|false)\b/i,variable:/\$\w+\b/i,"function":[/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-Computer|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Compare-Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(Csv|Json|StringData)|Convert-Path|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-Process|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-PSSession|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-PSSession|Exit-PSSession|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-Object|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(Command|Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Receive-(Job|PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(Computer|Service)|Restore-Computer|Resume-(Job|Service)|Save-Help|Select-(Object|String|Xml)|Send-MailMessage|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-Object|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData|Help|List|TypeData)|Use-Transaction|Wait-(Event|Job|Process)|Where-Object|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/i,/\b(ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(\W?)(!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(and|x?or)|(Not)?(Like|Match|Contains|In)|Replace|Join|is(Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/},Prism.languages.powershell.string[0].inside.boolean=Prism.languages.powershell.boolean,Prism.languages.powershell.string[0].inside.variable=Prism.languages.powershell.variable,Prism.languages.powershell.string[0].inside.function.inside=Prism.util.clone(Prism.languages.powershell); +Prism.languages.powershell={comment:[{pattern:/(^|[^`])<#[\w\W]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(`?[\w\W])*?"/,greedy:!0,inside:{"function":{pattern:/[^`]\$\(.*?\)/,inside:{}}}},{pattern:/'([^']|'')*'/,greedy:!0}],namespace:/\[[a-z][\w\W]*?\]/i,"boolean":/\$(true|false)\b/i,variable:/\$\w+\b/i,"function":[/\b(Add-(Computer|Content|History|Member|PSSnapin|Type)|Checkpoint-Computer|Clear-(Content|EventLog|History|Item|ItemProperty|Variable)|Compare-Object|Complete-Transaction|Connect-PSSession|ConvertFrom-(Csv|Json|StringData)|Convert-Path|ConvertTo-(Csv|Html|Json|Xml)|Copy-(Item|ItemProperty)|Debug-Process|Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Disconnect-PSSession|Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)|Enter-PSSession|Exit-PSSession|Export-(Alias|Clixml|Console|Csv|FormatData|ModuleMember|PSSession)|ForEach-Object|Format-(Custom|List|Table|Wide)|Get-(Alias|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Culture|Date|Event|EventLog|EventSubscriber|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job|Location|Member|Module|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|WmiObject)|Group-Object|Import-(Alias|Clixml|Csv|LocalizedData|Module|PSSession)|Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)|Join-Path|Limit-EventLog|Measure-(Command|Object)|Move-(Item|ItemProperty)|New-(Alias|Event|EventLog|Item|ItemProperty|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy)|Out-(Default|File|GridView|Host|Null|Printer|String)|Pop-Location|Push-Location|Read-Host|Receive-(Job|PSSession)|Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)|Remove-(Computer|Event|EventLog|Item|ItemProperty|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)|Rename-(Computer|Item|ItemProperty)|Reset-ComputerMachinePassword|Resolve-Path|Restart-(Computer|Service)|Restore-Computer|Resume-(Job|Service)|Save-Help|Select-(Object|String|Xml)|Send-MailMessage|Set-(Alias|Content|Date|Item|ItemProperty|Location|PSBreakpoint|PSDebug|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)|Show-(Command|ControlPanelItem|EventLog)|Sort-Object|Split-Path|Start-(Job|Process|Service|Sleep|Transaction)|Stop-(Computer|Job|Process|Service)|Suspend-(Job|Service)|Tee-Object|Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)|Trace-Command|Unblock-File|Undo-Transaction|Unregister-(Event|PSSessionConfiguration)|Update-(FormatData|Help|List|TypeData)|Use-Transaction|Wait-(Event|Job|Process)|Where-Object|Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning))\b/i,/\b(ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(\W?)(!|-(eq|ne|gt|ge|lt|le|sh[lr]|not|b?(and|x?or)|(Not)?(Like|Match|Contains|In)|Replace|Join|is(Not)?|as)\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/},Prism.languages.powershell.string[0].inside.boolean=Prism.languages.powershell.boolean,Prism.languages.powershell.string[0].inside.variable=Prism.languages.powershell.variable,Prism.languages.powershell.string[0].inside.function.inside=Prism.util.clone(Prism.languages.powershell); \ No newline at end of file diff --git a/examples/prism-livescript.html b/examples/prism-livescript.html new file mode 100644 index 0000000000..7bc4ff82c9 --- /dev/null +++ b/examples/prism-livescript.html @@ -0,0 +1,87 @@ +

LiveScript

+

To use this language, use the class "language-livescript".

+ +

Comments

+
# This is a single line comment
+/* This is a
+multi line comment */
+ +

Numbers

+
42
+42km
+3.754km_2
+16~BadFace
+36~azertyuiop0123456789
+ +

Strings and interpolation

+
''
+''''''
+""
+""""""
+'Foo \' bar
+	baz'
+'''Foo \''' bar
+	bar'''
+"Foo #bar \"
+	#{2 + 2}\""
+"""#foobar \""" #{ if /test/ == 'test' then 3 else 4}
+	baz"""
+ +

Regex

+
/foobar/ig
+//
+^foo # foo
+[bar]*bA?z # barbaz
+//m
+ +

Full example

+
# example from Str.ls
+
+split = (sep, str) -->
+  str.split sep
+
+join = (sep, xs) -->
+  xs.join sep
+
+lines = (str) ->
+  return [] unless str.length
+  str.split '\n'
+
+unlines = (.join '\n')
+
+words = (str) ->
+  return [] unless str.length
+  str.split /[ ]+/
+
+unwords = (.join ' ')
+
+chars = (.split '')
+
+unchars = (.join '')
+
+reverse = (str) ->
+  str.split '' .reverse!.join ''
+
+repeat = (n, str) -->
+  result = ''
+  for til n
+    result += str
+  result
+
+capitalize = (str) ->
+  (str.char-at 0).to-upper-case! + str.slice 1
+
+camelize = (.replace /[-_]+(.)?/g, (, c) -> (c ? '').to-upper-case!)
+
+# convert camelCase to camel-case, and setJSON to set-JSON
+dasherize = (str) ->
+    str
+      .replace /([^-A-Z])([A-Z]+)/g, (, lower, upper) ->
+         "#{lower}-#{if upper.length > 1 then upper else upper.to-lower-case!}"
+      .replace /^([A-Z]+)/, (, upper) ->
+         if upper.length > 1 then "#upper-" else upper.to-lower-case!
+
+module.exports = {
+  split, join, lines, unlines, words, unwords, chars, unchars, reverse,
+  repeat, capitalize, camelize, dasherize,
+}
\ No newline at end of file diff --git a/plugins/show-language/prism-show-language.js b/plugins/show-language/prism-show-language.js index d4f126dd1d..5ca2ade724 100644 --- a/plugins/show-language/prism-show-language.js +++ b/plugins/show-language/prism-show-language.js @@ -5,7 +5,7 @@ if (typeof self === 'undefined' || !self.Prism || !self.document) { } // The languages map is built automatically with gulp -var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","asciidoc":"AsciiDoc","aspnet":"ASP.NET (C#)","autoit":"AutoIt","autohotkey":"AutoHotkey","basic":"BASIC","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","graphql":"GraphQL","http":"HTTP","inform7":"Inform 7","json":"JSON","latex":"LaTeX","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","parigp":"PARI/GP","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","vim":"vim","wiki":"Wiki markup","yaml":"YAML"}/*]*/; +var Languages = /*languages_placeholder[*/{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","css":"CSS","clike":"C-like","javascript":"JavaScript","abap":"ABAP","actionscript":"ActionScript","apacheconf":"Apache Configuration","apl":"APL","applescript":"AppleScript","asciidoc":"AsciiDoc","aspnet":"ASP.NET (C#)","autoit":"AutoIt","autohotkey":"AutoHotkey","basic":"BASIC","csharp":"C#","cpp":"C++","coffeescript":"CoffeeScript","css-extras":"CSS Extras","fsharp":"F#","glsl":"GLSL","graphql":"GraphQL","http":"HTTP","inform7":"Inform 7","json":"JSON","latex":"LaTeX","livescript":"LiveScript","lolcode":"LOLCODE","matlab":"MATLAB","mel":"MEL","nasm":"NASM","nginx":"nginx","nsis":"NSIS","objectivec":"Objective-C","ocaml":"OCaml","parigp":"PARI/GP","php":"PHP","php-extras":"PHP Extras","powershell":"PowerShell","properties":".properties","protobuf":"Protocol Buffers","jsx":"React JSX","rest":"reST (reStructuredText)","sas":"SAS","sass":"Sass (Sass)","scss":"Sass (Scss)","sql":"SQL","typescript":"TypeScript","vhdl":"VHDL","vim":"vim","wiki":"Wiki markup","yaml":"YAML"}/*]*/; Prism.hooks.add('before-highlight', function(env) { var pre = env.element.parentNode; if (!pre || !/pre/i.test(pre.nodeName)) { diff --git a/plugins/show-language/prism-show-language.min.js b/plugins/show-language/prism-show-language.min.js index 3a03b10833..a990adbaa8 100644 --- a/plugins/show-language/prism-show-language.min.js +++ b/plugins/show-language/prism-show-language.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",asciidoc:"AsciiDoc",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",graphql:"GraphQL",http:"HTTP",inform7:"Inform 7",json:"JSON",latex:"LaTeX",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",parigp:"PARI/GP",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",yaml:"YAML"};Prism.hooks.add("before-highlight",function(s){var a=s.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,i,r=a.getAttribute("data-language")||e[s.language]||s.language.substring(0,1).toUpperCase()+s.language.substring(1),l=a.previousSibling;l&&/\s*\bprism-show-language\b\s*/.test(l.className)&&l.firstChild&&/\s*\bprism-show-language-label\b\s*/.test(l.firstChild.className)?i=l.firstChild:(t=document.createElement("div"),i=document.createElement("div"),i.className="prism-show-language-label",t.className="prism-show-language",t.appendChild(i),a.parentNode.insertBefore(t,a)),i.innerHTML=r}})}}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism&&self.document){var e={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",javascript:"JavaScript",abap:"ABAP",actionscript:"ActionScript",apacheconf:"Apache Configuration",apl:"APL",applescript:"AppleScript",asciidoc:"AsciiDoc",aspnet:"ASP.NET (C#)",autoit:"AutoIt",autohotkey:"AutoHotkey",basic:"BASIC",csharp:"C#",cpp:"C++",coffeescript:"CoffeeScript","css-extras":"CSS Extras",fsharp:"F#",glsl:"GLSL",graphql:"GraphQL",http:"HTTP",inform7:"Inform 7",json:"JSON",latex:"LaTeX",livescript:"LiveScript",lolcode:"LOLCODE",matlab:"MATLAB",mel:"MEL",nasm:"NASM",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",parigp:"PARI/GP",php:"PHP","php-extras":"PHP Extras",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",jsx:"React JSX",rest:"reST (reStructuredText)",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)",sql:"SQL",typescript:"TypeScript",vhdl:"VHDL",vim:"vim",wiki:"Wiki markup",yaml:"YAML"};Prism.hooks.add("before-highlight",function(s){var a=s.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,i,r=a.getAttribute("data-language")||e[s.language]||s.language.substring(0,1).toUpperCase()+s.language.substring(1),p=a.previousSibling;p&&/\s*\bprism-show-language\b\s*/.test(p.className)&&p.firstChild&&/\s*\bprism-show-language-label\b\s*/.test(p.firstChild.className)?i=p.firstChild:(t=document.createElement("div"),i=document.createElement("div"),i.className="prism-show-language-label",t.className="prism-show-language",t.appendChild(i),a.parentNode.insertBefore(t,a)),i.innerHTML=r}})}}(); \ No newline at end of file diff --git a/tests/languages/livescript/argument_feature.test b/tests/languages/livescript/argument_feature.test new file mode 100644 index 0000000000..c195da9c5d --- /dev/null +++ b/tests/languages/livescript/argument_feature.test @@ -0,0 +1,17 @@ +& +&0 +&1 +&999 + +---------------------------------------------------- + +[ + ["argument", "&"], + ["argument", "&0"], + ["argument", "&1"], + ["argument", "&999"] +] + +---------------------------------------------------- + +Checks for arguments. \ No newline at end of file diff --git a/tests/languages/livescript/boolean_feature.test b/tests/languages/livescript/boolean_feature.test new file mode 100644 index 0000000000..8fa6348458 --- /dev/null +++ b/tests/languages/livescript/boolean_feature.test @@ -0,0 +1,21 @@ +false +no +off +on +true +yes + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "no"], + ["boolean", "off"], + ["boolean", "on"], + ["boolean", "true"], + ["boolean", "yes"] +] + +---------------------------------------------------- + +Checks for all boolean aliases. \ No newline at end of file diff --git a/tests/languages/livescript/comment_feature.test b/tests/languages/livescript/comment_feature.test new file mode 100644 index 0000000000..afb4276ecd --- /dev/null +++ b/tests/languages/livescript/comment_feature.test @@ -0,0 +1,18 @@ +/**/ +/* foo +bar */ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "/**/"], + ["comment", "/* foo\r\nbar */"], + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/tests/languages/livescript/identifier_feature.test b/tests/languages/livescript/identifier_feature.test new file mode 100644 index 0000000000..e0de5e84e1 --- /dev/null +++ b/tests/languages/livescript/identifier_feature.test @@ -0,0 +1,21 @@ +foo +fooBar42 +foo-bar42-baz +yes-no +function-case +delete-by + +---------------------------------------------------- + +[ + ["identifier", "foo"], + ["identifier", "fooBar42"], + ["identifier", "foo-bar42-baz"], + ["identifier", "yes-no"], + ["identifier", "function-case"], + ["identifier", "delete-by"] +] + +---------------------------------------------------- + +Checks for identifiers. \ No newline at end of file diff --git a/tests/languages/livescript/interpolated-string.test b/tests/languages/livescript/interpolated-string.test new file mode 100644 index 0000000000..015ae09043 --- /dev/null +++ b/tests/languages/livescript/interpolated-string.test @@ -0,0 +1,57 @@ +"""""" +"""Foo\"""bar""" +"""Foo +bar""" +"""#foobar #{foo + 42}""" + +"" +"Foo\"bar" +"Foo +bar" +"#foo #{ if /test/ == 'test' then 3 else 4}" + +---------------------------------------------------- + +[ + ["interpolated-string", [["string", "\"\"\"\"\"\""]]], + ["interpolated-string", [["string", "\"\"\"Foo\\\"\"\"bar\"\"\""]]], + ["interpolated-string", [["string", "\"\"\"Foo\r\nbar\"\"\""]]], + ["interpolated-string", [ + ["string", "\"\"\""], + ["variable", "#foobar"], + ["string", " "], + ["interpolation", [ + ["interpolation-punctuation", "#{"], + ["identifier", "foo"], + ["operator", "+"], + ["number", "42"], + ["interpolation-punctuation", "}"] + ]], + ["string", "\"\"\""] + ]], + ["interpolated-string", [["string", "\"\""]]], + ["interpolated-string", [["string", "\"Foo\\\"bar\""]]], + ["interpolated-string", [["string", "\"Foo\r\nbar\""]]], + ["interpolated-string", [ + ["string", "\""], + ["variable", "#foo"], + ["string", " "], + ["interpolation", [ + ["interpolation-punctuation", "#{"], + ["keyword", "if"], + ["regex", "/test/"], + ["operator", "=="], + ["string", "'test'"], + ["keyword", "then"], + ["number", "3"], + ["keyword", "else"], + ["number", "4"], + ["interpolation-punctuation", "}"] + ]], + ["string", "\""] + ]] +] + +---------------------------------------------------- + +Checks for interpolated strings. \ No newline at end of file diff --git a/tests/languages/livescript/keyword-operator_feature.test b/tests/languages/livescript/keyword-operator_feature.test new file mode 100644 index 0000000000..b6f3d90ad6 --- /dev/null +++ b/tests/languages/livescript/keyword-operator_feature.test @@ -0,0 +1,57 @@ +delete! +require! +typeof! + +and +by +delete +export +from +import +import all +in +instanceof +is +isnt +is not +not +of +or +til +to +typeof +with +xor + +---------------------------------------------------- + +[ + ["keyword-operator", "delete!"], + ["keyword-operator", "require!"], + ["keyword-operator", "typeof!"], + + ["keyword-operator", "and"], + ["keyword-operator", "by"], + ["keyword-operator", "delete"], + ["keyword-operator", "export"], + ["keyword-operator", "from"], + ["keyword-operator", "import"], + ["keyword-operator", "import all"], + ["keyword-operator", "in"], + ["keyword-operator", "instanceof"], + ["keyword-operator", "is"], + ["keyword-operator", "isnt"], + ["keyword-operator", "is not"], + ["keyword-operator", "not"], + ["keyword-operator", "of"], + ["keyword-operator", "or"], + ["keyword-operator", "til"], + ["keyword-operator", "to"], + ["keyword-operator", "typeof"], + ["keyword-operator", "with"], + ["keyword-operator", "xor"] +] + +---------------------------------------------------- + +Checks for all keyword operators. \ No newline at end of file diff --git a/tests/languages/livescript/keyword_feature.test b/tests/languages/livescript/keyword_feature.test new file mode 100644 index 0000000000..123f37d5fd --- /dev/null +++ b/tests/languages/livescript/keyword_feature.test @@ -0,0 +1,87 @@ +break +case +catch +class +const +continue +default +do +else +extends +fallthrough +finally +for +for ever +function +if +implements +it +let +loop +new +null +otherwise +own +return +super +switch +that +then +this +throw +try +unless +until +var +void +when +while +yield + +---------------------------------------------------- + +[ + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "catch"], + ["keyword", "class"], + ["keyword", "const"], + ["keyword", "continue"], + ["keyword", "default"], + ["keyword", "do"], + ["keyword", "else"], + ["keyword", "extends"], + ["keyword", "fallthrough"], + ["keyword", "finally"], + ["keyword", "for"], + ["keyword", "for ever"], + ["keyword", "function"], + ["keyword", "if"], + ["keyword", "implements"], + ["keyword", "it"], + ["keyword", "let"], + ["keyword", "loop"], + ["keyword", "new"], + ["keyword", "null"], + ["keyword", "otherwise"], + ["keyword", "own"], + ["keyword", "return"], + ["keyword", "super"], + ["keyword", "switch"], + ["keyword", "that"], + ["keyword", "then"], + ["keyword", "this"], + ["keyword", "throw"], + ["keyword", "try"], + ["keyword", "unless"], + ["keyword", "until"], + ["keyword", "var"], + ["keyword", "void"], + ["keyword", "when"], + ["keyword", "while"], + ["keyword", "yield"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/tests/languages/livescript/number_feature.test b/tests/languages/livescript/number_feature.test new file mode 100644 index 0000000000..7375927f83 --- /dev/null +++ b/tests/languages/livescript/number_feature.test @@ -0,0 +1,21 @@ +42 42_ 42km 42km_2 +4.514 0.47foo_7 +4_8_7_4.2_4_7 +4~12 +16~badFaCE +36~azertyuiop0123456789 + +---------------------------------------------------- + +[ + ["number", "42"], ["number", "42_"], ["number", "42km"], ["number", "42km_2"], + ["number", "4.514"], ["number", "0.47foo_7"], + ["number", "4_8_7_4.2_4_7"], + ["number", "4~12"], + ["number", "16~badFaCE"], + ["number", "36~azertyuiop0123456789"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/tests/languages/livescript/operator_feature.test b/tests/languages/livescript/operator_feature.test new file mode 100644 index 0000000000..d9565b24fd --- /dev/null +++ b/tests/languages/livescript/operator_feature.test @@ -0,0 +1,55 @@ +a . b +.= .~ .. ... +.&. .^. .<<. .>>. .>>>. +:= :: ::= +&& +|| |> +< << <<< <<<< +<- <-- <-! <--! +<~ <~~ <~! <~~! +<| <= >> >= >? +- -- -> --> ++ ++ +@ @@ +% %% +* ** +! != !~= +!~> !~~> +!-> !--> +~ ~> ~~> ~= += == +^ ^^ +/ ? + +---------------------------------------------------- + +[ + ["identifier", "a"], ["operator", "."], ["identifier", "b"], + ["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", "<~~"], ["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", "!~~>"], + ["operator", "!->"], ["operator", "!-->"], + ["operator", "~"], ["operator", "~>"], ["operator", "~~>"], ["operator", "~="], + ["operator", "="], ["operator", "=="], + ["operator", "^"], ["operator", "^^"], + ["operator", "/"], ["operator", "?"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/tests/languages/livescript/regex_feature.test b/tests/languages/livescript/regex_feature.test new file mode 100644 index 0000000000..0369ddb83f --- /dev/null +++ b/tests/languages/livescript/regex_feature.test @@ -0,0 +1,27 @@ +/foo[bar]/igm +// +foo | +[bar]* +//igmuy +// +foo #bar +[baz] # foo bar +// + +---------------------------------------------------- + +[ + ["regex", "/foo[bar]/igm"], + ["regex", ["//\r\nfoo |\r\n[bar]*\r\n//igmuy"]], + ["regex", [ + "//\r\nfoo ", + ["comment", "#bar"], + "\r\n[baz] ", + ["comment", "# foo bar"], + "\r\n//" + ]] +] + +---------------------------------------------------- + +Checks for regexps. \ No newline at end of file diff --git a/tests/languages/livescript/string_feature.test b/tests/languages/livescript/string_feature.test new file mode 100644 index 0000000000..313a1311a5 --- /dev/null +++ b/tests/languages/livescript/string_feature.test @@ -0,0 +1,32 @@ +'''''' +'''Foo\'''bar''' +'''Foo +bar''' + +'' +'Foo\'bar' +'Foo +bar' + +<[ foo bar baz ]> + +\foo \bar \"({[-!@^+baz + +---------------------------------------------------- + +[ + ["string", "''''''"], + ["string", "'''Foo\\'''bar'''"], + ["string", "'''Foo\r\nbar'''"], + ["string", "''"], + ["string", "'Foo\\'bar'"], + ["string", "'Foo\r\nbar'"], + ["string", "<[ foo bar baz ]>"], + ["string", "\\foo"], + ["string", "\\bar"], + ["string", "\\\"({[-!@^+baz"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file