diff --git a/components.js b/components.js index 9ebc950e1b..fc526d39aa 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"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default","overrideExampleHeader":true},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"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"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment"},"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"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"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"},"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":"clike","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","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","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"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"},"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"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"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","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"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"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"cpp","modify":["c","cpp"],"overrideExampleHeader":true,"owner":"Milania1"},"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"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","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"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"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"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"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"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"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","peerDependencies":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","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","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","require":"clike","owner":"glachaud"},"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"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"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"},"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","visual-basic"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","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","owner":"Golmote"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"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 matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","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}}}; +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"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default","overrideExampleHeader":true},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"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"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment"},"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"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"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"},"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":"clike","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","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","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"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"},"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"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"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","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"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"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"cpp","modify":["c","cpp"],"overrideExampleHeader":true,"owner":"Milania1"},"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"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","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"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"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"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"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"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"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","peerDependencies":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","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","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","require":"clike","owner":"glachaud"},"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"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"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"},"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","visual-basic"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","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","owner":"Golmote"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"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 matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","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}}}; if (typeof module !== 'undefined' && module.exports) { module.exports = components; } \ No newline at end of file diff --git a/components.json b/components.json index 9cc0825c4a..37ed2ede74 100644 --- a/components.json +++ b/components.json @@ -313,6 +313,10 @@ "require": "clike", "owner": "simonreynolds7" }, + "factor": { + "title": "Factor", + "owner": "catb0t" + }, "firestore-security-rules": { "title": "Firestore security rules", "require": "clike", diff --git a/components/prism-factor.js b/components/prism-factor.js new file mode 100644 index 0000000000..3e555c1d8c --- /dev/null +++ b/components/prism-factor.js @@ -0,0 +1,403 @@ +(function (Prism) { + + var comment_inside = { + 'function': /\b(?:TODOS?|FIX(?:MES?)?|NOTES?|BUGS?|XX+|HACKS?|WARN(?:ING)?|\?{2,}|!{2,})\b/ + }; + var string_inside = { + 'number': /\\[^\s']|%\w/ + }; + + var factor = { + 'comment': [ + { + // ! single-line exclamation point comments with whitespace after/around the ! + pattern: /(^|\s)(?:! .*|!$)/, + lookbehind: true, + inside: comment_inside + }, + + /* from basis/multiline: */ + { + // /* comment */, /* comment*/ + pattern: /(^|\s)\/\*\s[\s\S]*?\*\/(?=\s|$)/, + lookbehind: true, + greedy: true, + inside: comment_inside + }, + { + // ![[ comment ]] , ![===[ comment]===] + pattern: /(^|\s)!\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/, + lookbehind: true, + greedy: true, + inside: comment_inside + } + ], + + 'number': [ + { + // basic base 10 integers 9, -9 + pattern: /(^|\s)[+-]?\d+(?=\s|$)/, + lookbehind: true + }, + { + // base prefix integers 0b010 0o70 0xad 0d10 0XAD -0xa9 + pattern: /(^|\s)[+-]?0(?:b[01]+|o[0-7]+|d\d+|x[\dA-F]+)(?=\s|$)/i, + lookbehind: true + }, + { + // fractional ratios 1/5 -1/5 and the literal float approximations 1/5. -1/5. + pattern: /(^|\s)[+-]?\d+\/\d+\.?(?=\s|$)/, + lookbehind: true + }, + { + // positive mixed numbers 23+1/5 +23+1/5 + pattern: /(^|\s)\+?\d+\+\d+\/\d+(?=\s|$)/, + lookbehind: true + }, + { + // negative mixed numbers -23-1/5 + pattern: /(^|\s)-\d+-\d+\/\d+(?=\s|$)/, + lookbehind: true + }, + { + // basic decimal floats -0.01 0. .0 .1 -.1 -1. -12.13 +12.13 + // and scientific notation with base 10 exponents 3e4 3e-4 .3e-4 + pattern: /(^|\s)[+-]?(?:\d*\.\d+|\d+\.\d*|\d+)(?:e[+-]?\d+)?(?=\s|$)/i, + lookbehind: true + }, + { + // NAN literal syntax NAN: 80000deadbeef, NAN: a + pattern: /(^|\s)NAN:\s+[\da-fA-F]+(?=\s|$)/, + lookbehind: true + }, + { + /* + base prefix floats 0x1.0p3 (8.0) 0b1.010p2 (5.0) 0x1.p1 0b1.11111111p11111... + "The normalized hex form ±0x1.MMMMMMMMMMMMM[pP]±EEEE allows any floating-point number to be specified precisely. + The values of MMMMMMMMMMMMM and EEEE map directly to the mantissa and exponent fields of the binary IEEE 754 representation." + + */ + pattern: /(^|\s)[+-]?0(?:b1\.[01]*|o1\.[0-7]*|d1\.\d*|x1\.[\dA-F]*)p\d+(?=\s|$)/i, + lookbehind: true + } + ], + + // R/ regexp?\/\\/ + 'regexp': { + pattern: /(^|\s)R\/\s+(?:\\\S|[^\\/])*\/(?:[idmsr]*|[idmsr]+-[idmsr]+)(?=\s|$)/, + lookbehind: true, + alias: 'number', + inside: { + 'variable': /\\\S/, + 'keyword': /[+?*\[\]^$(){}.|]/, + 'operator': { + pattern: /(\/)[idmsr]+(?:-[idmsr]+)?/, + lookbehind: true + } + } + }, + + 'boolean': { + pattern: /(^|\s)[tf](?=\s|$)/, + lookbehind: true + }, + + // SBUF" asd", URL" ://...", P" /etc/" + 'custom-string': { + pattern: /(^|\s)[A-Z0-9\-]+"\s(?:\\\S|[^"\\])*"/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: { + 'number': /\\\S|%\w|\// + } + }, + + 'multiline-string': [ + { + // STRING: name \n content \n ; -> CONSTANT: name "content" (symbol) + pattern: /(^|\s)STRING:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*;(?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: { + 'number': string_inside.number, + // trailing semicolon on its own line + 'semicolon-or-setlocal': { + pattern: /((?:\n|\r\n)\s*);(?=\s|$)/, + lookbehind: true, + alias: 'function' + } + } + }, + { + // HEREDOC: marker \n content \n marker ; -> "content" (immediate) + pattern: /(^|\s)HEREDOC:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*\S+(?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: string_inside + }, + { + // [[ string ]], [==[ string]==] + pattern: /(^|\s)\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'string', + inside: string_inside + } + ], + + 'special-using': { + pattern: /(^|\s)USING:(?:\s\S+)*(?=\s+;(?:\s|$))/, + lookbehind: true, + alias: 'function', + inside: { + // this is essentially a regex for vocab names, which i don't want to specify + // but the USING: gets picked up as a vocab name + 'string': { + pattern: /(\s)[^:\s]+/, + lookbehind: true + } + } + }, + + /* this description of stack effect literal syntax is not complete and not as specific as theoretically possible + trying to do better is more work and regex-computation-time than it's worth though. + - we'd like to have the "delimiter" parts of the stack effect [ (, --, and ) ] be a different (less-important or comment-like) colour to the stack effect contents + - we'd like if nested stack effects were treated as such rather than just appearing flat (with `inside`) + - we'd like if the following variable name conventions were recognised specifically: + special row variables = ..a b.. + type and stack effect annotations end with a colon = ( quot: ( a: ( -- ) -- b ) -- x ), ( x: number -- ) + word throws unconditional error = * + any other word-like variable name = a ? q' etc + + https://docs.factorcode.org/content/article-effects.html + + these are pretty complicated to highlight properly without a real parser, and therefore out of scope + the old pattern, which may be later useful, was: (^|\s)(?:call|execute|eval)?\((?:\s+[^"\r\n\t ]\S*)*?\s+--(?:\s+[^"\n\t ]\S*)*?\s+\)(?=\s|$) + */ + + // current solution is not great + 'stack-effect-delimiter': [ + { + // opening parenthesis + pattern: /(^|\s)(?:call|execute|eval)?\((?=\s)/, + lookbehind: true, + alias: 'operator' + }, + { + // middle -- + pattern: /(\s)--(?=\s)/, + lookbehind: true, + alias: 'operator' + }, + { + // closing parenthesis + pattern: /(\s)\)(?=\s|$)/, + lookbehind: true, + alias: 'operator' + } + ], + + 'combinators': { + pattern: null, + lookbehind: true, + alias: 'keyword' + }, + + 'kernel-builtin': { + pattern: null, + lookbehind: true, + alias: 'variable' + }, + + 'sequences-builtin': { + pattern: null, + lookbehind: true, + alias: 'variable' + }, + + 'math-builtin': { + pattern: null, + lookbehind: true, + alias: 'variable' + }, + + 'constructor-word': { + // but not <=> + pattern: /(^|\s)<(?!=+>|-+>)\S+>(?=\s|$)/, + lookbehind: true, + alias: 'keyword' + }, + + 'other-builtin-syntax': { + pattern: null, + lookbehind: true, + alias: 'operator' + }, + + /* + full list of supported word naming conventions: (the convention appears outside of the [brackets]) + set-[x] + change-[x] + with-[x] + new-[x] + >[string] + [base]> + [string]>[number] + +[symbol]+ + [boolean-word]? + ?[of] + [slot-reader]>> + >>[slot-setter] + [slot-writer]<< + ([implementation-detail]) + [mutater]! + [variant]* + [prettyprint]. + $[help-markup] + + , SYNTAX:, etc are supported by their own patterns. + + `with` and `new` from `kernel` are their own builtins. + + see + */ + 'conventionally-named-word': { + pattern: /(^|\s)(?!")(?:(?:set|change|with|new)-\S+|\$\S+|>[^>\s]+|[^:>\s]+>|[^>\s]+>[^>\s]+|\+[^+\s]+\+|[^?\s]+\?|\?[^?\s]+|[^>\s]+>>|>>[^>\s]+|[^<\s]+<<|\([^()\s]+\)|[^!\s]+!|[^*\s]\S*\*|[^.\s]\S*\.)(?=\s|$)/, + lookbehind: true, + alias: 'keyword' + }, + + 'colon-syntax': { + pattern: /(^|\s)(?:[A-Z0-9\-]+#?)?:{1,2}\s+(?:;\S+|(?!;)\S+)(?=\s|$)/, + lookbehind: true, + greedy: true, + alias: 'function' + }, + + 'semicolon-or-setlocal': { + pattern: /(\s)(?:;|:>)(?=\s|$)/, + lookbehind: true, + alias: 'function' + }, + + // do not highlight leading } or trailing X{ at the begin/end of the file as it's invalid syntax + 'curly-brace-literal-delimiter': [ + { + // opening + pattern: /(^|\s)[a-z]*\{(?=\s)/i, + lookbehind: true, + alias: 'operator' + }, + { + // closing + pattern: /(\s)\}(?=\s|$)/, + lookbehind: true, + alias: 'operator' + }, + + ], + + // do not highlight leading ] or trailing [ at the begin/end of the file as it's invalid syntax + 'quotation-delimiter': [ + { + // opening + pattern: /(^|\s)\[(?=\s)/, + lookbehind: true, + alias: 'operator' + }, + { + // closing + pattern: /(\s)\](?=\s|$)/, + lookbehind: true, + alias: 'operator' + }, + ], + + 'normal-word': { + pattern: /(^|\s)[^"\s]\S*(?=\s|$)/, + lookbehind: true + }, + + /* + basic first-class string "a" + with escaped double-quote "a\"" + escaped backslash "\\" + and general escapes since Factor has so many "\N" + + syntax that works in the reference implementation that isn't fully + supported because it's an implementation detail: + "string 1""string 2" -> 2 strings (works anyway) + "string"5 -> string, 5 + "string"[ ] -> string, quotation + { "a"} -> array + + the rest of those examples all properly recognise the string, but not + the other object (number, quotation, etc) + this is fine for a regex-only implementation. + */ + 'string': { + pattern: /"(?:\\\S|[^"\\])*"/, + greedy: true, + inside: string_inside + } + }; + + var escape = function (str) { + return (str+'').replace(/([.?*+\^$\[\]\\(){}|\-])/g, '\\$1'); + }; + + var arrToWordsRegExp = function (arr) { + return new RegExp( + '(^|\\s)(?:' + arr.map(escape).join('|') + ')(?=\\s|$)' + ); + }; + + var builtins = { + 'kernel-builtin': [ + 'or', '2nipd', '4drop', 'tuck', 'wrapper', 'nip', 'wrapper?', 'callstack>array', 'die', 'dupd', 'callstack', 'callstack?', '3dup', 'hashcode', 'pick', '4nip', 'build', '>boolean', 'nipd', 'clone', '5nip', 'eq?', '?', '=', 'swapd', '2over', 'clear', '2dup', 'get-retainstack', 'not', 'tuple?', 'dup', '3nipd', 'call', '-rotd', 'object', 'drop', 'assert=', 'assert?', '-rot', 'execute', 'boa', 'get-callstack', 'curried?', '3drop', 'pickd', 'overd', 'over', 'roll', '3nip', 'swap', 'and', '2nip', 'rotd', 'throw', '(clone)', 'hashcode*', 'spin', 'reach', '4dup', 'equal?', 'get-datastack', 'assert', '2drop', '', 'boolean?', 'identity-hashcode', 'identity-tuple?', 'null', 'composed?', 'new', '5drop', 'rot', '-roll', 'xor', 'identity-tuple', 'boolean' + ], + 'other-builtin-syntax': [ + // syntax + '=======', 'recursive', 'flushable', '>>', '<<<<<<', 'M\\', 'B', 'PRIVATE>', '\\', '======', 'final', 'inline', 'delimiter', 'deprecated', '>>>>>', '<<<<<<<', 'parse-complex', 'malformed-complex', 'read-only', '>>>>>>>', 'call-next-method', '<<', 'foldable', + // literals + '$', '$[', '${' + ], + 'sequences-builtin': [ + 'member-eq?', 'mismatch', 'append', 'assert-sequence=', 'longer', 'repetition', 'clone-like', '3sequence', 'assert-sequence?', 'last-index-from', 'reversed', 'index-from', 'cut*', 'pad-tail', 'join-as', 'remove-eq!', 'concat-as', 'but-last', 'snip', 'nths', 'nth', 'sequence', 'longest', 'slice?', '', 'remove-nth', 'tail-slice', 'empty?', 'tail*', 'member?', 'virtual-sequence?', 'set-length', 'drop-prefix', 'iota', 'unclip', 'bounds-error?', 'unclip-last-slice', 'non-negative-integer-expected', 'non-negative-integer-expected?', 'midpoint@', 'longer?', '?set-nth', '?first', 'rest-slice', 'prepend-as', 'prepend', 'fourth', 'sift', 'subseq-start', 'new-sequence', '?last', 'like', 'first4', '1sequence', 'reverse', 'slice', 'virtual@', 'repetition?', 'set-last', 'index', '4sequence', 'max-length', 'set-second', 'immutable-sequence', 'first2', 'first3', 'supremum', 'unclip-slice', 'suffix!', 'insert-nth', 'tail', '3append', 'short', 'suffix', 'concat', 'flip', 'immutable?', 'reverse!', '2sequence', 'sum', 'delete-all', 'indices', 'snip-slice', '', 'check-slice', 'sequence?', 'head', 'append-as', 'halves', 'sequence=', 'collapse-slice', '?second', 'slice-error?', 'product', 'bounds-check?', 'bounds-check', 'immutable', 'virtual-exemplar', 'harvest', 'remove', 'pad-head', 'last', 'set-fourth', 'cartesian-product', 'remove-eq', 'shorten', 'shorter', 'reversed?', 'shorter?', 'shortest', 'head-slice', 'pop*', 'tail-slice*', 'but-last-slice', 'iota?', 'append!', 'cut-slice', 'new-resizable', 'head-slice*', 'sequence-hashcode', 'pop', 'set-nth', '?nth', 'second', 'join', 'immutable-sequence?', '', '3append-as', 'virtual-sequence', 'subseq?', 'remove-nth!', 'length', 'last-index', 'lengthen', 'assert-sequence', 'copy', 'move', 'third', 'first', 'tail?', 'set-first', 'prefix', 'bounds-error', '', 'exchange', 'surround', 'cut', 'min-length', 'set-third', 'push-all', 'head?', 'subseq-start-from', 'delete-slice', 'rest', 'sum-lengths', 'head*', 'infimum', 'remove!', 'glue', 'slice-error', 'subseq', 'push', 'replace-slice', 'subseq-as', 'unclip-last' + ], + 'math-builtin': [ + 'number=', 'next-power-of-2', '?1+', 'fp-special?', 'imaginary-part', 'float>bits', 'number?', 'fp-infinity?', 'bignum?', 'fp-snan?', 'denominator', 'gcd', '*', '+', 'fp-bitwise=', '-', 'u>=', '/', '>=', 'bitand', 'power-of-2?', 'log2-expects-positive', 'neg?', '<', 'log2', '>', 'integer?', 'number', 'bits>double', '2/', 'zero?', 'bits>float', 'float?', 'shift', 'ratio?', 'rect>', 'even?', 'ratio', 'fp-sign', 'bitnot', '>fixnum', 'complex?', '/i', 'integer>fixnum', '/f', 'sgn', '>bignum', 'next-float', 'u<', 'u>', 'mod', 'recip', 'rational', '>float', '2^', 'integer', 'fixnum?', 'neg', 'fixnum', 'sq', 'bignum', '>rect', 'bit?', 'fp-qnan?', 'simple-gcd', 'complex', '', 'real', '>fraction', 'double>bits', 'bitor', 'rem', 'fp-nan-payload', 'real-part', 'log2-expects-positive?', 'prev-float', 'align', 'unordered?', 'float', 'fp-nan?', 'abs', 'bitxor', 'integer>fixnum-strict', 'u<=', 'odd?', '<=', '/mod', '>integer', 'real?', 'rational?', 'numerator' + ] + // that's all for now + }; + + Object.keys(builtins).forEach(function (k) { + factor[k].pattern = arrToWordsRegExp( builtins[k] ); + }); + + var combinators = [ + // kernel + '2bi', 'while', '2tri', 'bi*', '4dip', 'both?', 'same?', 'tri@', 'curry', 'prepose', '3bi', '?if', 'tri*', '2keep', '3keep', 'curried', '2keepd', 'when', '2bi*', '2tri*', '4keep', 'bi@', 'keepdd', 'do', 'unless*', 'tri-curry', 'if*', 'loop', 'bi-curry*', 'when*', '2bi@', '2tri@', 'with', '2with', 'either?', 'bi', 'until', '3dip', '3curry', 'tri-curry*', 'tri-curry@', 'bi-curry', 'keepd', 'compose', '2dip', 'if', '3tri', 'unless', 'tuple', 'keep', '2curry', 'tri', 'most', 'while*', 'dip', 'composed', 'bi-curry@', + // sequences + 'find-last-from', 'trim-head-slice', 'map-as', 'each-from', 'none?', 'trim-tail', 'partition', 'if-empty', 'accumulate*', 'reject!', 'find-from', 'accumulate-as', 'collector-for-as', 'reject', 'map', 'map-sum', 'accumulate!', '2each-from', 'follow', 'supremum-by', 'map!', 'unless-empty', 'collector', 'padding', 'reduce-index', 'replicate-as', 'infimum-by', 'trim-tail-slice', 'count', 'find-index', 'filter', 'accumulate*!', 'reject-as', 'map-integers', 'map-find', 'reduce', 'selector', 'interleave', '2map', 'filter-as', 'binary-reduce', 'map-index-as', 'find', 'produce', 'filter!', 'replicate', 'cartesian-map', 'cartesian-each', 'find-index-from', 'map-find-last', '3map-as', '3map', 'find-last', 'selector-as', '2map-as', '2map-reduce', 'accumulate', 'each', 'each-index', 'accumulate*-as', 'when-empty', 'all?', 'collector-as', 'push-either', 'new-like', 'collector-for', '2selector', 'push-if', '2all?', 'map-reduce', '3each', 'any?', 'trim-slice', '2reduce', 'change-nth', 'produce-as', '2each', 'trim', 'trim-head', 'cartesian-find', 'map-index', + // math + 'if-zero', 'each-integer', 'unless-zero', '(find-integer)', 'when-zero', 'find-last-integer', '(all-integers?)', 'times', '(each-integer)', 'find-integer', 'all-integers?', + // math.combinators + 'unless-negative', 'if-positive', 'when-positive', 'when-negative', 'unless-positive', 'if-negative', + // combinators + 'case', '2cleave', 'cond>quot', 'case>quot', '3cleave', 'wrong-values', 'to-fixed-point', 'alist>quot', 'cond', 'cleave', 'call-effect', 'recursive-hashcode', 'spread', 'deep-spread>quot', + // combinators.short-circuit + '2||', '0||', 'n||', '0&&', '2&&', '3||', '1||', '1&&', 'n&&', '3&&', + // combinators.smart + 'smart-unless*', 'keep-inputs', 'reduce-outputs', 'smart-when*', 'cleave>array', 'smart-with', 'smart-apply', 'smart-if', 'inputs/outputs', 'output>sequence-n', 'map-outputs', 'map-reduce-outputs', 'dropping', 'output>array', 'smart-map-reduce', 'smart-2map-reduce', 'output>array-n', 'nullary', 'inputsequence', + // tafn + ]; + + factor.combinators.pattern = arrToWordsRegExp(combinators); + + Prism.languages.factor = factor; + +})(Prism); diff --git a/components/prism-factor.min.js b/components/prism-factor.min.js new file mode 100644 index 0000000000..b8a948f6e5 --- /dev/null +++ b/components/prism-factor.min.js @@ -0,0 +1 @@ +!function(e){var t={function:/\b(?:TODOS?|FIX(?:MES?)?|NOTES?|BUGS?|XX+|HACKS?|WARN(?:ING)?|\?{2,}|!{2,})\b/},s={number:/\\[^\s']|%\w/},i={comment:[{pattern:/(^|\s)(?:! .*|!$)/,lookbehind:!0,inside:t},{pattern:/(^|\s)\/\*\s[\s\S]*?\*\/(?=\s|$)/,lookbehind:!0,greedy:!0,inside:t},{pattern:/(^|\s)!\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/,lookbehind:!0,greedy:!0,inside:t}],number:[{pattern:/(^|\s)[+-]?\d+(?=\s|$)/,lookbehind:!0},{pattern:/(^|\s)[+-]?0(?:b[01]+|o[0-7]+|d\d+|x[\dA-F]+)(?=\s|$)/i,lookbehind:!0},{pattern:/(^|\s)[+-]?\d+\/\d+\.?(?=\s|$)/,lookbehind:!0},{pattern:/(^|\s)\+?\d+\+\d+\/\d+(?=\s|$)/,lookbehind:!0},{pattern:/(^|\s)-\d+-\d+\/\d+(?=\s|$)/,lookbehind:!0},{pattern:/(^|\s)[+-]?(?:\d*\.\d+|\d+\.\d*|\d+)(?:e[+-]?\d+)?(?=\s|$)/i,lookbehind:!0},{pattern:/(^|\s)NAN:\s+[\da-fA-F]+(?=\s|$)/,lookbehind:!0},{pattern:/(^|\s)[+-]?0(?:b1\.[01]*|o1\.[0-7]*|d1\.\d*|x1\.[\dA-F]*)p\d+(?=\s|$)/i,lookbehind:!0}],regexp:{pattern:/(^|\s)R\/\s+(?:\\\S|[^\\/])*\/(?:[idmsr]*|[idmsr]+-[idmsr]+)(?=\s|$)/,lookbehind:!0,alias:"number",inside:{variable:/\\\S/,keyword:/[+?*\[\]^$(){}.|]/,operator:{pattern:/(\/)[idmsr]+(?:-[idmsr]+)?/,lookbehind:!0}}},boolean:{pattern:/(^|\s)[tf](?=\s|$)/,lookbehind:!0},"custom-string":{pattern:/(^|\s)[A-Z0-9\-]+"\s(?:\\\S|[^"\\])*"/,lookbehind:!0,greedy:!0,alias:"string",inside:{number:/\\\S|%\w|\//}},"multiline-string":[{pattern:/(^|\s)STRING:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*;(?=\s|$)/,lookbehind:!0,greedy:!0,alias:"string",inside:{number:s.number,"semicolon-or-setlocal":{pattern:/((?:\n|\r\n)\s*);(?=\s|$)/,lookbehind:!0,alias:"function"}}},{pattern:/(^|\s)HEREDOC:\s+\S+(?:\n|\r\n).*(?:\n|\r\n)\s*\S+(?=\s|$)/,lookbehind:!0,greedy:!0,alias:"string",inside:s},{pattern:/(^|\s)\[(={0,6})\[\s[\s\S]*?\]\2\](?=\s|$)/,lookbehind:!0,greedy:!0,alias:"string",inside:s}],"special-using":{pattern:/(^|\s)USING:(?:\s\S+)*(?=\s+;(?:\s|$))/,lookbehind:!0,alias:"function",inside:{string:{pattern:/(\s)[^:\s]+/,lookbehind:!0}}},"stack-effect-delimiter":[{pattern:/(^|\s)(?:call|execute|eval)?\((?=\s)/,lookbehind:!0,alias:"operator"},{pattern:/(\s)--(?=\s)/,lookbehind:!0,alias:"operator"},{pattern:/(\s)\)(?=\s|$)/,lookbehind:!0,alias:"operator"}],combinators:{pattern:null,lookbehind:!0,alias:"keyword"},"kernel-builtin":{pattern:null,lookbehind:!0,alias:"variable"},"sequences-builtin":{pattern:null,lookbehind:!0,alias:"variable"},"math-builtin":{pattern:null,lookbehind:!0,alias:"variable"},"constructor-word":{pattern:/(^|\s)<(?!=+>|-+>)\S+>(?=\s|$)/,lookbehind:!0,alias:"keyword"},"other-builtin-syntax":{pattern:null,lookbehind:!0,alias:"operator"},"conventionally-named-word":{pattern:/(^|\s)(?!")(?:(?:set|change|with|new)-\S+|\$\S+|>[^>\s]+|[^:>\s]+>|[^>\s]+>[^>\s]+|\+[^+\s]+\+|[^?\s]+\?|\?[^?\s]+|[^>\s]+>>|>>[^>\s]+|[^<\s]+<<|\([^()\s]+\)|[^!\s]+!|[^*\s]\S*\*|[^.\s]\S*\.)(?=\s|$)/,lookbehind:!0,alias:"keyword"},"colon-syntax":{pattern:/(^|\s)(?:[A-Z0-9\-]+#?)?:{1,2}\s+(?:;\S+|(?!;)\S+)(?=\s|$)/,lookbehind:!0,greedy:!0,alias:"function"},"semicolon-or-setlocal":{pattern:/(\s)(?:;|:>)(?=\s|$)/,lookbehind:!0,alias:"function"},"curly-brace-literal-delimiter":[{pattern:/(^|\s)[a-z]*\{(?=\s)/i,lookbehind:!0,alias:"operator"},{pattern:/(\s)\}(?=\s|$)/,lookbehind:!0,alias:"operator"}],"quotation-delimiter":[{pattern:/(^|\s)\[(?=\s)/,lookbehind:!0,alias:"operator"},{pattern:/(\s)\](?=\s|$)/,lookbehind:!0,alias:"operator"}],"normal-word":{pattern:/(^|\s)[^"\s]\S*(?=\s|$)/,lookbehind:!0},string:{pattern:/"(?:\\\S|[^"\\])*"/,greedy:!0,inside:s}},n=function(e){return(e+"").replace(/([.?*+\^$\[\]\\(){}|\-])/g,"\\$1")},r=function(e){return new RegExp("(^|\\s)(?:"+e.map(n).join("|")+")(?=\\s|$)")},a={"kernel-builtin":["or","2nipd","4drop","tuck","wrapper","nip","wrapper?","callstack>array","die","dupd","callstack","callstack?","3dup","hashcode","pick","4nip","build",">boolean","nipd","clone","5nip","eq?","?","=","swapd","2over","clear","2dup","get-retainstack","not","tuple?","dup","3nipd","call","-rotd","object","drop","assert=","assert?","-rot","execute","boa","get-callstack","curried?","3drop","pickd","overd","over","roll","3nip","swap","and","2nip","rotd","throw","(clone)","hashcode*","spin","reach","4dup","equal?","get-datastack","assert","2drop","","boolean?","identity-hashcode","identity-tuple?","null","composed?","new","5drop","rot","-roll","xor","identity-tuple","boolean"],"other-builtin-syntax":["=======","recursive","flushable",">>","<<<<<<","M\\","B","PRIVATE>","\\","======","final","inline","delimiter","deprecated",">>>>>","<<<<<<<","parse-complex","malformed-complex","read-only",">>>>>>>","call-next-method","<<","foldable","$","$[","${"],"sequences-builtin":["member-eq?","mismatch","append","assert-sequence=","longer","repetition","clone-like","3sequence","assert-sequence?","last-index-from","reversed","index-from","cut*","pad-tail","join-as","remove-eq!","concat-as","but-last","snip","nths","nth","sequence","longest","slice?","","remove-nth","tail-slice","empty?","tail*","member?","virtual-sequence?","set-length","drop-prefix","iota","unclip","bounds-error?","unclip-last-slice","non-negative-integer-expected","non-negative-integer-expected?","midpoint@","longer?","?set-nth","?first","rest-slice","prepend-as","prepend","fourth","sift","subseq-start","new-sequence","?last","like","first4","1sequence","reverse","slice","virtual@","repetition?","set-last","index","4sequence","max-length","set-second","immutable-sequence","first2","first3","supremum","unclip-slice","suffix!","insert-nth","tail","3append","short","suffix","concat","flip","immutable?","reverse!","2sequence","sum","delete-all","indices","snip-slice","","check-slice","sequence?","head","append-as","halves","sequence=","collapse-slice","?second","slice-error?","product","bounds-check?","bounds-check","immutable","virtual-exemplar","harvest","remove","pad-head","last","set-fourth","cartesian-product","remove-eq","shorten","shorter","reversed?","shorter?","shortest","head-slice","pop*","tail-slice*","but-last-slice","iota?","append!","cut-slice","new-resizable","head-slice*","sequence-hashcode","pop","set-nth","?nth","second","join","immutable-sequence?","","3append-as","virtual-sequence","subseq?","remove-nth!","length","last-index","lengthen","assert-sequence","copy","move","third","first","tail?","set-first","prefix","bounds-error","","exchange","surround","cut","min-length","set-third","push-all","head?","subseq-start-from","delete-slice","rest","sum-lengths","head*","infimum","remove!","glue","slice-error","subseq","push","replace-slice","subseq-as","unclip-last"],"math-builtin":["number=","next-power-of-2","?1+","fp-special?","imaginary-part","float>bits","number?","fp-infinity?","bignum?","fp-snan?","denominator","gcd","*","+","fp-bitwise=","-","u>=","/",">=","bitand","power-of-2?","log2-expects-positive","neg?","<","log2",">","integer?","number","bits>double","2/","zero?","bits>float","float?","shift","ratio?","rect>","even?","ratio","fp-sign","bitnot",">fixnum","complex?","/i","integer>fixnum","/f","sgn",">bignum","next-float","u<","u>","mod","recip","rational",">float","2^","integer","fixnum?","neg","fixnum","sq","bignum",">rect","bit?","fp-qnan?","simple-gcd","complex","","real",">fraction","double>bits","bitor","rem","fp-nan-payload","real-part","log2-expects-positive?","prev-float","align","unordered?","float","fp-nan?","abs","bitxor","integer>fixnum-strict","u<=","odd?","<=","/mod",">integer","real?","rational?","numerator"]};Object.keys(a).forEach(function(e){i[e].pattern=r(a[e])});i.combinators.pattern=r(["2bi","while","2tri","bi*","4dip","both?","same?","tri@","curry","prepose","3bi","?if","tri*","2keep","3keep","curried","2keepd","when","2bi*","2tri*","4keep","bi@","keepdd","do","unless*","tri-curry","if*","loop","bi-curry*","when*","2bi@","2tri@","with","2with","either?","bi","until","3dip","3curry","tri-curry*","tri-curry@","bi-curry","keepd","compose","2dip","if","3tri","unless","tuple","keep","2curry","tri","most","while*","dip","composed","bi-curry@","find-last-from","trim-head-slice","map-as","each-from","none?","trim-tail","partition","if-empty","accumulate*","reject!","find-from","accumulate-as","collector-for-as","reject","map","map-sum","accumulate!","2each-from","follow","supremum-by","map!","unless-empty","collector","padding","reduce-index","replicate-as","infimum-by","trim-tail-slice","count","find-index","filter","accumulate*!","reject-as","map-integers","map-find","reduce","selector","interleave","2map","filter-as","binary-reduce","map-index-as","find","produce","filter!","replicate","cartesian-map","cartesian-each","find-index-from","map-find-last","3map-as","3map","find-last","selector-as","2map-as","2map-reduce","accumulate","each","each-index","accumulate*-as","when-empty","all?","collector-as","push-either","new-like","collector-for","2selector","push-if","2all?","map-reduce","3each","any?","trim-slice","2reduce","change-nth","produce-as","2each","trim","trim-head","cartesian-find","map-index","if-zero","each-integer","unless-zero","(find-integer)","when-zero","find-last-integer","(all-integers?)","times","(each-integer)","find-integer","all-integers?","unless-negative","if-positive","when-positive","when-negative","unless-positive","if-negative","case","2cleave","cond>quot","case>quot","3cleave","wrong-values","to-fixed-point","alist>quot","cond","cleave","call-effect","recursive-hashcode","spread","deep-spread>quot","2||","0||","n||","0&&","2&&","3||","1||","1&&","n&&","3&&","smart-unless*","keep-inputs","reduce-outputs","smart-when*","cleave>array","smart-with","smart-apply","smart-if","inputs/outputs","output>sequence-n","map-outputs","map-reduce-outputs","dropping","output>array","smart-map-reduce","smart-2map-reduce","output>array-n","nullary","inputsequence"]),e.languages.factor=i}(Prism); \ No newline at end of file diff --git a/examples/prism-factor.html b/examples/prism-factor.html new file mode 100644 index 0000000000..6bde0a221f --- /dev/null +++ b/examples/prism-factor.html @@ -0,0 +1,128 @@ +

Comments

+
! FIXME: a comment
+
+USE: multiline
+
+![[ comment ]]
+/* comment */
+ +

Strings

+
"a string" "\"" "\x8" "%s"
+
+SBUF" asbdef"
+
+USE: multiline
+
+STRING: name
+content
+;
+
+HEREDOC: marker
+text
+marker
+
+[==[
+	str
+	ing
+]==]
+
+ +

Numbers

+
5 1/5 +9 -9 +1/5 -1/5 -1/5. 23+1/5 -23-1/5 23-1/5 ! NOTE: last one = word
+
++12.13 0.01 0e0 3E4 3e-4 3E-4 030 0xd 0o30 0b1100
+-12.13 -0 -0.01 -0e0 -3E4 -3E-4 -030 -0xd -0o30 -0b1100
+
+348756424956392657834385437598743583648756332457
+-348756424956392657834385437598743583648756332457
+
+NAN: a
+NAN: 80000deadbeef
+
+0b1.010p2 0x1.0p3 0x1.p1 0b1.111111p1111 ...
+ +

Sequences

+
{ 1 2 3 4 }
+{ a b c d e t f }
+{ "a" "b" "c" }
+
+{ { a b } { c d } }
+H{ { a b } { c d } }
+H{ { "a" "b" } { "c" "d" } }
+V{ 1 2 3 4 }
+V{ "1" "2" "3" "4" }
+BV{ 1 2 3 4 }
+ +

Regular Expressions

+
USE: regexp
+R/ abcde?.*+\?\.\*\+\/\\\/idmsr-idmsr/idmsr-idmsr
+
+ +

Colon parsing words

+
: a ( -- ) ;
+:: ; ! ; is not a word name
+:: ;a ! ;a is a word name
+USING: a b c ;
+USE: a
+IN: a.b
+CHAR: a
+GENERIC#: x 1 ( x: integer quot: ( x -- y ) -- )
+ +

Special words (builtins, conventions)

+
and not with map filter
+
+new last-index + - neg
+
+<array> <=> SYNTAX: x $[ xyz ]
+
+set-x change-x with-variable ?of if* (gensym) hex. $description reader>> >>setter writer<<
+
+string>number >hex base> mutater!
+
+ +

Full example

+
USING: accessors arrays assocs combinators
+combinators.short-circuit effects io kernel sequences
+sequences.deep splitting strings vocabs words ;
+IN: prism
+
+: make-prism-syntax ( syntax-vocab -- seq )
+ 	vocab-words [
+		dup name>> ">>" = [ drop t ] [
+			{
+				[ "delimiter" word-prop ]
+				[ name>> last { CHAR: : CHAR: { CHAR: [ CHAR: ( CHAR: ) CHAR: ? CHAR: " } member? ]
+				[ name>> { "t" "f" } member? ]
+			} 1|| not
+		] if
+	] filter ;
+
+: combinator? ( word -- ? )
+	[ "declared-effect" word-prop in>> flatten
+		[
+			[ effect? ] [ { "quots" "quot" } member? ] bi or
+		] any?
+	] [
+		"help" word-prop ?first flatten [ dup word? [ name>> ] when "quot" swap subseq? ] any?
+	] bi or ;
+
+: classify ( vocab-spec -- seq )
+	vocab-words [
+		dup {
+			{ [ dup combinator? ] [ drop "combinator" ] }
+			{ [ dup "macro" word-prop ] [ drop "macro" ] }
+			[ drop "ordinary" ]
+		} cond 2array
+	] map ;
+
+: print-strings ( strs -- )
+	[ name>> "'" dup surround ] map ", " join print ; recursive ! WARN: not recursive
+
+: combinators. ( vocab-spec -- )
+	classify [ nip "combinator" = ] assoc-filter keys print-strings ; flushable
+
+: ordinaries. ( vocab-spec -- )
+	classify [ nip "ordinary" = ] assoc-filter keys print-strings ; foldable
+
+: macros. ( vocab-spec -- )
+	classify [ nip "macro" = ] assoc-filter keys print-strings ; inline
diff --git a/tests/languages/factor/builtin_words_feature.test b/tests/languages/factor/builtin_words_feature.test new file mode 100644 index 0000000000..4464d62210 --- /dev/null +++ b/tests/languages/factor/builtin_words_feature.test @@ -0,0 +1,15 @@ +and not with map filter + +---------------------------------------------------- + +[ + [ "kernel-builtin", "and" ], + [ "kernel-builtin", "not" ], + [ "combinators", "with" ], + [ "combinators", "map" ], + [ "combinators", "filter" ] +] + +---------------------------------------------------- + +some builtins diff --git a/tests/languages/factor/colon_words_feature.test b/tests/languages/factor/colon_words_feature.test new file mode 100644 index 0000000000..1a01652865 --- /dev/null +++ b/tests/languages/factor/colon_words_feature.test @@ -0,0 +1,47 @@ +: a ( -- ) ; +:: ; ! ; is not a word name +:: ;a ! ;a is a word name +USING: a b c ; +USE: a +IN: a.b +CHAR: a +#: a +GENERIC#: a + +---------------------------------------------------- + +[ + [ "colon-syntax", ": a" ], + + [ "stack-effect-delimiter", "(" ], + [ "stack-effect-delimiter", "--" ], + [ "stack-effect-delimiter", ")" ], + + [ "semicolon-or-setlocal", ";" ], + + [ "normal-word", "::" ], + [ "semicolon-or-setlocal", ";" ], + [ "comment", [ "! ; is not a word name" ] ], + + [ "colon-syntax", ":: ;a" ], + [ "comment", [ "! ;a is a word name" ] ], + + [ "special-using", + [ "USING: ", + [ "string", "a" ], + [ "string", "b" ], + [ "string", "c" ] + ] + ], + [ "semicolon-or-setlocal", ";" ], + [ "colon-syntax", "USE: a" ], + [ "colon-syntax", "IN: a.b" ], + [ "colon-syntax", "CHAR: a" ], + [ "normal-word", "#:" ], + [ "normal-word", "a" ], + [ "colon-syntax", "GENERIC#: a" ] +] + +---------------------------------------------------- + +colon-ended parsing words diff --git a/tests/languages/factor/comments_feature.test b/tests/languages/factor/comments_feature.test new file mode 100644 index 0000000000..5dc45765ea --- /dev/null +++ b/tests/languages/factor/comments_feature.test @@ -0,0 +1,74 @@ +a! ! word +!a ! word +! comment +! bad +! fine +! "also a comment" +! : ( -- ) ; +! ! leading comment-like token + ! whitespace before +words blah ! comment after code on a line + +![[ comment ]] +"![[ string ]]" +![[ "comment" ]] + +![[ comment]] +![==[ comment ]==] +![==[ comment]==] +![=[word ]=] +![=======[ words ]=======] + +/* com +ment */ +/* com +ment*/ +/*word */ + +/* "comment" */ +"/* "strings" */" + + +---------------------------------------------------- + +[ + [ "conventionally-named-word", "a!"], + [ "comment", [ "! word" ] ], + [ "normal-word", "!a"], + [ "comment", [ "! word" ] ], + [ "comment", [ "! comment" ] ], + + [ "normal-word", "!" ], [ "normal-word", "bad" ], + [ "comment", [ "! \tfine" ] ], + + [ "comment", [ "! \"also a comment\"" ] ], + [ "comment", [ "! : ( -- ) ;" ] ], + [ "comment", [ "! ! leading comment-like token" ] ], + [ "comment", [ "! whitespace before" ] ], + [ "normal-word", "words" ], + [ "normal-word", "blah" ], + [ "comment", [ "! comment after code on a line" ] ], + + [ "comment", [ "![[ comment ]]" ] ], + [ "string", [ "\"![[ string ]]\"" ] ], + [ "comment", [ "![[ \"comment\" ]]" ] ], + [ "comment", [ "![[ comment]]" ] ], + [ "comment", [ "![==[ comment ]==]" ] ], + [ "comment", [ "![==[ comment]==]" ] ], + + [ "normal-word", "![=[word" ], + [ "normal-word", "]=]" ], + [ "normal-word", "![=======[" ], + [ "normal-word", "words" ], + [ "normal-word", "]=======]" ], + [ "comment", [ "/* com\r\nment */" ] ], + [ "comment", [ "/* com\r\nment*/" ] ], + [ "normal-word", "/*word" ], + [ "normal-word", "*/" ], + [ "comment", ["/* \"comment\" */"] ], + [ "string", ["\"/* \""] ], + "strings", + [ "string", ["\" */\""] ] +] + +---------------------------------------------------- diff --git a/tests/languages/factor/constructors_feature.test b/tests/languages/factor/constructors_feature.test new file mode 100644 index 0000000000..375e870c8f --- /dev/null +++ b/tests/languages/factor/constructors_feature.test @@ -0,0 +1,18 @@ + + +<=> <--> + +---------------------------------------------------- + +[ + [ "constructor-word", "" ], + [ "constructor-word", "" ], + [ "constructor-word", "" ], + + [ "conventionally-named-word", "<=>" ], + [ "conventionally-named-word", "<-->" ] +] + +---------------------------------------------------- + +ctors diff --git a/tests/languages/factor/normal_words_feature.test b/tests/languages/factor/normal_words_feature.test new file mode 100644 index 0000000000..fc26561350 --- /dev/null +++ b/tests/languages/factor/normal_words_feature.test @@ -0,0 +1,56 @@ +commas, primes' +set-x +change-x +with-x +new-x +>string +base> +string>number ++symbol+ +que? +?of +?of* +reader>> +>>setter +writer<< +(detail) +mutater! +variant* +prettyprint. +$help + +"no + +---------------------------------------------------- + +[ + [ "normal-word", "commas," ], + [ "normal-word", "primes'" ], + [ "conventionally-named-word", "set-x" ], + [ "conventionally-named-word", "change-x" ], + [ "conventionally-named-word", "with-x" ], + [ "conventionally-named-word", "new-x" ], + [ "conventionally-named-word", ">string" ], + [ "conventionally-named-word", "base>" ], + [ "conventionally-named-word", "string>number" ], + [ "conventionally-named-word", "+symbol+" ], + [ "conventionally-named-word", "que?" ], + [ "conventionally-named-word", "?of" ], + [ "conventionally-named-word", "?of*" ], + [ "conventionally-named-word", "reader>>" ], + [ "conventionally-named-word", ">>setter" ], + [ "conventionally-named-word", "writer<<" ], + [ "conventionally-named-word", "(detail)" ], + [ "conventionally-named-word", "mutater!" ], + [ "conventionally-named-word", "variant*" ], + [ "conventionally-named-word", "prettyprint." ], + [ "conventionally-named-word", "$help" ], + "\r\n\r\n\"no" +] + +---------------------------------------------------- + +"Normal" words are not builtin well-known ones like "not", "and", "<=>", though they may be in the standard library or user-defined. +They may start with any character except `"` (double-quote), but may contain or end with double-quotes or any other non-whitespace character. + +Conventionally named words follow the conventions outlined in prism-factor.js. diff --git a/tests/languages/factor/numbers_feature.test b/tests/languages/factor/numbers_feature.test new file mode 100644 index 0000000000..3526183d87 --- /dev/null +++ b/tests/languages/factor/numbers_feature.test @@ -0,0 +1,49 @@ +5 1/5 +9 -9 +1/5 -1/5 23+1/5 -23-1/5 23-1/5 ! last one = word + +0.01 0e0 3E4 3e-4 3E-4 030 0xd 0o30 0b1100 +-0 -0.01 -0e0 -3E4 -3E-4 -030 -0xd -0o30 -0b1100 + +348756424956392657834385437598743583648756332457 +-348756424956392657834385437598743583648756332457 + +NAN: 80000deadbeef + +--------------------------------------------------- + +[ + [ "number", "5" ], + [ "number", "1/5" ], + [ "number", "+9" ], + [ "number", "-9" ], + [ "number", "+1/5" ], + [ "number", "-1/5" ], + [ "number", "23+1/5" ], + [ "number", "-23-1/5" ], + [ "normal-word", "23-1/5" ], + [ "comment", [ "! last one = word" ] ], + [ "number", "0.01" ], + [ "number", "0e0" ], + [ "number", "3E4" ], + [ "number", "3e-4" ], + [ "number", "3E-4" ], + [ "number", "030" ], + [ "number", "0xd" ], + [ "number", "0o30" ], + [ "number", "0b1100" ], + [ "number", "-0" ], + [ "number", "-0.01" ], + [ "number", "-0e0" ], + [ "number", "-3E4" ], + [ "number", "-3E-4" ], + [ "number", "-030" ], + [ "number", "-0xd" ], + [ "number", "-0o30" ], + [ "number", "-0b1100" ], + [ "number", "348756424956392657834385437598743583648756332457" ], + [ "number", "-348756424956392657834385437598743583648756332457" ], + [ "number", "NAN: 80000deadbeef" ] +] + +--------------------------------------------------- + +numbers diff --git a/tests/languages/factor/other_builtin_parsing_words_feature.test b/tests/languages/factor/other_builtin_parsing_words_feature.test new file mode 100644 index 0000000000..acaf41492d --- /dev/null +++ b/tests/languages/factor/other_builtin_parsing_words_feature.test @@ -0,0 +1,29 @@ + +PRIVATE> +$[ some code ] +<< some code >> +\ M\ + +-------------------------------------------------- + +[ + [ "other-builtin-syntax", "" ], + [ "other-builtin-syntax", "PRIVATE>" ], + [ "other-builtin-syntax", "$[" ], + [ "normal-word", "some" ], + [ "normal-word", "code" ], + [ "quotation-delimiter", "]" ], + [ "other-builtin-syntax", "<<" ], + [ "normal-word", "some" ], + [ "normal-word", "code" ], + [ "other-builtin-syntax", ">>" ], + [ "other-builtin-syntax", "\\" ], + [ "other-builtin-syntax", "M\\" ] +] + + +-------------------------------------------------- + +various builtin parsing words from the syntax and kernel vocabs diff --git a/tests/languages/factor/quotations_feature.test b/tests/languages/factor/quotations_feature.test new file mode 100644 index 0000000000..dfaeedae6a --- /dev/null +++ b/tests/languages/factor/quotations_feature.test @@ -0,0 +1,19 @@ +] [ x y z and ] [ + +---------------------------------------------------- + +[ + ["normal-word", "]"], + ["quotation-delimiter", "["], + ["normal-word", "x" ], + ["normal-word", "y"], + ["normal-word", "z"], + ["kernel-builtin", "and"], + ["quotation-delimiter", "]"], + ["normal-word", "["] +] + +---------------------------------------------------- + +quotation syntax +] at the beginning, and [ at the end of the file should not be highlighted as delimiters diff --git a/tests/languages/factor/regexps_feature.test b/tests/languages/factor/regexps_feature.test new file mode 100644 index 0000000000..2d79d09642 --- /dev/null +++ b/tests/languages/factor/regexps_feature.test @@ -0,0 +1,27 @@ +R/ abcde/i-r +R/ +abcde?.+\?\*\+/ +R/ \\/ +R/ \//idmsr +R/ \/idmsr/ + +----------------------------- + +[ + [ "regexp", [ "R/ abcde/", [ "operator", "i-r" ] ] ], + [ "regexp", [ + "R/\r\nabcde", + [ "keyword", "?" ], + [ "keyword", "." ], + [ "keyword", "+" ], + [ "variable", "\\?" ], + [ "variable", "\\*" ], + [ "variable", "\\+" ], + "/" + ] ], + [ "regexp", [ "R/ ", [ "variable", "\\\\"], "/"] ], + [ "regexp", [ "R/ ", [ "variable", "\\/" ], "/", [ "operator", "idmsr" ] ] ], + [ "regexp", [ "R/ ", [ "variable", "\\/" ], "idmsr/" ] ] +] + +----------------------------- diff --git a/tests/languages/factor/sequences_feature.test b/tests/languages/factor/sequences_feature.test new file mode 100644 index 0000000000..041dc78518 --- /dev/null +++ b/tests/languages/factor/sequences_feature.test @@ -0,0 +1,98 @@ +} +{ 1 2 3 4 } +{ a b c d e f } +{ "a" "b" "c" } + +{ { a b } { c d } } +H{ { a b } { c d } } +H{ { "a" "b" } { "c" "d" } } +V{ 1 2 3 4 } +V{ "1" "2" "3" "4" } +BV{ 1 2 3 4 } +{ + +---------------------------------------------------- + +[ + ["normal-word", "}"], + ["curly-brace-literal-delimiter", "{"], + ["number", "1"], + ["number", "2"], + ["number", "3"], + ["number", "4"], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "{"], + ["normal-word", "a"], + ["normal-word", "b"], + ["normal-word", "c"], + ["normal-word", "d"], + ["normal-word", "e"], + ["boolean", "f"], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "{"], + ["string", ["\"a\""] ], + ["string", ["\"b\""] ], + ["string", ["\"c\""] ], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "{"], + ["curly-brace-literal-delimiter", "{"], + ["normal-word", "a"], + ["normal-word", "b"], + ["curly-brace-literal-delimiter", "}"], + ["curly-brace-literal-delimiter", "{"], + ["normal-word", "c"], + ["normal-word", "d"], + ["curly-brace-literal-delimiter", "}"], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "H{"], + ["curly-brace-literal-delimiter", "{"], + ["normal-word", "a"], + ["normal-word", "b"], + ["curly-brace-literal-delimiter", "}"], + ["curly-brace-literal-delimiter", "{"], + ["normal-word", "c"], + ["normal-word", "d"], + ["curly-brace-literal-delimiter", "}"], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "H{"], + ["curly-brace-literal-delimiter", "{"], + ["string", ["\"a\""]], + ["string", ["\"b\""]], + ["curly-brace-literal-delimiter", "}"], + ["curly-brace-literal-delimiter", "{"], + ["string", ["\"c\""]], + ["string", ["\"d\""]], + ["curly-brace-literal-delimiter", "}"], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "V{"], + ["number", "1"], + ["number", "2"], + ["number", "3"], + ["number", "4"], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "V{"], + ["string", ["\"1\""]], + ["string", ["\"2\""]], + ["string", ["\"3\""]], + ["string", ["\"4\""]], + ["curly-brace-literal-delimiter", "}"], + + ["curly-brace-literal-delimiter", "BV{"], + ["number", "1"], + ["number", "2"], + ["number", "3"], + ["number", "4"], + ["curly-brace-literal-delimiter", "}"], + ["normal-word", "{"] +] + +---------------------------------------------------- + +} / { at the front / EOF are not delimiters diff --git a/tests/languages/factor/stack_effects_feature.test b/tests/languages/factor/stack_effects_feature.test new file mode 100644 index 0000000000..1513e2a5d2 --- /dev/null +++ b/tests/languages/factor/stack_effects_feature.test @@ -0,0 +1,74 @@ +( -- ) +( a b -- c ) +( a: integer b: string -- c: word ) +( x y quot: ( ..a -- ..a ) -- ..a ) +call( -- ) +call( x -- y ) +execute( x -- y ) +eval( x -- y ) + +---------------------------------------------------- + +[ + [ "stack-effect-delimiter", "(" ], + [ "stack-effect-delimiter", "--" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "(" ], + [ "normal-word", "a" ], + [ "normal-word", "b" ], + [ "stack-effect-delimiter", "--" ], + [ "normal-word", "c" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "(" ], + [ "normal-word", "a:" ], + [ "math-builtin", "integer" ], + [ "normal-word", "b:" ], + [ "normal-word", "string" ], + [ "stack-effect-delimiter", "--" ], + [ "normal-word", "c:" ], + [ "normal-word", "word" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "(" ], + [ "normal-word", "x" ], + [ "normal-word", "y" ], + [ "normal-word", "quot:" ], + + [ "stack-effect-delimiter", "(" ], + [ "normal-word", "..a" ], + [ "stack-effect-delimiter", "--" ], + [ "normal-word", "..a" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "--" ], + [ "normal-word", "..a" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "call(" ], + [ "stack-effect-delimiter", "--" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "call(" ], + [ "normal-word", "x" ], + [ "stack-effect-delimiter", "--" ], + [ "normal-word", "y" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "execute(" ], + [ "normal-word", "x" ], + [ "stack-effect-delimiter", "--" ], + [ "normal-word", "y" ], + [ "stack-effect-delimiter", ")" ], + + [ "stack-effect-delimiter", "eval(" ], + [ "normal-word", "x" ], + [ "stack-effect-delimiter", "--" ], + [ "normal-word", "y" ], + [ "stack-effect-delimiter", ")" ] +] + +---------------------------------------------------- + +stack effect syntax diff --git a/tests/languages/factor/strings_feature.test b/tests/languages/factor/strings_feature.test new file mode 100644 index 0000000000..94e77b0c3f --- /dev/null +++ b/tests/languages/factor/strings_feature.test @@ -0,0 +1,127 @@ +"s" word"word" ! word: word"word" +"adjacent""strings" +" ! str not comment" ! comment +"!" +" ! " +"! " + +"\"" +"'" +"\n" +"\\" + +"str"5 +"str"[ ] +"str"{ } +{ "a"} +"5" +"1/5" +"+5" +"-5" + +HEREDOC: marker +text \n +marker + +STRING: name +text \n +; + +[[ string ]] +[[ string]] +[==[ string ]==] +[==[ string]==] + +[[word ]] + +URL" " URL"" +SBUF" " SBUF"" +P" " P"" + +P" as\\"" + +---------------------------------------------------------- + +[ + [ "string", ["\"s\""] ], + [ "normal-word", "word\"word\"" ], + [ "comment", ["! word: word\"word\""] ], + [ "string", ["\"adjacent\""] ], + [ "string", ["\"strings\""] ], + [ "string", ["\" ! str not comment\""] ], + [ "comment", ["! comment"] ], + + [ "string", ["\"!\""] ], + [ "string", ["\" ! \""] ], + [ "string", ["\"! \""] ], + + [ "string", [ + "\"", + [ "number", "\\\"" ], + "\"" + ] ], + [ "string", ["\"'\""] ], + [ "string", [ + "\"", + ["number", "\\n"], + "\"" + ] ], + [ "string", ["\"", ["number", "\\\\"], "\""] ], + + [ "string", ["\"str\""] ], + "5\r\n", + + ["string", ["\"str\""] ], + "[ ", + [ "quotation-delimiter", "]" ], + + [ "string", ["\"str\""] ], + "{ ", + [ "curly-brace-literal-delimiter", "}" ], + + [ "curly-brace-literal-delimiter", "{" ], + [ "string", ["\"a\""] ], + "}\r\n", + + [ "string", ["\"5\""] ], + [ "string", ["\"1/5\""] ], + [ "string", ["\"+5\""] ], + [ "string", ["\"-5\""] ], + + [ "multiline-string", [ + "HEREDOC: marker\r\ntext ", + [ "number", "\\n" ], + "\r\nmarker" + ] ], + + [ "multiline-string", [ + "STRING: name\r\ntext ", + [ "number", "\\n" ], + [ "semicolon-or-setlocal", ";" ] + ] ], + + [ "multiline-string", [ "[[ string ]]" ] ], + [ "multiline-string", [ "[[ string]]" ] ], + [ "multiline-string", [ "[==[ string ]==]" ] ], + [ "multiline-string", [ "[==[ string]==]" ] ], + [ "normal-word", "[[word" ], + [ "normal-word", "]]" ], + [ "custom-string", ["URL\" \""] ], + [ "normal-word", "URL\"\"" ], + + [ "custom-string", ["SBUF\" \""] ], + [ "normal-word", "SBUF\"\"" ], + + [ "custom-string", ["P\" \""] ], + [ "normal-word", "P\"\"" ], + [ "custom-string", [ + "P\" as", + [ "number", "\\\\" ], + "\"" + ] ], + "\"" +] + +---------------------------------------------------------- + +string kinds