openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 5.18 kB
JavaScript
import{n as e}from"./rolldown-runtime-DkW27tQK.js";function t(e,t){return RegExp((t?``:`^`)+`(?:`+e.join(`|`)+`)`+(t?`$`:`\\b`))}function n(e,t,n){return n.tokenize.push(e),e(t,n)}function r(e,t){if(e.eatSpace())return null;if(t.lastToken!=`\\`&&e.match(`{%`,!1))return n(a(`%`,`%`),e,t);if(t.lastToken!=`\\`&&e.match(`{{`,!1))return n(a(`{`,`}`),e,t);if(e.peek()==`#`)return e.skipToEnd(),`comment`;var r;if(e.match(h))return e.eat(/[?!]/),r=e.current(),e.eat(`:`)?`atom`:t.lastToken==`.`?`property`:_.test(r)?(y.test(r)?!(r==`fun`&&t.blocks.indexOf(`lib`)>=0)&&(r!=`def`||t.lastToken!=`abstract`)&&(t.blocks.push(r),t.currentIndent+=1):(t.lastStyle==`operator`||!t.lastStyle)&&b.test(r)?(t.blocks.push(r),t.currentIndent+=1):r==`end`&&(t.blocks.pop(),--t.currentIndent),T.hasOwnProperty(r)&&t.tokenize.push(T[r]),`keyword`):v.test(r)?`atom`:`variable`;if(e.eat(`@`))return e.peek()==`[`?n(i(`[`,`]`,`meta`),e,t):(e.eat(`@`),e.match(h)||e.match(g),`propertyName`);if(e.match(g))return`tag`;if(e.eat(`:`))return e.eat(`"`)?n(l(`"`,`atom`,!1),e,t):e.match(h)||e.match(g)||e.match(d)||e.match(f)||e.match(p)?`atom`:(e.eat(`:`),`operator`);if(e.eat(`"`))return n(l(`"`,`string`,!0),e,t);if(e.peek()==`%`){var o=`string`,s=!0,c;if(e.match(`%r`))o=`string.special`,c=e.next();else if(e.match(`%w`))s=!1,c=e.next();else if(e.match(`%q`))s=!1,c=e.next();else if(c=e.match(/^%([^\w\s=])/))c=c[1];else if(e.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/))return`meta`;else if(e.eat(`%`))return`operator`;return E.hasOwnProperty(c)&&(c=E[c]),n(l(c,o,s),e,t)}return(r=e.match(/^<<-('?)([A-Z]\w*)\1/))?n(u(r[2],!r[1]),e,t):e.eat(`'`)?(e.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/),e.eat(`'`),`atom`):e.eat(`0`)?(e.eat(`x`)?e.match(/^[0-9a-fA-F_]+/):e.eat(`o`)?e.match(/^[0-7_]+/):e.eat(`b`)&&e.match(/^[01_]+/),`number`):e.eat(/^\d/)?(e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/),`number`):e.match(d)?(e.eat(`=`),`operator`):e.match(f)||e.match(m)?`operator`:(r=e.match(/[({[]/,!1))?(r=r[0],n(i(r,E[r],null),e,t)):e.eat(`\\`)?(e.next(),`meta`):(e.next(),null)}function i(e,t,n,a){return function(o,s){if(!a&&o.match(e))return s.tokenize[s.tokenize.length-1]=i(e,t,n,!0),s.currentIndent+=1,n;var c=r(o,s);return o.current()===t&&(s.tokenize.pop(),--s.currentIndent,c=n),c}}function a(e,t,n){return function(i,o){return!n&&i.match(`{`+e)?(o.currentIndent+=1,o.tokenize[o.tokenize.length-1]=a(e,t,!0),`meta`):i.match(t+`}`)?(--o.currentIndent,o.tokenize.pop(),`meta`):r(i,o)}}function o(e,t){if(e.eatSpace())return null;var n;if(n=e.match(h)){if(n==`def`)return`keyword`;e.eat(/[?!]/)}return t.tokenize.pop(),`def`}function s(e,t){return e.eatSpace()?null:(e.match(h)?e.eat(/[!?]/):e.match(d)||e.match(f)||e.match(p),t.tokenize.pop(),`def`)}function c(e,t){return e.eatSpace()?null:(e.match(g),t.tokenize.pop(),`def`)}function l(e,t,n){return function(r,o){for(var s=!1;r.peek();)if(s)r.next(),s=!1;else{if(r.match(`{%`,!1))return o.tokenize.push(a(`%`,`%`)),t;if(r.match(`{{`,!1))return o.tokenize.push(a(`{`,`}`)),t;if(n&&r.match(`#{`,!1))return o.tokenize.push(i(`#{`,`}`,`meta`)),t;var c=r.next();if(c==e)return o.tokenize.pop(),t;s=n&&c==`\\`}return t}}function u(e,t){return function(n,r){if(n.sol()&&(n.eatSpace(),n.match(e)))return r.tokenize.pop(),`string`;for(var o=!1;n.peek();)if(o)n.next(),o=!1;else{if(n.match(`{%`,!1))return r.tokenize.push(a(`%`,`%`)),`string`;if(n.match(`{{`,!1))return r.tokenize.push(a(`{`,`}`)),`string`;if(t&&n.match(`#{`,!1))return r.tokenize.push(i(`#{`,`}`,`meta`)),`string`;o=n.next()==`\\`&&t}return`string`}}var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;function O(){return(O=e((()=>{d=/^(?:[-+/%|&^]|\*\*?|[<>]{2})/,f=/^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/,p=/^(?:\[\][?=]?)/,m=/^(?:\.(?:\.{2})?|->|[?:])/,h=/^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,g=/^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/,_=t(`abstract.alias.as.asm.begin.break.case.class.def.do.else.elsif.end.ensure.enum.extend.for.fun.if.include.instance_sizeof.lib.macro.module.next.of.out.pointerof.private.protected.rescue.return.require.select.sizeof.struct.super.then.type.typeof.uninitialized.union.unless.until.when.while.with.yield.__DIR__.__END_LINE__.__FILE__.__LINE__`.split(`.`)),v=t([`true`,`false`,`nil`,`self`]),y=t([`def`,`fun`,`macro`,`class`,`module`,`struct`,`lib`,`enum`,`union`,`do`,`for`]),b=t([`if`,`unless`,`case`,`while`,`until`,`begin`,`then`]),x=[`end`,`else`,`elsif`,`rescue`,`ensure`],S=t(x),C=[`\\)`,`\\}`,`\\]`],w=RegExp(`^(?:`+C.join(`|`)+`)$`),T={def:s,fun:s,macro:o,class:c,module:c,struct:c,lib:c,enum:c,union:c},E={"[":`]`,"{":`}`,"(":`)`,"<":`>`},D={name:`crystal`,startState:function(){return{tokenize:[r],currentIndent:0,lastToken:null,lastStyle:null,blocks:[]}},token:function(e,t){var n=t.tokenize[t.tokenize.length-1](e,t),r=e.current();return n&&n!=`comment`&&(t.lastToken=r,t.lastStyle=n),n},indent:function(e,t,n){return t=t.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g,``),S.test(t)||w.test(t)?n.unit*(e.currentIndent-1):n.unit*e.currentIndent},languageData:{indentOnInput:t(C.concat(x),!0),commentTokens:{line:`#`}}}})))()}O();export{D as crystal};
//# sourceMappingURL=crystal-tIaXxdp_.js.map