From 4cd381fce47aa50008f1db54d9cb5228e61e2751 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Mon, 20 Sep 2021 14:20:31 +0200 Subject: [PATCH 1/7] Add tremor project DSL langauge definitions Signed-off-by: Darach Ennis --- components.js | 2 +- components.json | 12 ++ components/prism-tremor.js | 39 ++++++ components/prism-tremor.min.js | 1 + examples/prism-tremor.html | 82 +++++++++++++ plugins/autoloader/prism-autoloader.js | 2 + plugins/autoloader/prism-autoloader.min.js | 2 +- plugins/show-language/prism-show-language.js | 2 + .../show-language/prism-show-language.min.js | 2 +- tests/languages/tremor/boolean_feature.test | 15 +++ tests/languages/tremor/comment_feature.test | 15 +++ .../tremor/keyword_escape_feature.test | 115 ++++++++++++++++++ tests/languages/tremor/keyword_feature.test | 115 ++++++++++++++++++ tests/languages/tremor/number_feature.test | 19 +++ tests/languages/tremor/string_feature.test | 26 ++++ tests/languages/tremor/variable_feature.test | 17 +++ 16 files changed, 463 insertions(+), 3 deletions(-) create mode 100644 components/prism-tremor.js create mode 100644 components/prism-tremor.min.js create mode 100644 examples/prism-tremor.html create mode 100644 tests/languages/tremor/boolean_feature.test create mode 100644 tests/languages/tremor/comment_feature.test create mode 100644 tests/languages/tremor/keyword_escape_feature.test create mode 100644 tests/languages/tremor/keyword_feature.test create mode 100644 tests/languages/tremor/number_feature.test create mode 100644 tests/languages/tremor/string_feature.test create mode 100644 tests/languages/tremor/variable_feature.test diff --git a/components.js b/components.js index 71effa5499..d6c3ff9bb1 100644 --- a/components.js +++ b/components.js @@ -1,2 +1,2 @@ -var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avisynth":{"title":"AviSynth","alias":"avs","owner":"Zinfidel"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gap":{"title":"GAP (CAS)","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":"hbs","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"kusto":{"title":"Kusto","owner":"RunDevelopment"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"magma":{"title":"Magma (CAS)","owner":"RunDevelopment"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"maxscript":{"title":"MAXScript","owner":"RunDevelopment"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"cshtml":{"title":"Razor C#","alias":"razor","require":["markup","csharp"],"optional":["css","css-extras","javascript","js-extras"],"owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"wren":{"title":"Wren","owner":"clsource"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; +var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avisynth":{"title":"AviSynth","alias":"avs","owner":"Zinfidel"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gap":{"title":"GAP (CAS)","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":"hbs","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"kusto":{"title":"Kusto","owner":"RunDevelopment"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"magma":{"title":"Magma (CAS)","owner":"RunDevelopment"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"maxscript":{"title":"MAXScript","owner":"RunDevelopment"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"cshtml":{"title":"Razor C#","alias":"razor","require":["markup","csharp"],"optional":["css","css-extras","javascript","js-extras"],"owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tremor":{"title":"Tremor","alias":["trickle","troy"],"owner":"darach","aliasTitles":{"trickle":"trickle","troy":"troy"}},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"wren":{"title":"Wren","owner":"clsource"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; if (typeof module !== 'undefined' && module.exports) { module.exports = components; } \ No newline at end of file diff --git a/components.json b/components.json index c1dff4b04c..1dac8a807d 100644 --- a/components.json +++ b/components.json @@ -1313,6 +1313,18 @@ "title": "TOML", "owner": "RunDevelopment" }, + "tremor": { + "title": "Tremor", + "alias": [ + "trickle", + "troy" + ], + "owner": "darach", + "aliasTitles": { + "trickle": "trickle", + "troy": "troy" + } + }, "turtle": { "title": "Turtle", "alias": "trig", diff --git a/components/prism-tremor.js b/components/prism-tremor.js new file mode 100644 index 0000000000..55b00d7344 --- /dev/null +++ b/components/prism-tremor.js @@ -0,0 +1,39 @@ +// NOTE: Tremor supports recursive nested interpolation in strings +// but we do support intperpolation in this definition as nested +// recursive interpolation isn't yet fully supported by prism. + +Prism.languages.tremor = { + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, + lookbehind: true + }, + 'heredoc': { + pattern: /"""(?:[^"]|("[^"])|(""[^"]))+"""/, + greedy: true, + alias: "string" + }, + 'string': { + pattern: /"(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])+"|""/, + greedy: true, + alias: "string" + }, + 'function': /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/, + 'keyword': /\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/, + 'boolean': /\b(?:true|false|null)\b/i, + 'variable': { + pattern: /(`[^`]*`)|\b([_a-z][_a-zA-Z0-9]*\b)/, + greedy: true + }, + 'number': /\b(0b[0-1_]*)|(0x[0-9a-fA-F_]*)|(([0-9][0-9_]*)(\.[0-9][0-9_]*)?((e|E)(\+|-)?[0-9_]+)?)\b/, + 'operator': /\b[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|\b(?:not|and|or|xor|present|absent)\b/, + 'punctuation': /[;\[\]()\{\},.]/, + 'namespace': { + pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/, + inside: { + 'punctuation': /::/ + } + }, +}; + +Prism.languages.troy = Prism.languages['tremor']; +Prism.languages.trickle = Prism.languages['tremor']; diff --git a/components/prism-tremor.min.js b/components/prism-tremor.min.js new file mode 100644 index 0000000000..700ae86d8a --- /dev/null +++ b/components/prism-tremor.min.js @@ -0,0 +1 @@ +Prism.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},heredoc:{pattern:/"""(?:[^"]|("[^"])|(""[^"]))+"""/,greedy:!0,alias:"string"},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])+"|""/,greedy:!0,alias:"string"},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/,boolean:/\b(?:true|false|null)\b/i,variable:{pattern:/(`[^`]*`)|\b([_a-z][_a-zA-Z0-9]*\b)/,greedy:!0},number:/\b(0b[0-1_]*)|(0x[0-9a-fA-F_]*)|(([0-9][0-9_]*)(\.[0-9][0-9_]*)?((e|E)(\+|-)?[0-9_]+)?)\b/,operator:/\b[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|\b(?:not|and|or|xor|present|absent)\b/,punctuation:/[;\[\]()\{\},.]/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}}},Prism.languages.troy=Prism.languages.tremor,Prism.languages.trickle=Prism.languages.tremor; \ No newline at end of file diff --git a/examples/prism-tremor.html b/examples/prism-tremor.html new file mode 100644 index 0000000000..c0c89e2753 --- /dev/null +++ b/examples/prism-tremor.html @@ -0,0 +1,82 @@ +

Comments

+
# Single line comment
+### Module level documentation comment
+## Statement level documentation comment
+# Regular code comment
+
+ +

Strings

+

+# double quote single line strings
+"foo \"bar\" baz"
+
+# heredocs or multiline strings
+"""
+{ "snot": "badger" }
+"""
+
+ +

Variables

+

+# Immutable constants
+const snot = "fleek";
+
+# Mutable variables
+let badger = "flook";
+
+ +

Operators

+

+merge {} of
+  { "snot": "badger" }
+end;
+
+patch {} of
+  insert snot = "badger"
+end;
+
+ +

Functions and keywords

+

+fn fib_(a, b, n) of
+case (a, b, n) when n > 0 => recur(b, a + b, n - 1)
+default => a
+end;
+
+fn fib(n) with
+fib_(0, 1, n)
+end;
+
+fib(event)
+
+ +

Queries

+

+	define script fib
+	script
+        fn fib_(a, b, n) of
+            case (a, b, n) when n > 0 => recur(b, a + b, n - 1)
+            default => a
+        end;
+
+        fn fib(n) with
+            fib_(0, 1, n)
+        end;
+
+		{ "fib": fib(event.n) }
+	end;
+
+	create script fib;
+	select event.n from in into fib;
+	select event from fib into out;
+
+ +

Deployments

+

+define pipeline passthrough
+pipeline
+  select event from in into out;
+end;
+
+deploy pipeline passthrough;
+
\ No newline at end of file diff --git a/plugins/autoloader/prism-autoloader.js b/plugins/autoloader/prism-autoloader.js index ae93dc13af..c3fe286080 100644 --- a/plugins/autoloader/prism-autoloader.js +++ b/plugins/autoloader/prism-autoloader.js @@ -239,6 +239,8 @@ "sln": "solution-file", "rq": "sparql", "t4": "t4-cs", + "trickle": "tremor", + "troy": "tremor", "trig": "turtle", "ts": "typescript", "tsconfig": "typoscript", diff --git a/plugins/autoloader/prism-autoloader.min.js b/plugins/autoloader/prism-autoloader.min.js index 6cd311883e..1cc0963358 100644 --- a/plugins/autoloader/prism-autoloader.min.js +++ b/plugins/autoloader/prism-autoloader.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var l={javascript:"clike",actionscript:"javascript",apex:["clike","sql"],arduino:"cpp",aspnet:["markup","csharp"],birb:"clike",bison:"c",c:"clike",csharp:"clike",cpp:"c",cfscript:"clike",chaiscript:["clike","cpp"],coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",gml:"clike",glsl:"c",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",hlsl:"c",idris:"haskell",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike","typescript"],"js-extras":"javascript",json5:"json",jsonp:"json","js-templates":"javascript",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",liquid:"markup-templating",markdown:"markup","markup-templating":"markup",mongodb:"javascript",n4js:"javascript",objectivec:"c",opencl:"c",parser:"markup",php:"markup-templating",phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],purebasic:"clike",purescript:"haskell",qsharp:"clike",qml:"javascript",qore:"clike",racket:"scheme",cshtml:["markup","csharp"],jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",squirrel:"clike","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","vbnet"],tap:"yaml",tt2:["clike","markup-templating"],textile:"markup",twig:"markup",typescript:"javascript",v:"clike",vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup","xml-doc":"markup",xquery:"markup"},n={html:"markup",xml:"markup",svg:"markup",mathml:"markup",ssml:"markup",atom:"markup",rss:"markup",js:"javascript",g4:"antlr4",adoc:"asciidoc",avs:"avisynth",avdl:"avro-idl",shell:"bash",shortcode:"bbcode",rbnf:"bnf",oscript:"bsl",cs:"csharp",dotnet:"csharp",cfc:"cfscript",coffee:"coffeescript",conc:"concurnas",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",gv:"dot",eta:"ejs",xlsx:"excel-formula",xls:"excel-formula",gamemakerlanguage:"gml",gni:"gn",hbs:"handlebars",hs:"haskell",idr:"idris",gitignore:"ignore",hgignore:"ignore",npmignore:"ignore",webmanifest:"json",kt:"kotlin",kts:"kotlin",kum:"kumir",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",nani:"naniscript",objc:"objectivec",qasm:"openqasm",objectpascal:"pascal",px:"pcaxis",pcode:"peoplecode",pq:"powerquery",mscript:"powerquery",pbfasm:"purebasic",purs:"purescript",py:"python",qs:"qsharp",rkt:"racket",razor:"cshtml",rpy:"renpy",robot:"robotframework",rb:"ruby","sh-session":"shell-session",shellsession:"shell-session",smlnj:"sml",sol:"solidity",sln:"solution-file",rq:"sparql",t4:"t4-cs",trig:"turtle",ts:"typescript",tsconfig:"typoscript",uscript:"unrealscript",uc:"unrealscript",url:"uri",vb:"visual-basic",vba:"visual-basic",mathematica:"wolfram",nb:"wolfram",wl:"wolfram",xeoracube:"xeora",yml:"yaml"},p={},e="components/",a=Prism.util.currentScript();if(a){var r=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,s=/(^|\/)[\w-]+\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,i=a.getAttribute("data-autoloader-path");if(null!=i)e=i.trim().replace(/\/?$/,"/");else{var t=a.src;r.test(t)?e=t.replace(r,"components/"):s.test(t)&&(e=t.replace(s,"$1components/"))}}var o=Prism.plugins.autoloader={languages_path:e,use_minified:!0,loadLanguages:m};Prism.hooks.add("complete",function(e){var a=e.element,r=e.language;if(a&&r&&"none"!==r){var s=function(e){var a=(e.getAttribute("data-dependencies")||"").trim();if(!a){var r=e.parentElement;r&&"pre"===r.tagName.toLowerCase()&&(a=(r.getAttribute("data-dependencies")||"").trim())}return a?a.split(/\s*,\s*/g):[]}(a);/^diff-./i.test(r)?(s.push("diff"),s.push(r.substr("diff-".length))):s.push(r),s.every(u)||m(s,function(){Prism.highlightElement(a)})}})}function u(e){if(0<=e.indexOf("!"))return!1;if((e=n[e]||e)in Prism.languages)return!0;var a=p[e];return a&&!a.error&&!1===a.loading}function m(e,a,r){"string"==typeof e&&(e=[e]);var s=e.length,i=0,t=!1;function c(){t||++i===s&&a&&a(e)}0!==s?e.forEach(function(e){!function(a,r,s){var i=0<=a.indexOf("!");function e(){var e=p[a];e||(e=p[a]={callbacks:[]}),e.callbacks.push({success:r,error:s}),!i&&u(a)?k(a,"success"):!i&&e.error?k(a,"error"):!i&&e.loading||(e.loading=!0,e.error=!1,function(e,a,r){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),a&&a()},s.onerror=function(){document.body.removeChild(s),r&&r()},document.body.appendChild(s)}(function(e){return o.languages_path+"prism-"+e+(o.use_minified?".min":"")+".js"}(a),function(){e.loading=!1,k(a,"success")},function(){e.loading=!1,e.error=!0,k(a,"error")}))}a=a.replace("!",""),a=n[a]||a;var t=l[a];t&&t.length?m(t,e,s):e()}(e,c,function(){t||(t=!0,r&&r(e))})}):a&&setTimeout(a,0)}function k(e,a){if(p[e]){for(var r=p[e].callbacks,s=0,i=r.length;s Date: Mon, 20 Sep 2021 18:15:50 +0200 Subject: [PATCH 2/7] Update components/prism-tremor.js Apply fix worst-case time complexity per @RunDevelopment's insight Co-authored-by: Michael Schmidt --- components/prism-tremor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/prism-tremor.js b/components/prism-tremor.js index 55b00d7344..ab429ce9de 100644 --- a/components/prism-tremor.js +++ b/components/prism-tremor.js @@ -13,7 +13,8 @@ Prism.languages.tremor = { alias: "string" }, 'string': { - pattern: /"(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])+"|""/, + pattern: /(^|[^\\])"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/, + lookbehind: true greedy: true, alias: "string" }, From 3700a655049ffca5af599b2ed06a89fe27736772 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Mon, 20 Sep 2021 18:16:39 +0200 Subject: [PATCH 3/7] Update components/prism-tremor.js Terser formulation of pattern Co-authored-by: Michael Schmidt --- components/prism-tremor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-tremor.js b/components/prism-tremor.js index ab429ce9de..47ea15c618 100644 --- a/components/prism-tremor.js +++ b/components/prism-tremor.js @@ -22,7 +22,7 @@ Prism.languages.tremor = { 'keyword': /\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/, 'boolean': /\b(?:true|false|null)\b/i, 'variable': { - pattern: /(`[^`]*`)|\b([_a-z][_a-zA-Z0-9]*\b)/, + pattern: /`[^`]*`|\b[_a-z]\w*\b/, greedy: true }, 'number': /\b(0b[0-1_]*)|(0x[0-9a-fA-F_]*)|(([0-9][0-9_]*)(\.[0-9][0-9_]*)?((e|E)(\+|-)?[0-9_]+)?)\b/, From 9a1cbed230b2598b2c360e220d034f42c361e2cf Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Mon, 20 Sep 2021 18:17:15 +0200 Subject: [PATCH 4/7] Update components/prism-tremor.js Terser formulation of pattern Co-authored-by: Michael Schmidt --- components/prism-tremor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-tremor.js b/components/prism-tremor.js index 47ea15c618..550a061b43 100644 --- a/components/prism-tremor.js +++ b/components/prism-tremor.js @@ -25,7 +25,7 @@ Prism.languages.tremor = { pattern: /`[^`]*`|\b[_a-z]\w*\b/, greedy: true }, - 'number': /\b(0b[0-1_]*)|(0x[0-9a-fA-F_]*)|(([0-9][0-9_]*)(\.[0-9][0-9_]*)?((e|E)(\+|-)?[0-9_]+)?)\b/, + 'number': /\b(?:0b[0-1_]*|0x[0-9a-fA-F_]*|\d[0-9_]*(?:\.\d[0-9_]*)?(?:[Ee][+-]?[0-9_]+)?)\b/, 'operator': /\b[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|\b(?:not|and|or|xor|present|absent)\b/, 'punctuation': /[;\[\]()\{\},.]/, 'namespace': { From 00e0bc25bea82a37e625a859cac4dc8099547ed1 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Mon, 20 Sep 2021 18:18:11 +0200 Subject: [PATCH 5/7] Update components/prism-tremor.js Terser formulation of pattern Co-authored-by: Michael Schmidt --- components/prism-tremor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-tremor.js b/components/prism-tremor.js index 550a061b43..335e84ff9d 100644 --- a/components/prism-tremor.js +++ b/components/prism-tremor.js @@ -8,7 +8,7 @@ Prism.languages.tremor = { lookbehind: true }, 'heredoc': { - pattern: /"""(?:[^"]|("[^"])|(""[^"]))+"""/, + pattern: /"""(?:[^"]|"(?!""))+"""/, greedy: true, alias: "string" }, From 1b3316a68f713a986dac43a120a669c8764caf39 Mon Sep 17 00:00:00 2001 From: Darach Ennis Date: Mon, 20 Sep 2021 21:57:36 +0200 Subject: [PATCH 6/7] Add partial interpolation, expand tests, attend to lints Signed-off-by: Darach Ennis --- components/prism-tremor.js | 55 ++++----- components/prism-tremor.min.js | 2 +- .../tremor/keyword_escape_feature.test | 106 +++++++++--------- .../languages/tremor/modularity_feature.test | 43 +++++++ tests/languages/tremor/operator_feature.test | 57 ++++++++++ tests/languages/tremor/string_feature.test | 60 ++++++++-- tests/languages/tremor/variable_feature.test | 8 +- 7 files changed, 241 insertions(+), 90 deletions(-) create mode 100644 tests/languages/tremor/modularity_feature.test create mode 100644 tests/languages/tremor/operator_feature.test diff --git a/components/prism-tremor.js b/components/prism-tremor.js index 335e84ff9d..0543e6615b 100644 --- a/components/prism-tremor.js +++ b/components/prism-tremor.js @@ -1,39 +1,44 @@ // NOTE: Tremor supports recursive nested interpolation in strings -// but we do support intperpolation in this definition as nested -// recursive interpolation isn't yet fully supported by prism. +// and heredocs but we use a partial interpolation method here. The +// string language rule pattern supports both single and triple double-quote +// delimited strings. +// Prism.languages.tremor = { 'comment': { pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, lookbehind: true }, - 'heredoc': { - pattern: /"""(?:[^"]|"(?!""))+"""/, - greedy: true, - alias: "string" + 'string': { + pattern: /"""(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"""|"(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"/, + greedy: true, + inside: { + 'interpolation': { + pattern: /#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\}/, + inside: { + 'punctuation': /^#\{|\}$/, + 'expression': { + pattern: /[\s\S]+/, + inside: Prism.languages.tremor + } + } + }, + 'string': /[\s\S]+/ + } }, - 'string': { - pattern: /(^|[^\\])"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/, - lookbehind: true - greedy: true, - alias: "string" - }, - 'function': /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/, + 'function': /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/, 'keyword': /\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/, 'boolean': /\b(?:true|false|null)\b/i, - 'variable': { - pattern: /`[^`]*`|\b[_a-z]\w*\b/, - greedy: true - }, 'number': /\b(?:0b[0-1_]*|0x[0-9a-fA-F_]*|\d[0-9_]*(?:\.\d[0-9_]*)?(?:[Ee][+-]?[0-9_]+)?)\b/, - 'operator': /\b[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|\b(?:not|and|or|xor|present|absent)\b/, - 'punctuation': /[;\[\]()\{\},.]/, - 'namespace': { - pattern: /(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/, - inside: { - 'punctuation': /::/ - } - }, + 'operator': /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?>?=?|(?:not|and|or|xor|present|absent)\b/, + 'punctuation': /[;\[\]()\{\},.%#]/, + 'variable': { + pattern: /(?:[a-z](?:[a-z_\d]+\s*)?::|`[^`]+`::)*(?:[a-z][a-z_\d]*|`[^`]+`)/, + greedy: true, + inside: { + 'punctuation': /::/ + } + }, }; Prism.languages.troy = Prism.languages['tremor']; diff --git a/components/prism-tremor.min.js b/components/prism-tremor.min.js index 700ae86d8a..7133895a01 100644 --- a/components/prism-tremor.min.js +++ b/components/prism-tremor.min.js @@ -1 +1 @@ -Prism.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},heredoc:{pattern:/"""(?:[^"]|("[^"])|(""[^"]))+"""/,greedy:!0,alias:"string"},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])+"|""/,greedy:!0,alias:"string"},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/,boolean:/\b(?:true|false|null)\b/i,variable:{pattern:/(`[^`]*`)|\b([_a-z][_a-zA-Z0-9]*\b)/,greedy:!0},number:/\b(0b[0-1_]*)|(0x[0-9a-fA-F_]*)|(([0-9][0-9_]*)(\.[0-9][0-9_]*)?((e|E)(\+|-)?[0-9_]+)?)\b/,operator:/\b[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|\b(?:not|and|or|xor|present|absent)\b/,punctuation:/[;\[\]()\{\},.]/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}}},Prism.languages.troy=Prism.languages.tremor,Prism.languages.trickle=Prism.languages.tremor; \ No newline at end of file +Prism.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},string:{pattern:/"""(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"""|"(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"/,greedy:!0,inside:{interpolation:{pattern:/#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\}/,inside:{punctuation:/^#\{|\}$/,expression:{pattern:/[\s\S]+/,inside:Prism.languages.tremor}}},string:/[\s\S]+/}},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/,boolean:/\b(?:true|false|null)\b/i,number:/\b(?:0b[0-1_]*|0x[0-9a-fA-F_]*|\d[0-9_]*(?:\.\d[0-9_]*)?(?:[Ee][+-]?[0-9_]+)?)\b/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?>?=?|(?:not|and|or|xor|present|absent)\b/,punctuation:/[;\[\]()\{\},.%#]/,variable:{pattern:/(?:[a-z](?:[a-z_\d]+\s*)?::|`[^`]+`::)*(?:[a-z][a-z_\d]*|`[^`]+`)/,lookbehind:!0,greedy:!0,inside:{punctuation:/::/}}},Prism.languages.troy=Prism.languages.tremor,Prism.languages.trickle=Prism.languages.tremor; \ No newline at end of file diff --git a/tests/languages/tremor/keyword_escape_feature.test b/tests/languages/tremor/keyword_escape_feature.test index fcbc59f8ea..f9b6e6cfdd 100644 --- a/tests/languages/tremor/keyword_escape_feature.test +++ b/tests/languages/tremor/keyword_escape_feature.test @@ -55,59 +55,59 @@ ---------------------------------------------------- [ - ["variable", "`args`"], - ["variable", "`as`"], - ["variable", "`by`"], - ["variable", "`case`"], - ["variable", "`config`"], - ["variable", "`connect`"], - ["variable", "`connector`"], - ["variable", "`const`"], - ["variable", "`copy`"], - ["variable", "`create`"], - ["variable", "`default`"], - ["variable", "`define`"], - ["variable", "`deploy`"], - ["variable", "`drop`"], - ["variable", "`each`"], - ["variable", "`emit`"], - ["variable", "`end`"], - ["variable", "`erase`"], - ["variable", "`event`"], - ["variable", "`flow`"], - ["variable", "`fn`"], - ["variable", "`for`"], - ["variable", "`from`"], - ["variable", "`group`"], - ["variable", "`having`"], - ["variable", "`insert`"], - ["variable", "`into`"], - ["variable", "`intrinsic`"], - ["variable", "`let`"], - ["variable", "`links`"], - ["variable", "`match`"], - ["variable", "`merge`"], - ["variable", "`mod`"], - ["variable", "`move`"], - ["variable", "`of`"], - ["variable", "`operator`"], - ["variable", "`patch`"], - ["variable", "`pipeline`"], - ["variable", "`recur`"], - ["variable", "`script`"], - ["variable", "`select`"], - ["variable", "`set`"], - ["variable", "`sliding`"], - ["variable", "`state`"], - ["variable", "`stream`"], - ["variable", "`to`"], - ["variable", "`tumbling`"], - ["variable", "`update`"], - ["variable", "`use`"], - ["variable", "`when`"], - ["variable", "`where`"], - ["variable", "`window`"], - ["variable", "`with`"] + ["variable", ["`args`"]], + ["variable", ["`as`"]], + ["variable", ["`by`"]], + ["variable", ["`case`"]], + ["variable", ["`config`"]], + ["variable", ["`connect`"]], + ["variable", ["`connector`"]], + ["variable", ["`const`"]], + ["variable", ["`copy`"]], + ["variable", ["`create`"]], + ["variable", ["`default`"]], + ["variable", ["`define`"]], + ["variable", ["`deploy`"]], + ["variable", ["`drop`"]], + ["variable", ["`each`"]], + ["variable", ["`emit`"]], + ["variable", ["`end`"]], + ["variable", ["`erase`"]], + ["variable", ["`event`"]], + ["variable", ["`flow`"]], + ["variable", ["`fn`"]], + ["variable", ["`for`"]], + ["variable", ["`from`"]], + ["variable", ["`group`"]], + ["variable", ["`having`"]], + ["variable", ["`insert`"]], + ["variable", ["`into`"]], + ["variable", ["`intrinsic`"]], + ["variable", ["`let`"]], + ["variable", ["`links`"]], + ["variable", ["`match`"]], + ["variable", ["`merge`"]], + ["variable", ["`mod`"]], + ["variable", ["`move`"]], + ["variable", ["`of`"]], + ["variable", ["`operator`"]], + ["variable", ["`patch`"]], + ["variable", ["`pipeline`"]], + ["variable", ["`recur`"]], + ["variable", ["`script`"]], + ["variable", ["`select`"]], + ["variable", ["`set`"]], + ["variable", ["`sliding`"]], + ["variable", ["`state`"]], + ["variable", ["`stream`"]], + ["variable", ["`to`"]], + ["variable", ["`tumbling`"]], + ["variable", ["`update`"]], + ["variable", ["`use`"]], + ["variable", ["`when`"]], + ["variable", ["`where`"]], + ["variable", ["`window`"]], + ["variable", ["`with`"]] ] ---------------------------------------------------- diff --git a/tests/languages/tremor/modularity_feature.test b/tests/languages/tremor/modularity_feature.test new file mode 100644 index 0000000000..5ac7cf5357 --- /dev/null +++ b/tests/languages/tremor/modularity_feature.test @@ -0,0 +1,43 @@ +foo +foo::bar +foo::bar::baz +`foo`::bar::`baz` +`foo` +`foo`::`bar`::`baz` + +---------------------------------------------------- + +[ + ["variable", ["foo"]], + ["variable", [ + "foo", + ["punctuation", "::"], + "bar" + ]], + ["variable", [ + "foo", + ["punctuation", "::"], + "bar", + ["punctuation", "::"], + "baz" + ]], + ["variable", [ + "`foo`", + ["punctuation", "::"], + "bar", + ["punctuation", "::"], + "`baz`" + ]], + ["variable", ["`foo`"]], + ["variable", [ + "`foo`", + ["punctuation", "::"], + "`bar`", + ["punctuation", "::"], + "`baz`" + ]] +] + +---------------------------------------------------- + +Checks modularity and references for bare/namespaced variables diff --git a/tests/languages/tremor/operator_feature.test b/tests/languages/tremor/operator_feature.test new file mode 100644 index 0000000000..08203c6c1c --- /dev/null +++ b/tests/languages/tremor/operator_feature.test @@ -0,0 +1,57 @@ +a + b +a - b +a / b +a * b +a % b +a += b +a -= b +a /= b +a *= b +a %= b +a = b +a == b +a < b +a <= b +a >= b +a << b +a >> b +a >>> b +not a +a and b +a or b +a xor b +present a +absent a + +---------------------------------------------------- + +[ + ["variable", ["a"]], ["operator", "+"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "-"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "/"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "*"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "%"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "+="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "-="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "/="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "*="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "%="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "=="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "<"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "<="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", ">="], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "<<"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", ">>"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", ">>>"], ["variable", ["b"]], + ["operator", "not"], ["variable", ["a"]], + ["variable", ["a"]], ["operator", "and"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "or"], ["variable", ["b"]], + ["variable", ["a"]], ["operator", "xor"], ["variable", ["b"]], + ["operator", "present"], ["variable", ["a"]], + ["operator", "absent"], ["variable", ["a"]] +] + +---------------------------------------------------- + +Checks for operators diff --git a/tests/languages/tremor/string_feature.test b/tests/languages/tremor/string_feature.test index cbb89461db..18368137ab 100644 --- a/tests/languages/tremor/string_feature.test +++ b/tests/languages/tremor/string_feature.test @@ -8,17 +8,63 @@ bar" """ multiline """ +"snot#{badger}badger" ---------------------------------------------------- [ - ["string", "\"\""], - ["string", "\"\" \"\""], - ["heredoc", "\"\"\"\r\n\"\"\""], - ["string", "\"fo\\\"obar\""], - "\r\n\"", ["variable", "foo"], - ["variable", "bar"], "\"\r\n", - ["heredoc", "\"\"\"\r\nmultiline\r\n\"\"\""] + ["string", [ + ["string", "\"\""] + ]], + + ["string", [ + ["string", "\"\""] + ]], + ["string", [ + ["string", "\"\""] + ]], + + ["string", [ + ["string", "\"\""] + ]], + "\"\r\n", + + ["string", [ + ["string", "\"\""] + ]], + "\"\r\n", + + ["string", [ + ["string", "\"fo\\\"obar\""] + ]], + + "\r\n\"", + ["variable", ["foo"]], + + ["variable", ["bar"]], + "\"\r\n", + + ["string", [ + ["string", "\"\""] + ]], + "\"\r\n", + + ["variable", ["multiline"]], + + ["string", [ + ["string", "\"\""] + ]], + "\"\r\n", + + ["string", [ + ["string", "\"snot"], + ["interpolation", [ + ["punctuation", "#{"], + ["expression", "badger"], + ["punctuation", "}"] + ]], + ["string", "badger\""] + ]] ] ---------------------------------------------------- diff --git a/tests/languages/tremor/variable_feature.test b/tests/languages/tremor/variable_feature.test index fd71965f2e..ea9e7e5ed4 100644 --- a/tests/languages/tremor/variable_feature.test +++ b/tests/languages/tremor/variable_feature.test @@ -6,10 +6,10 @@ foo_bar_42 ---------------------------------------------------- [ - ["variable", "foo"], - ["variable", "foo_bar_42"], - ["variable", "`foo`"], - ["variable", "`bar`"] + ["variable", ["foo"]], + ["variable", ["foo_bar_42"]], + ["variable", ["`foo`"]], + ["variable", ["`bar`"]] ] ---------------------------------------------------- From dba2ff673f627ed952babd48d4f07dcf4c1f76d7 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 21 Sep 2021 20:41:39 +0200 Subject: [PATCH 7/7] Improved Tremor tokenization Signed-off-by: Michael Schmidt --- components/prism-tremor.js | 85 +++++++++----- components/prism-tremor.min.js | 2 +- tests/languages/tremor/extractor_feature.test | 15 +++ .../languages/tremor/identifier_feature.test | 12 ++ .../tremor/keyword_escape_feature.test | 106 +++++++++--------- .../languages/tremor/modularity_feature.test | 49 ++++---- tests/languages/tremor/operator_feature.test | 100 +++++++++-------- .../languages/tremor/punctuation_feature.test | 29 +++++ tests/languages/tremor/string_feature.test | 73 +++++++----- tests/languages/tremor/variable_feature.test | 17 --- 10 files changed, 281 insertions(+), 207 deletions(-) create mode 100644 tests/languages/tremor/extractor_feature.test create mode 100644 tests/languages/tremor/identifier_feature.test create mode 100644 tests/languages/tremor/punctuation_feature.test delete mode 100644 tests/languages/tremor/variable_feature.test diff --git a/components/prism-tremor.js b/components/prism-tremor.js index 0543e6615b..213d6c3e10 100644 --- a/components/prism-tremor.js +++ b/components/prism-tremor.js @@ -1,20 +1,55 @@ -// NOTE: Tremor supports recursive nested interpolation in strings -// and heredocs but we use a partial interpolation method here. The -// string language rule pattern supports both single and triple double-quote -// delimited strings. -// - -Prism.languages.tremor = { - 'comment': { - pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, - lookbehind: true - }, - 'string': { - pattern: /"""(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"""|"(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"/, +(function (Prism) { + + Prism.languages.tremor = { + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/, + lookbehind: true + }, + 'interpolated-string': null, // see below + 'extractor': { + pattern: /\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i, + greedy: true, + inside: { + 'function': /^\w+/, + 'regex': /\|[\s\S]+/, + } + }, + 'identifier': { + pattern: /`[^`]*`/, + greedy: true + }, + + 'function': /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/, + + 'keyword': /\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/, + 'boolean': /\b(?:true|false|null)\b/i, + + 'number': /\b(?:0b[0-1_]*|0x[0-9a-fA-F_]*|\d[0-9_]*(?:\.\d[0-9_]*)?(?:[Ee][+-]?[0-9_]+)?)\b/, + + 'pattern-punctuation': { + pattern: /%(?=[({[])/, + alias: 'punctuation' + }, + 'operator': /[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?>?=?|(?:not|and|or|xor|present|absent)\b/, + 'punctuation': /::|[;\[\]()\{\},.:]/, + }; + + var interpolationPattern = /#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*")*\}/.source; + + Prism.languages.tremor['interpolated-string'] = { + pattern: RegExp( + /(^|[^\\])/.source + + '(?:' + + '"""(?:' + /[^"\\#]|\\[\s\S]|"(?!"")|#(?!\{)/.source + '|' + interpolationPattern + ')*"""' + + '|' + + '"(?:' + /[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)/.source + '|' + interpolationPattern + ')*"' + + ')' + ), + lookbehind: true, greedy: true, inside: { 'interpolation': { - pattern: /#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\}/, + pattern: RegExp(interpolationPattern), inside: { 'punctuation': /^#\{|\}$/, 'expression': { @@ -25,21 +60,9 @@ Prism.languages.tremor = { }, 'string': /[\s\S]+/ } - }, - 'function': /\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/, - 'keyword': /\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/, - 'boolean': /\b(?:true|false|null)\b/i, - 'number': /\b(?:0b[0-1_]*|0x[0-9a-fA-F_]*|\d[0-9_]*(?:\.\d[0-9_]*)?(?:[Ee][+-]?[0-9_]+)?)\b/, - 'operator': /[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?>?=?|(?:not|and|or|xor|present|absent)\b/, - 'punctuation': /[;\[\]()\{\},.%#]/, - 'variable': { - pattern: /(?:[a-z](?:[a-z_\d]+\s*)?::|`[^`]+`::)*(?:[a-z][a-z_\d]*|`[^`]+`)/, - greedy: true, - inside: { - 'punctuation': /::/ - } - }, -}; + }; + + Prism.languages.troy = Prism.languages['tremor']; + Prism.languages.trickle = Prism.languages['tremor']; -Prism.languages.troy = Prism.languages['tremor']; -Prism.languages.trickle = Prism.languages['tremor']; +}(Prism)); diff --git a/components/prism-tremor.min.js b/components/prism-tremor.min.js index 7133895a01..a7b728ff06 100644 --- a/components/prism-tremor.min.js +++ b/components/prism-tremor.min.js @@ -1 +1 @@ -Prism.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},string:{pattern:/"""(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"""|"(?:[^"\\\r\n#]|\\(?:\r\n|[\s\S])|#(?!\{)|#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"/,greedy:!0,inside:{interpolation:{pattern:/#\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\}/,inside:{punctuation:/^#\{|\}$/,expression:{pattern:/[\s\S]+/,inside:Prism.languages.tremor}}},string:/[\s\S]+/}},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/,boolean:/\b(?:true|false|null)\b/i,number:/\b(?:0b[0-1_]*|0x[0-9a-fA-F_]*|\d[0-9_]*(?:\.\d[0-9_]*)?(?:[Ee][+-]?[0-9_]+)?)\b/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?>?=?|(?:not|and|or|xor|present|absent)\b/,punctuation:/[;\[\]()\{\},.%#]/,variable:{pattern:/(?:[a-z](?:[a-z_\d]+\s*)?::|`[^`]+`::)*(?:[a-z][a-z_\d]*|`[^`]+`)/,lookbehind:!0,greedy:!0,inside:{punctuation:/::/}}},Prism.languages.troy=Prism.languages.tremor,Prism.languages.trickle=Prism.languages.tremor; \ No newline at end of file +!function(e){e.languages.tremor={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},"interpolated-string":null,extractor:{pattern:/\b[a-z_]\w*\|(?:[^\r\n\\|]|\\(?:\r\n|[\s\S]))*\|/i,greedy:!0,inside:{function:/^\w+/,regex:/\|[\s\S]+/}},identifier:{pattern:/`[^`]*`/,greedy:!0},function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())\b/,keyword:/\b(?:event|state|select|create|define|deploy|operator|script|connector|pipeline|flow|config|links|connect|to|from|into|with|group|by|args|window|stream|tumbling|sliding|where|having|set|each|emit|drop|const|let|for|match|of|case|when|default|end|patch|insert|update|erase|move|copy|merge|fn|intrinsic|recur|use|as|mod)\b/,boolean:/\b(?:true|false|null)\b/i,number:/\b(?:0b[0-1_]*|0x[0-9a-fA-F_]*|\d[0-9_]*(?:\.\d[0-9_]*)?(?:[Ee][+-]?[0-9_]+)?)\b/,"pattern-punctuation":{pattern:/%(?=[({[])/,alias:"punctuation"},operator:/[-+*\/%~!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?>?=?|(?:not|and|or|xor|present|absent)\b/,punctuation:/::|[;\[\]()\{\},.:]/};var n='#\\{(?:[^"{}]|\\{[^{}]*\\}|"(?:[^"\\\\\r\n]|\\\\(?:\r\n|[^]))*")*\\}';e.languages.tremor["interpolated-string"]={pattern:RegExp('(^|[^\\\\])(?:"""(?:[^"\\\\#]|\\\\[^]|"(?!"")|#(?!\\{)|'+n+')*"""|"(?:[^"\\\\\r\n#]|\\\\(?:\r\n|[^])|#(?!\\{)|'+n+')*")'),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:RegExp(n),inside:{punctuation:/^#\{|\}$/,expression:{pattern:/[\s\S]+/,inside:e.languages.tremor}}},string:/[\s\S]+/}},e.languages.troy=e.languages.tremor,e.languages.trickle=e.languages.tremor}(Prism); \ No newline at end of file diff --git a/tests/languages/tremor/extractor_feature.test b/tests/languages/tremor/extractor_feature.test new file mode 100644 index 0000000000..2ce2d536dc --- /dev/null +++ b/tests/languages/tremor/extractor_feature.test @@ -0,0 +1,15 @@ +re|^(?Pbat.*)$| +datetime|%Y-%m-%d %H:%M| + +---------------------------------------------------- + +[ + ["extractor", [ + ["function", "re"], + ["regex", "|^(?Pbat.*)$|"] + ]], + ["extractor", [ + ["function", "datetime"], + ["regex", "|%Y-%m-%d %H:%M|"] + ]] +] diff --git a/tests/languages/tremor/identifier_feature.test b/tests/languages/tremor/identifier_feature.test new file mode 100644 index 0000000000..c7fce26834 --- /dev/null +++ b/tests/languages/tremor/identifier_feature.test @@ -0,0 +1,12 @@ +foo +foo_bar_42 +`foo` +`bar` + +---------------------------------------------------- + +[ + "foo\r\nfoo_bar_42\r\n", + ["identifier", "`foo`"], + ["identifier", "`bar`"] +] diff --git a/tests/languages/tremor/keyword_escape_feature.test b/tests/languages/tremor/keyword_escape_feature.test index f9b6e6cfdd..bd1ec9fb3a 100644 --- a/tests/languages/tremor/keyword_escape_feature.test +++ b/tests/languages/tremor/keyword_escape_feature.test @@ -55,59 +55,59 @@ ---------------------------------------------------- [ - ["variable", ["`args`"]], - ["variable", ["`as`"]], - ["variable", ["`by`"]], - ["variable", ["`case`"]], - ["variable", ["`config`"]], - ["variable", ["`connect`"]], - ["variable", ["`connector`"]], - ["variable", ["`const`"]], - ["variable", ["`copy`"]], - ["variable", ["`create`"]], - ["variable", ["`default`"]], - ["variable", ["`define`"]], - ["variable", ["`deploy`"]], - ["variable", ["`drop`"]], - ["variable", ["`each`"]], - ["variable", ["`emit`"]], - ["variable", ["`end`"]], - ["variable", ["`erase`"]], - ["variable", ["`event`"]], - ["variable", ["`flow`"]], - ["variable", ["`fn`"]], - ["variable", ["`for`"]], - ["variable", ["`from`"]], - ["variable", ["`group`"]], - ["variable", ["`having`"]], - ["variable", ["`insert`"]], - ["variable", ["`into`"]], - ["variable", ["`intrinsic`"]], - ["variable", ["`let`"]], - ["variable", ["`links`"]], - ["variable", ["`match`"]], - ["variable", ["`merge`"]], - ["variable", ["`mod`"]], - ["variable", ["`move`"]], - ["variable", ["`of`"]], - ["variable", ["`operator`"]], - ["variable", ["`patch`"]], - ["variable", ["`pipeline`"]], - ["variable", ["`recur`"]], - ["variable", ["`script`"]], - ["variable", ["`select`"]], - ["variable", ["`set`"]], - ["variable", ["`sliding`"]], - ["variable", ["`state`"]], - ["variable", ["`stream`"]], - ["variable", ["`to`"]], - ["variable", ["`tumbling`"]], - ["variable", ["`update`"]], - ["variable", ["`use`"]], - ["variable", ["`when`"]], - ["variable", ["`where`"]], - ["variable", ["`window`"]], - ["variable", ["`with`"]] + ["identifier", "`args`"], + ["identifier", "`as`"], + ["identifier", "`by`"], + ["identifier", "`case`"], + ["identifier", "`config`"], + ["identifier", "`connect`"], + ["identifier", "`connector`"], + ["identifier", "`const`"], + ["identifier", "`copy`"], + ["identifier", "`create`"], + ["identifier", "`default`"], + ["identifier", "`define`"], + ["identifier", "`deploy`"], + ["identifier", "`drop`"], + ["identifier", "`each`"], + ["identifier", "`emit`"], + ["identifier", "`end`"], + ["identifier", "`erase`"], + ["identifier", "`event`"], + ["identifier", "`flow`"], + ["identifier", "`fn`"], + ["identifier", "`for`"], + ["identifier", "`from`"], + ["identifier", "`group`"], + ["identifier", "`having`"], + ["identifier", "`insert`"], + ["identifier", "`into`"], + ["identifier", "`intrinsic`"], + ["identifier", "`let`"], + ["identifier", "`links`"], + ["identifier", "`match`"], + ["identifier", "`merge`"], + ["identifier", "`mod`"], + ["identifier", "`move`"], + ["identifier", "`of`"], + ["identifier", "`operator`"], + ["identifier", "`patch`"], + ["identifier", "`pipeline`"], + ["identifier", "`recur`"], + ["identifier", "`script`"], + ["identifier", "`select`"], + ["identifier", "`set`"], + ["identifier", "`sliding`"], + ["identifier", "`state`"], + ["identifier", "`stream`"], + ["identifier", "`to`"], + ["identifier", "`tumbling`"], + ["identifier", "`update`"], + ["identifier", "`use`"], + ["identifier", "`when`"], + ["identifier", "`where`"], + ["identifier", "`window`"], + ["identifier", "`with`"] ] ---------------------------------------------------- diff --git a/tests/languages/tremor/modularity_feature.test b/tests/languages/tremor/modularity_feature.test index 5ac7cf5357..fd8ec5fe52 100644 --- a/tests/languages/tremor/modularity_feature.test +++ b/tests/languages/tremor/modularity_feature.test @@ -8,34 +8,27 @@ foo::bar::baz ---------------------------------------------------- [ - ["variable", ["foo"]], - ["variable", [ - "foo", - ["punctuation", "::"], - "bar" - ]], - ["variable", [ - "foo", - ["punctuation", "::"], - "bar", - ["punctuation", "::"], - "baz" - ]], - ["variable", [ - "`foo`", - ["punctuation", "::"], - "bar", - ["punctuation", "::"], - "`baz`" - ]], - ["variable", ["`foo`"]], - ["variable", [ - "`foo`", - ["punctuation", "::"], - "`bar`", - ["punctuation", "::"], - "`baz`" - ]] + "foo\r\nfoo", + ["punctuation", "::"], + "bar\r\nfoo", + ["punctuation", "::"], + "bar", + ["punctuation", "::"], + "baz\r\n", + + ["identifier", "`foo`"], + ["punctuation", "::"], + "bar", + ["punctuation", "::"], + ["identifier", "`baz`"], + + ["identifier", "`foo`"], + + ["identifier", "`foo`"], + ["punctuation", "::"], + ["identifier", "`bar`"], + ["punctuation", "::"], + ["identifier", "`baz`"] ] ---------------------------------------------------- diff --git a/tests/languages/tremor/operator_feature.test b/tests/languages/tremor/operator_feature.test index 08203c6c1c..226189cd9e 100644 --- a/tests/languages/tremor/operator_feature.test +++ b/tests/languages/tremor/operator_feature.test @@ -1,55 +1,59 @@ -a + b -a - b -a / b -a * b -a % b -a += b -a -= b -a /= b -a *= b -a %= b -a = b -a == b -a < b -a <= b -a >= b -a << b -a >> b -a >>> b -not a -a and b -a or b -a xor b -present a -absent a ++ - / * % ~ ^ & | ++= -= /= *= %= ~= ^= &= |= +== != < > <= >= += => + +! && || + +<< >> >>> +<<= >>= >>>= + +not and or xor present absent ---------------------------------------------------- [ - ["variable", ["a"]], ["operator", "+"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "-"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "/"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "*"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "%"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "+="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "-="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "/="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "*="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "%="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "=="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "<"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "<="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", ">="], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "<<"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", ">>"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", ">>>"], ["variable", ["b"]], - ["operator", "not"], ["variable", ["a"]], - ["variable", ["a"]], ["operator", "and"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "or"], ["variable", ["b"]], - ["variable", ["a"]], ["operator", "xor"], ["variable", ["b"]], - ["operator", "present"], ["variable", ["a"]], - ["operator", "absent"], ["variable", ["a"]] + ["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", "not"], + ["operator", "and"], + ["operator", "or"], + ["operator", "xor"], + ["operator", "present"], + ["operator", "absent"] ] ---------------------------------------------------- diff --git a/tests/languages/tremor/punctuation_feature.test b/tests/languages/tremor/punctuation_feature.test new file mode 100644 index 0000000000..57cd9ac349 --- /dev/null +++ b/tests/languages/tremor/punctuation_feature.test @@ -0,0 +1,29 @@ +( ) [ ] { } +, ; . : +%( ) %[ ] %{ } + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "."], + ["punctuation", ":"], + + ["pattern-punctuation", "%"], + ["punctuation", "("], + ["punctuation", ")"], + ["pattern-punctuation", "%"], + ["punctuation", "["], + ["punctuation", "]"], + ["pattern-punctuation", "%"], + ["punctuation", "{"], + ["punctuation", "}"] +] diff --git a/tests/languages/tremor/string_feature.test b/tests/languages/tremor/string_feature.test index 18368137ab..b9a5dea593 100644 --- a/tests/languages/tremor/string_feature.test +++ b/tests/languages/tremor/string_feature.test @@ -3,67 +3,82 @@ """ """ "fo\"obar" -"foo +"foo\ bar" """ multiline """ "snot#{badger}badger" +""" + I am + a + long + multi-line + string with #{ "#{a+1} interpolation" } +""" ---------------------------------------------------- [ - ["string", [ + ["interpolated-string", [ ["string", "\"\""] ]], - ["string", [ + ["interpolated-string", [ ["string", "\"\""] ]], - ["string", [ + ["interpolated-string", [ ["string", "\"\""] ]], - ["string", [ - ["string", "\"\""] + ["interpolated-string", [ + ["string", "\"\"\"\r\n\"\"\""] ]], - "\"\r\n", - ["string", [ - ["string", "\"\""] - ]], - "\"\r\n", - - ["string", [ + ["interpolated-string", [ ["string", "\"fo\\\"obar\""] ]], - "\r\n\"", - ["variable", ["foo"]], - - ["variable", ["bar"]], - "\"\r\n", - - ["string", [ - ["string", "\"\""] + ["interpolated-string", [ + ["string", "\"foo\\\r\nbar\""] ]], - "\"\r\n", - ["variable", ["multiline"]], - - ["string", [ - ["string", "\"\""] + ["interpolated-string", [ + ["string", "\"\"\"\r\nmultiline\r\n\"\"\""] ]], - "\"\r\n", - ["string", [ + ["interpolated-string", [ ["string", "\"snot"], ["interpolation", [ ["punctuation", "#{"], - ["expression", "badger"], + ["expression", ["badger"]], ["punctuation", "}"] ]], ["string", "badger\""] + ]], + + ["interpolated-string", [ + ["string", "\"\"\"\r\n I am\r\n a\r\n long\r\n multi-line\r\n string with "], + ["interpolation", [ + ["punctuation", "#{"], + ["expression", [ + ["interpolated-string", [ + ["string", "\""], + ["interpolation", [ + ["punctuation", "#{"], + ["expression", [ + "a", + ["operator", "+"], + ["number", "1"] + ]], + ["punctuation", "}"] + ]], + ["string", " interpolation\""] + ]] + ]], + ["punctuation", "}"] + ]], + ["string", "\r\n\"\"\""] ]] ] diff --git a/tests/languages/tremor/variable_feature.test b/tests/languages/tremor/variable_feature.test deleted file mode 100644 index ea9e7e5ed4..0000000000 --- a/tests/languages/tremor/variable_feature.test +++ /dev/null @@ -1,17 +0,0 @@ -foo -foo_bar_42 -`foo` -`bar` - ----------------------------------------------------- - -[ - ["variable", ["foo"]], - ["variable", ["foo_bar_42"]], - ["variable", ["`foo`"]], - ["variable", ["`bar`"]] -] - ----------------------------------------------------- - -Checks for variables.