From 46468f84f4d304b4c572f30b7600a637b670b821 Mon Sep 17 00:00:00 2001 From: Juan Caicedo Date: Thu, 5 Apr 2018 12:24:22 -0500 Subject: [PATCH] Add support for Lisp (#1297) * add emacs * rename to elisp * add elisp to components * add comment test * add heading test * WIP string test * update string tests * test symbols in strings * test arguments * test quoted symbol * lisp-property test * splice test * add keyword test * test for declare * test interactive * boolean test * test numbers * test defvar * fix greedy defun regex * test defun * test lambda * test car * test punctuation * use var instead of const * remove arrow functions * flatten language structure * remove unnecessary escaping * add lisp and emacs * add lisp * fix template strings * minify lisp * add example elisp file * simplify number * don't mark other def as keywords * dont mark other def as keyword in defun * make lambda a keyword only at the beginning * restore single quotes in components * double quote in elisp * minify elisp * quote keys in components * rename punctuation test * add semicolons elisp * undo prettier changes to components.js * add lisp to components.json * rename elisp to lisp * fix components.json * add minified lisp file * rename example lisp file * move lisp to first position * explain null initialized properties in lisp file * remove trailing commas * put lisp first in example file * add ifee for lisp file * update lisp min file * update show language assets * add components index min file * add emacs-lisp alias * change title of lisp example file * undo theme change * combine regex for parens * remove min index * remove unneeded example html * remove doubled string test * capitalize lisp in components * change string theme to match master * build assets after adding lisp --- components.js | 2 +- components.json | 5 + components/prism-lisp.js | 197 ++++++++++++++++++ components/prism-lisp.min.js | 1 + examples/prism-lisp.html | 46 ++++ tests/languages/lisp/boolean_feature.test | 17 ++ tests/languages/lisp/car_feature.test | 13 ++ tests/languages/lisp/comment_feature.test | 11 + tests/languages/lisp/declare_feature.test | 16 ++ tests/languages/lisp/defun_feature.test | 27 +++ tests/languages/lisp/defvar_feature.test | 25 +++ tests/languages/lisp/heading_feature.test | 11 + tests/languages/lisp/interactive_feature.test | 16 ++ tests/languages/lisp/keyword_feature.test | 73 +++++++ tests/languages/lisp/lambda-feature.test | 13 ++ .../languages/lisp/lisp-property_feature.test | 15 ++ tests/languages/lisp/number_boolean.test | 27 +++ tests/languages/lisp/punctuation_feature.test | 16 ++ .../languages/lisp/quoted-symbol_feature.test | 17 ++ tests/languages/lisp/splice_feature.test | 17 ++ tests/languages/lisp/string_feature.test | 27 +++ 21 files changed, 591 insertions(+), 1 deletion(-) create mode 100644 components/prism-lisp.js create mode 100644 components/prism-lisp.min.js create mode 100644 examples/prism-lisp.html create mode 100644 tests/languages/lisp/boolean_feature.test create mode 100644 tests/languages/lisp/car_feature.test create mode 100644 tests/languages/lisp/comment_feature.test create mode 100644 tests/languages/lisp/declare_feature.test create mode 100644 tests/languages/lisp/defun_feature.test create mode 100644 tests/languages/lisp/defvar_feature.test create mode 100644 tests/languages/lisp/heading_feature.test create mode 100644 tests/languages/lisp/interactive_feature.test create mode 100644 tests/languages/lisp/keyword_feature.test create mode 100644 tests/languages/lisp/lambda-feature.test create mode 100644 tests/languages/lisp/lisp-property_feature.test create mode 100644 tests/languages/lisp/number_boolean.test create mode 100644 tests/languages/lisp/punctuation_feature.test create mode 100644 tests/languages/lisp/quoted-symbol_feature.test create mode 100644 tests/languages/lisp/splice_feature.test create mode 100644 tests/languages/lisp/string_feature.test diff --git a/components.js b/components.js index 24511427e7..8858f0fe59 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"},"clike":{"title":"C-like","option":"default","overrideExampleHeader":true},"javascript":{"title":"JavaScript","require":"clike","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"actionscript":{"title":"ActionScript","require":"javascript","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":"markup","owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","alias":"shell","owner":"Golmote"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":"dotnet","owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"coffeescript":{"title":"CoffeeScript","require":"javascript","owner":"R-osey"},"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","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","alias":"jinja2","owner":"romanvm"},"docker":{"title":"Docker","owner":"JustinBeckwith"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"clike","owner":"Golmote"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"http":{"title":"HTTP","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"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"json":{"title":"JSON","owner":"CupOfTea696"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","owner":"japborst"},"less":{"title":"Less","require":"css","owner":"Golmote"},"liquid":{"title":"Liquid","owner":"cinhtau"},"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","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"},"n4js":{"title":"N4JS","require":"javascript","owner":"bsmith-n4"},"nasm":{"title":"NASM","owner":"rbmj"},"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","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","owner":"Golmote"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"php-extras":{"title":"PHP Extras","require":"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":"javascript","owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","owner":"Golmote"},"python":{"title":"Python","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"jsx":{"title":"React JSX","require":["markup","javascript"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"ruby":{"title":"Ruby","require":"clike","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","owner":"Golmote"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","alias":"ts","owner":"vkbansal"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","owner":"freakmaxi"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"yaml":{"title":"YAML","owner":"hason"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":"Line Highlight","line-numbers":{"title":"Line Numbers","owner":"kuba-kubula"},"show-invisibles":"Show Invisibles","autolinker":"Autolinker","wpd":"WebPlatform Docs","custom-class":{"title":"Custom Class","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","noCSS":true},"show-language":{"title":"Show Language","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","owner":"Golmote","noCSS":true},"previewers":{"title":"Previewers","owner":"Golmote"},"autoloader":{"title":"Autoloader","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","owner":"Golmote","after":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","owner":"chriswells0"},"unescaped-markup":"Unescaped Markup","normalize-whitespace":{"title":"Normalize Whitespace","owner":"zeitgeist87","after":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","owner":"mAAdhaTTah","require":"toolbar","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"},"clike":{"title":"C-like","option":"default","overrideExampleHeader":true},"javascript":{"title":"JavaScript","require":"clike","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"actionscript":{"title":"ActionScript","require":"javascript","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":"markup","owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","alias":"shell","owner":"Golmote"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":"dotnet","owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"coffeescript":{"title":"CoffeeScript","require":"javascript","owner":"R-osey"},"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","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","alias":"jinja2","owner":"romanvm"},"docker":{"title":"Docker","owner":"JustinBeckwith"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"clike","owner":"Golmote"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"http":{"title":"HTTP","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"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"json":{"title":"JSON","owner":"CupOfTea696"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","owner":"japborst"},"less":{"title":"Less","require":"css","owner":"Golmote"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","owner":"JuanCaicedo","alias":["emacs","elisp","emacs-lisp"]},"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","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"},"n4js":{"title":"N4JS","require":"javascript","owner":"bsmith-n4"},"nasm":{"title":"NASM","owner":"rbmj"},"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","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","owner":"Golmote"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"php-extras":{"title":"PHP Extras","require":"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":"javascript","owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","owner":"Golmote"},"python":{"title":"Python","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"jsx":{"title":"React JSX","require":["markup","javascript"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"ruby":{"title":"Ruby","require":"clike","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","owner":"Golmote"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","alias":"ts","owner":"vkbansal"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","owner":"freakmaxi"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"yaml":{"title":"YAML","owner":"hason"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":"Line Highlight","line-numbers":{"title":"Line Numbers","owner":"kuba-kubula"},"show-invisibles":"Show Invisibles","autolinker":"Autolinker","wpd":"WebPlatform Docs","custom-class":{"title":"Custom Class","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","noCSS":true},"show-language":{"title":"Show Language","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","owner":"Golmote","noCSS":true},"previewers":{"title":"Previewers","owner":"Golmote"},"autoloader":{"title":"Autoloader","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","owner":"Golmote","after":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","owner":"chriswells0"},"unescaped-markup":"Unescaped Markup","normalize-whitespace":{"title":"Normalize Whitespace","owner":"zeitgeist87","after":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","owner":"mAAdhaTTah","require":"toolbar","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 9a4af4c187..c276ef6529 100644 --- a/components.json +++ b/components.json @@ -373,6 +373,11 @@ "title": "Liquid", "owner": "cinhtau" }, + "lisp": { + "title": "Lisp", + "owner": "JuanCaicedo", + "alias": ["emacs", "elisp", "emacs-lisp"] + }, "livescript": { "title": "LiveScript", "owner": "Golmote" diff --git a/components/prism-lisp.js b/components/prism-lisp.js new file mode 100644 index 0000000000..b8b0451405 --- /dev/null +++ b/components/prism-lisp.js @@ -0,0 +1,197 @@ +(function (Prism) { + // Functions to construct regular expressions + // simple form + // e.g. (interactive ... or (interactive) + function simple_form(name) { + return new RegExp('(\\()' + name + '(?=[\\s\\)])'); + } + // booleans and numbers + function primitive(pattern) { + return new RegExp('([\\s([])' + pattern + '(?=[\\s)])'); + } + + // Patterns in regular expressions + + // Symbol name. See https://www.gnu.org/software/emacs/manual/html_node/elisp/Symbol-Type.html + // & and : are excluded as they are usually used for special purposes + var symbol = '[-+*/_~!@$%^=<>{}\\w]+'; + // symbol starting with & used in function arguments + var marker = '&' + symbol; + // Open parenthesis for look-behind + var par = '(\\()'; + var endpar = '(?=\\))'; + // End the pattern with look-ahead space + var space = '(?=\\s)'; + + var language = { + // Three or four semicolons are considered a heading. + // See https://www.gnu.org/software/emacs/manual/html_node/elisp/Comment-Tips.html + heading: { + pattern: /;;;.*/, + alias: ['comment', 'title'] + }, + comment: /;.*/, + string: { + pattern: /"(?:[^"\\]*|\\.)*"/, + greedy: true, + inside: { + argument: /[-A-Z]+(?=[.,\s])/, + symbol: new RegExp('`' + symbol + "'") + } + }, + 'quoted-symbol': { + pattern: new RegExp("#?'" + symbol), + alias: ['variable', 'symbol'] + }, + 'lisp-property': { + pattern: new RegExp(':' + symbol), + alias: 'property' + }, + splice: { + pattern: new RegExp(',@?' + symbol), + alias: ['symbol', 'variable'] + }, + keyword: [ + { + pattern: new RegExp( + par + + '(?:(?:lexical-)?let\\*?|(?:cl-)?letf|if|when|while|unless|cons|cl-loop|and|or|not|cond|setq|error|message|null|require|provide|use-package)' + + space + ), + lookbehind: true + }, + { + pattern: new RegExp( + par + '(?:for|do|collect|return|finally|append|concat|in|by)' + space + ), + lookbehind: true + }, + ], + declare: { + pattern: simple_form('declare'), + lookbehind: true, + alias: 'keyword' + }, + interactive: { + pattern: simple_form('interactive'), + lookbehind: true, + alias: 'keyword' + }, + boolean: { + pattern: primitive('(?:t|nil)'), + lookbehind: true + }, + number: { + pattern: primitive('[-+]?\\d+(?:\\.\\d*)?'), + lookbehind: true + }, + defvar: { + pattern: new RegExp(par + 'def(?:var|const|custom|group)\\s+' + symbol), + lookbehind: true, + inside: { + keyword: /^def[a-z]+/, + variable: new RegExp(symbol) + } + }, + defun: { + pattern: new RegExp( + par + + '(?:cl-)?(?:defun\\*?|defmacro)\\s+' + + symbol + + '\\s+\\([\\s\\S]*?\\)' + ), + lookbehind: true, + inside: { + keyword: /^(?:cl-)?def\S+/, + // See below, this property needs to be defined later so that it can + // reference the language object. + arguments: null, + function: { + pattern: new RegExp('(^\\s)' + symbol), + lookbehind: true + }, + punctuation: /[()]/ + } + }, + lambda: { + pattern: new RegExp(par + 'lambda\\s+\\((?:&?' + symbol + '\\s*)*\\)'), + lookbehind: true, + inside: { + keyword: /^lambda/, + // See below, this property needs to be defined later so that it can + // reference the language object. + arguments: null, + punctuation: /[()]/ + } + }, + car: { + pattern: new RegExp(par + symbol), + lookbehind: true + }, + punctuation: [ + // open paren, brackets, and close paren + /(['`,]?\(|[)\[\]])/, + // cons + { + pattern: /(\s)\.(?=\s)/, + lookbehind: true + }, + ] + }; + + var arg = { + 'lisp-marker': new RegExp(marker), + rest: { + argument: { + pattern: new RegExp(symbol), + alias: 'variable' + }, + varform: { + pattern: new RegExp(par + symbol + '\\s+\\S[\\s\\S]*' + endpar), + lookbehind: true, + inside: { + string: language.string, + boolean: language.boolean, + number: language.number, + symbol: language.symbol, + punctuation: /[()]/ + } + } + } + }; + + var forms = '\\S+(?:\\s+\\S+)*'; + + var arglist = { + pattern: new RegExp(par + '[\\s\\S]*' + endpar), + lookbehind: true, + inside: { + 'rest-vars': { + pattern: new RegExp('&(?:rest|body)\\s+' + forms), + inside: arg + }, + 'other-marker-vars': { + pattern: new RegExp('&(?:optional|aux)\\s+' + forms), + inside: arg + }, + keys: { + pattern: new RegExp('&key\\s+' + forms + '(?:\\s+&allow-other-keys)?'), + inside: arg + }, + argument: { + pattern: new RegExp(symbol), + alias: 'variable' + }, + punctuation: /[()]/ + } + }; + + language['lambda'].inside.arguments = arglist; + language['defun'].inside.arguments = Prism.util.clone(arglist); + language['defun'].inside.arguments.inside.sublist = arglist; + + Prism.languages.lisp = language; + Prism.languages.elisp = language; + Prism.languages.emacs = language; + Prism.languages['emacs-lisp'] = language; +}(Prism)); \ No newline at end of file diff --git a/components/prism-lisp.min.js b/components/prism-lisp.min.js new file mode 100644 index 0000000000..6aa700bca6 --- /dev/null +++ b/components/prism-lisp.min.js @@ -0,0 +1 @@ +!function(e){function n(e){return new RegExp("(\\()"+e+"(?=[\\s\\)])")}function a(e){return new RegExp("([\\s([])"+e+"(?=[\\s)])")}var t="[-+*/_~!@$%^=<>{}\\w]+",r="&"+t,i="(\\()",s="(?=\\))",o="(?=\\s)",l={heading:{pattern:/;;;.*/,alias:["comment","title"]},comment:/;.*/,string:{pattern:/"(?:[^"\\]*|\\.)*"/,greedy:!0,inside:{argument:/[-A-Z]+(?=[.,\s])/,symbol:new RegExp("`"+t+"'")}},"quoted-symbol":{pattern:new RegExp("#?'"+t),alias:["variable","symbol"]},"lisp-property":{pattern:new RegExp(":"+t),alias:"property"},splice:{pattern:new RegExp(",@?"+t),alias:["symbol","variable"]},keyword:[{pattern:new RegExp(i+"(?:(?:lexical-)?let\\*?|(?:cl-)?letf|if|when|while|unless|cons|cl-loop|and|or|not|cond|setq|error|message|null|require|provide|use-package)"+o),lookbehind:!0},{pattern:new RegExp(i+"(?:for|do|collect|return|finally|append|concat|in|by)"+o),lookbehind:!0}],declare:{pattern:n("declare"),lookbehind:!0,alias:"keyword"},interactive:{pattern:n("interactive"),lookbehind:!0,alias:"keyword"},"boolean":{pattern:a("(?:t|nil)"),lookbehind:!0},number:{pattern:a("[-+]?\\d+(?:\\.\\d*)?"),lookbehind:!0},defvar:{pattern:new RegExp(i+"def(?:var|const|custom|group)\\s+"+t),lookbehind:!0,inside:{keyword:/^def[a-z]+/,variable:new RegExp(t)}},defun:{pattern:new RegExp(i+"(?:cl-)?(?:defun\\*?|defmacro)\\s+"+t+"\\s+\\([\\s\\S]*?\\)"),lookbehind:!0,inside:{keyword:/^(?:cl-)?def\S+/,arguments:null,"function":{pattern:new RegExp("(^\\s)"+t),lookbehind:!0},punctuation:/[()]/}},lambda:{pattern:new RegExp(i+"lambda\\s+\\((?:&?"+t+"\\s*)*\\)"),lookbehind:!0,inside:{keyword:/^lambda/,arguments:null,punctuation:/[()]/}},car:{pattern:new RegExp(i+t),lookbehind:!0},punctuation:[/(['`,]?\(|[)\[\]])/,{pattern:/(\s)\.(?=\s)/,lookbehind:!0}]},p={"lisp-marker":new RegExp(r),rest:{argument:{pattern:new RegExp(t),alias:"variable"},varform:{pattern:new RegExp(i+t+"\\s+\\S[\\s\\S]*"+s),lookbehind:!0,inside:{string:l.string,"boolean":l.boolean,number:l.number,symbol:l.symbol,punctuation:/[()]/}}}},d="\\S+(?:\\s+\\S+)*",u={pattern:new RegExp(i+"[\\s\\S]*"+s),lookbehind:!0,inside:{"rest-vars":{pattern:new RegExp("&(?:rest|body)\\s+"+d),inside:p},"other-marker-vars":{pattern:new RegExp("&(?:optional|aux)\\s+"+d),inside:p},keys:{pattern:new RegExp("&key\\s+"+d+"(?:\\s+&allow-other-keys)?"),inside:p},argument:{pattern:new RegExp(t),alias:"variable"},punctuation:/[()]/}};l.lambda.inside.arguments=u,l.defun.inside.arguments=e.util.clone(u),l.defun.inside.arguments.inside.sublist=u,e.languages.lisp=l,e.languages.elisp=l,e.languages.emacs=l,e.languages["emacs-lisp"]=l}(Prism); \ No newline at end of file diff --git a/examples/prism-lisp.html b/examples/prism-lisp.html new file mode 100644 index 0000000000..436d5c9c8c --- /dev/null +++ b/examples/prism-lisp.html @@ -0,0 +1,46 @@ +

Comments

+
;; (foo bar)
+ +

Strings

+
(foo "bar")
+ +

With nested symbols

+
(foo "A string with a `symbol ")
+ +

With nested arguments

+
(foo "A string with an ARGUMENT ")
+ +

Quoted symbols

+
(foo #'bar)
+ +

Lisp properties

+
(foo :bar)
+ +

Splices

+
(foo ,bar ,@bar)
+ +

Keywords

+
(let foo (bar arg))
+ +

Declarations

+
(declare foo)
+ +

Booleans

+
(foo t)
+
(foo nil)
+ +

Numbers

+
(foo 1)
+
(foo -1.5)
+ +

Definitions

+
(defvar bar 23)
+
(defcustom bar 23)
+ +

Function definitions

+
(defun multiply-by-seven (number)
+       "Multiply NUMBER by seven."
+       (* 7 number))
+ +

Lambda expressions

+
(lambda (number) (* 7 number))
\ No newline at end of file diff --git a/tests/languages/lisp/boolean_feature.test b/tests/languages/lisp/boolean_feature.test new file mode 100644 index 0000000000..35d2ac1f3a --- /dev/null +++ b/tests/languages/lisp/boolean_feature.test @@ -0,0 +1,17 @@ +(t) +(nil) +(foo t) +[t ] + +---------------------------------------------------- + +[ + ["punctuation", "("], ["boolean", "t"], ["punctuation", ")"], + ["punctuation", "("], ["boolean", "nil"], ["punctuation", ")"], + ["punctuation", "("], ["car", "foo"], ["boolean", "t"], ["punctuation", ")"], + ["punctuation", "["], ["boolean", "t"], ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/tests/languages/lisp/car_feature.test b/tests/languages/lisp/car_feature.test new file mode 100644 index 0000000000..24846bbaae --- /dev/null +++ b/tests/languages/lisp/car_feature.test @@ -0,0 +1,13 @@ +(foo) +(foo bar) + +---------------------------------------------------- + +[ + ["punctuation","("], ["car", "foo"], ["punctuation",")"], + ["punctuation","("], ["car", "foo"], " bar", ["punctuation",")"] +] + +---------------------------------------------------- + +Checks for car. \ No newline at end of file diff --git a/tests/languages/lisp/comment_feature.test b/tests/languages/lisp/comment_feature.test new file mode 100644 index 0000000000..47788a92f1 --- /dev/null +++ b/tests/languages/lisp/comment_feature.test @@ -0,0 +1,11 @@ +;; h1 + +---------------------------------------------------- + +[ + ["comment", ";; h1"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/tests/languages/lisp/declare_feature.test b/tests/languages/lisp/declare_feature.test new file mode 100644 index 0000000000..5aaf52fe22 --- /dev/null +++ b/tests/languages/lisp/declare_feature.test @@ -0,0 +1,16 @@ +(declare) +(declare a) +(declare +a) + +---------------------------------------------------- + +[ + ["punctuation", "("], ["declare", "declare"], ["punctuation", ")"], + ["punctuation", "("], ["declare", "declare"], " a", ["punctuation", ")"], + ["punctuation", "("], ["declare", "declare"], "\r\na", ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for declare. diff --git a/tests/languages/lisp/defun_feature.test b/tests/languages/lisp/defun_feature.test new file mode 100644 index 0000000000..b9c1f7fdc5 --- /dev/null +++ b/tests/languages/lisp/defun_feature.test @@ -0,0 +1,27 @@ +(defun foo ()) +(defun foo (bar)) +(defun foo (bar &body arg1) ) +(defun foo (bar &rest arg1) ) +(defun foo (bar &body arg1 arg2) ) +(defun foo (bar &key arg1) ) +(defun foo (bar &key arg1 &allow-other-keys) ) +(defun foo (&optional arg1) ) +(defun defabc ()) + +---------------------------------------------------- + +[ + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", []], ["punctuation", ")"]]], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", [[ "argument", "bar" ]]], ["punctuation", ")"]]], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", [[ "argument", "bar" ], ["rest-vars", [["lisp-marker", "&body" ], ["argument", "arg1"]]]]], ["punctuation", ")"]] ], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", [[ "argument", "bar" ], ["rest-vars", [["lisp-marker", "&rest" ], ["argument", "arg1"]]]]], ["punctuation", ")"]] ], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", [[ "argument", "bar" ], ["rest-vars", [["lisp-marker", "&body" ], ["argument", "arg1"], ["argument", "arg2"]]]]], ["punctuation", ")"]] ], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", [[ "argument", "bar" ], ["keys", [["lisp-marker", "&key" ], ["argument", "arg1"]]]]], ["punctuation", ")"]] ], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", [[ "argument", "bar" ], ["keys", [["lisp-marker", "&key" ], ["argument", "arg1"], ["lisp-marker", "&allow-other-keys"]]]]], ["punctuation", ")"]] ], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "foo"], ["punctuation", "("], ["arguments", [["other-marker-vars", [["lisp-marker", "&optional" ], ["argument", "arg1"]]]]], ["punctuation", ")"]] ], ["punctuation", ")"], + ["punctuation", "("], ["defun", [ ["keyword", "defun" ], ["function", "defabc"], ["punctuation", "("], ["arguments", []], ["punctuation", ")"]]], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for defun. \ No newline at end of file diff --git a/tests/languages/lisp/defvar_feature.test b/tests/languages/lisp/defvar_feature.test new file mode 100644 index 0000000000..3d0b6ae03a --- /dev/null +++ b/tests/languages/lisp/defvar_feature.test @@ -0,0 +1,25 @@ +(defvar foo) +(defvar foo bar) +(defvar foo) +(defvar) +(defconst foo) +(defcustom foo) +(defgroup foo) +(defvar defabc) + +---------------------------------------------------- + +[ + ["punctuation", "("], ["defvar", [ ["keyword", "defvar" ], ["variable", "foo"] ]], ["punctuation", ")"], + ["punctuation", "("], ["defvar", [ ["keyword", "defvar" ], ["variable", "foo"] ]], " bar", ["punctuation", ")"], + ["punctuation", "("], ["defvar", [ ["keyword", "defvar" ], ["variable", "foo"] ]], ["punctuation", ")"], + ["punctuation", "("], ["car", "defvar"], ["punctuation", ")"], + ["punctuation", "("], ["defvar", [ ["keyword", "defconst" ], ["variable", "foo"] ]], ["punctuation", ")"], + ["punctuation", "("], ["defvar", [ ["keyword", "defcustom" ], ["variable", "foo"] ]], ["punctuation", ")"], + ["punctuation", "("], ["defvar", [ ["keyword", "defgroup" ], ["variable", "foo"] ]], ["punctuation", ")"], + ["punctuation", "("], ["defvar", [ ["keyword", "defvar" ], ["variable", "defabc"] ]], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for defvar. diff --git a/tests/languages/lisp/heading_feature.test b/tests/languages/lisp/heading_feature.test new file mode 100644 index 0000000000..2136495fa1 --- /dev/null +++ b/tests/languages/lisp/heading_feature.test @@ -0,0 +1,11 @@ +;;; h1 + +---------------------------------------------------- + +[ + ["heading", ";;; h1"] +] + +---------------------------------------------------- + +Checks for headings. diff --git a/tests/languages/lisp/interactive_feature.test b/tests/languages/lisp/interactive_feature.test new file mode 100644 index 0000000000..f3bc95866b --- /dev/null +++ b/tests/languages/lisp/interactive_feature.test @@ -0,0 +1,16 @@ +(interactive) +(interactive a) +(interactive +a) + +---------------------------------------------------- + +[ + ["punctuation", "("], ["interactive", "interactive"], ["punctuation", ")"], + ["punctuation", "("], ["interactive", "interactive"], " a", ["punctuation", ")"], + ["punctuation", "("], ["interactive", "interactive"], "\r\na", ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for declare. diff --git a/tests/languages/lisp/keyword_feature.test b/tests/languages/lisp/keyword_feature.test new file mode 100644 index 0000000000..f47119274e --- /dev/null +++ b/tests/languages/lisp/keyword_feature.test @@ -0,0 +1,73 @@ +(let ) +let +(lexical-let ) +(let* ) +(letf ) +(cl-letf ) +(if ) +(when ) +(while ) +(unless ) +(cons ) +(cl-loop ) +(and ) +(or ) +(not ) +(cond ) +(setq ) +(error ) +(message ) +(null ) +(require ) +(provide ) +(use-package ) +(for ) +(do ) +(collect ) +(return ) +(finally ) +(append ) +(concat ) +(in ) +(by ) + +---------------------------------------------------- + +[ + ["punctuation", "("], ["keyword", "let"], ["punctuation", ")"], + "\r\nlet\r\n", + ["punctuation", "("], ["keyword", "lexical-let"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "let*"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "letf"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "cl-letf"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "if"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "when"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "while"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "unless"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "cons"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "cl-loop"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "and"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "or"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "not"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "cond"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "setq"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "error"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "message"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "null"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "require"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "provide"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "use-package"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "for"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "do"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "collect"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "return"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "finally"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "append"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "concat"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "in"], ["punctuation", ")"], + ["punctuation", "("], ["keyword", "by"], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for all keyword variations. diff --git a/tests/languages/lisp/lambda-feature.test b/tests/languages/lisp/lambda-feature.test new file mode 100644 index 0000000000..032f1986e7 --- /dev/null +++ b/tests/languages/lisp/lambda-feature.test @@ -0,0 +1,13 @@ +(lambda () ()) +(lambda () (foo bar)) + +---------------------------------------------------- + +[ + ["punctuation","("],["lambda",[["keyword","lambda"],["punctuation","("],["arguments",[]],["punctuation",")"]]],["punctuation","("],["punctuation",")"],["punctuation",")"], + ["punctuation","("],["lambda",[["keyword","lambda"],["punctuation","("],["arguments",[]],["punctuation",")"]]],["punctuation","("],["car","foo"]," bar",["punctuation",")"],["punctuation",")"] +] + +---------------------------------------------------- + +Checks for lambda. \ No newline at end of file diff --git a/tests/languages/lisp/lisp-property_feature.test b/tests/languages/lisp/lisp-property_feature.test new file mode 100644 index 0000000000..62e324d122 --- /dev/null +++ b/tests/languages/lisp/lisp-property_feature.test @@ -0,0 +1,15 @@ +( +:foo +) + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["lisp-property", ":foo"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for lisp properties. diff --git a/tests/languages/lisp/number_boolean.test b/tests/languages/lisp/number_boolean.test new file mode 100644 index 0000000000..4acb969190 --- /dev/null +++ b/tests/languages/lisp/number_boolean.test @@ -0,0 +1,27 @@ +(1) +(12) +(1.2) +(1.23) +(1.) +(foo 1) +[1 ] +(-1) +(+1) + +---------------------------------------------------- + +[ + ["punctuation", "("], ["number", "1"], ["punctuation", ")"], + ["punctuation", "("], ["number", "12"], ["punctuation", ")"], + ["punctuation", "("], ["number", "1.2"], ["punctuation", ")"], + ["punctuation", "("], ["number", "1.23"], ["punctuation", ")"], + ["punctuation", "("], ["number", "1."], ["punctuation", ")"], + ["punctuation", "("], ["car", "foo"], ["number", "1"], ["punctuation", ")"], + ["punctuation", "["], ["number", "1"], ["punctuation", "]"], + ["punctuation", "("], ["number", "-1"], ["punctuation", ")"], + ["punctuation", "("], ["number", "+1"], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/tests/languages/lisp/punctuation_feature.test b/tests/languages/lisp/punctuation_feature.test new file mode 100644 index 0000000000..904ef79f48 --- /dev/null +++ b/tests/languages/lisp/punctuation_feature.test @@ -0,0 +1,16 @@ +() +( ) +[] +( + +---------------------------------------------------- + +[ + ["punctuation", "("], ["punctuation", ")"], + ["punctuation", "("], ["punctuation", ")"], + ["punctuation", "["], ["punctuation", "]"], + ["punctuation", "("] +] +---------------------------------------------------- + +Checks for punctuation. \ No newline at end of file diff --git a/tests/languages/lisp/quoted-symbol_feature.test b/tests/languages/lisp/quoted-symbol_feature.test new file mode 100644 index 0000000000..d02d823b3c --- /dev/null +++ b/tests/languages/lisp/quoted-symbol_feature.test @@ -0,0 +1,17 @@ +( +#'foo +'foo +) + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["quoted-symbol", "#'foo"], + ["quoted-symbol", "'foo"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for quoted symbols. diff --git a/tests/languages/lisp/splice_feature.test b/tests/languages/lisp/splice_feature.test new file mode 100644 index 0000000000..c80cd73da5 --- /dev/null +++ b/tests/languages/lisp/splice_feature.test @@ -0,0 +1,17 @@ +( +,foo +,@foo +) + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["splice", ",foo"], + ["splice", ",@foo"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for splices diff --git a/tests/languages/lisp/string_feature.test b/tests/languages/lisp/string_feature.test new file mode 100644 index 0000000000..38fc007d83 --- /dev/null +++ b/tests/languages/lisp/string_feature.test @@ -0,0 +1,27 @@ +( +"" +"foo +bar" +"\"foo\"" +"foo\tbar" +"`foo'" +"FOO." +) + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["string", [ "\"\"" ]], + ["string", [ "\"foo\r\nbar\"" ]], + ["string", [ "\"\\\"foo\\\"\"" ]], + ["string", [ "\"foo\\tbar\"" ]], + ["string", [ "\"", ["symbol", "`foo'"], "\"" ]], + ["string", [ "\"", ["argument", "FOO"], ".\"" ]], + ["punctuation", ")"] + +] + +---------------------------------------------------- + +Checks for all string variations.