15 lines
1.1 KiB
JavaScript
15 lines
1.1 KiB
JavaScript
hljs.registerLanguage("lisp",(()=>{"use strict";return e=>{
|
|
var n="[a-zA-Z_\\-+\\*\\/<=>&#][a-zA-Z0-9_\\-+*\\/<=>&#!]*",a="\\|[^]*?\\|",i="(-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s|D|E|F|L|S)(\\+|-)?\\d+)?",s={
|
|
className:"literal",begin:"\\b(t{1}|nil)\\b"},l={className:"number",variants:[{
|
|
begin:i,relevance:0},{begin:"#(b|B)[0-1]+(/[0-1]+)?"},{
|
|
begin:"#(o|O)[0-7]+(/[0-7]+)?"},{begin:"#(x|X)[0-9a-fA-F]+(/[0-9a-fA-F]+)?"},{
|
|
begin:"#(c|C)\\("+i+" +"+i,end:"\\)"}]},b=e.inherit(e.QUOTE_STRING_MODE,{
|
|
illegal:null}),g=e.COMMENT(";","$",{relevance:0}),r={begin:"\\*",end:"\\*"},t={
|
|
className:"symbol",begin:"[:&]"+n},c={begin:n,relevance:0},d={begin:a},o={
|
|
contains:[l,b,r,t,{begin:"\\(",end:"\\)",contains:["self",s,b,l,c]},c],
|
|
variants:[{begin:"['`]\\(",end:"\\)"},{begin:"\\(quote ",end:"\\)",keywords:{
|
|
name:"quote"}},{begin:"'"+a}]},v={variants:[{begin:"'"+n},{
|
|
begin:"#'"+n+"(::"+n+")*"}]},m={begin:"\\(\\s*",end:"\\)"},u={endsWithParent:!0,
|
|
relevance:0};return m.contains=[{className:"name",variants:[{begin:n,relevance:0
|
|
},{begin:a}]},u],u.contains=[o,v,m,s,l,b,g,r,t,d,c],{name:"Lisp",illegal:/\S/,
|
|
contains:[l,e.SHEBANG(),s,b,g,o,v,m,c]}}})()); |