var e=/[+\-\/\\*~<>=@%|&?!.,:;^]/,t=/true|false|nil|self|super|thisContext/,n=function(e,t){this.next=e,this.parent=t},r=function(e,t,n){this.name=e,this.context=t,this.eos=n},i=function(){this.context=new n(a,null),this.expectVariable=!0,this.indentation=0,this.userIndentationDelta=0};i.prototype.userIndent=function(e,t){this.userIndentationDelta=e>0?e/t-this.indentation:0};var a=function(i,a,u){var d=new r(null,a,!1),f=i.next();return f===`"`?d=o(i,new n(o,a)):f===`'`?d=s(i,new n(s,a)):f===`#`?i.peek()===`'`?(i.next(),d=c(i,new n(c,a))):i.eatWhile(/[^\s.{}\[\]()]/)?d.name=`string.special`:d.name=`meta`:f===`$`?(i.next()===`<`&&(i.eatWhile(/[^\s>]/),i.next()),d.name=`string.special`):f===`|`&&u.expectVariable?d.context=new n(l,a):/[\[\]{}()]/.test(f)?(d.name=`bracket`,d.eos=/[\[{(]/.test(f),f===`[`?u.indentation++:f===`]`&&(u.indentation=Math.max(0,u.indentation-1))):e.test(f)?(i.eatWhile(e),d.name=`operator`,d.eos=f!==`;`):/\d/.test(f)?(i.eatWhile(/[\w\d]/),d.name=`number`):/[\w_]/.test(f)?(i.eatWhile(/[\w\d_]/),d.name=u.expectVariable?t.test(i.current())?`keyword`:`variable`:null):d.eos=u.expectVariable,d},o=function(e,t){return e.eatWhile(/[^"]/),new r(`comment`,e.eat(`"`)?t.parent:t,!0)},s=function(e,t){return e.eatWhile(/[^']/),new r(`string`,e.eat(`'`)?t.parent:t,!1)},c=function(e,t){return e.eatWhile(/[^']/),new r(`string.special`,e.eat(`'`)?t.parent:t,!1)},l=function(e,t){var n=new r(null,t,!1);return e.next()===`|`?(n.context=t.parent,n.eos=!0):(e.eatWhile(/[^|]/),n.name=`variable`),n},u={name:`smalltalk`,startState:function(){return new i},token:function(e,t){if(t.userIndent(e.indentation(),e.indentUnit),e.eatSpace())return null;var n=t.context.next(e,t.context,t);return t.context=n.context,t.expectVariable=n.eos,n.name},blankLine:function(e,t){e.userIndent(0,t)},indent:function(e,t,n){var r=e.context.next===a&&t&&t.charAt(0)===`]`?-1:e.userIndentationDelta;return(e.indentation+r)*n.unit},languageData:{indentOnInput:/^\s*\]$/}};export{u as smalltalk};
//# sourceMappingURL=smalltalk.JpMrOkX2.js.map