!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("smalltalk",function(i){function r(e,t){this.next=e,this.parent=t}function o(e,t,n){this.name=e,this.context=t,this.eos=n}function e(){this.context=new r(a,null),this.expectVariable=!0,this.indentation=0,this.userIndentationDelta=0}var s=/[+\-\/\\*~<>=@%|&?!.,:;^]/,u=/true|false|nil|self|super|thisContext/;e.prototype.userIndent=function(e){this.userIndentationDelta=0<e?e/i.indentUnit-this.indentation:0};var a=function(e,t,n){var i=new o(null,t,!1),a=e.next();return'"'===a?i=c(e,new r(c,t)):"'"===a?i=l(e,new r(l,t)):"#"===a?"'"===e.peek()?(e.next(),i=d(e,new r(d,t))):e.eatWhile(/[^\s.{}\[\]()]/)?i.name="string-2":i.name="meta":"$"===a?("<"===e.next()&&(e.eatWhile(/[^\s>]/),e.next()),i.name="string-2"):"|"===a&&n.expectVariable?i.context=new r(f,t):/[\[\]{}()]/.test(a)?(i.name="bracket",i.eos=/[\[{(]/.test(a),"["===a?n.indentation++:"]"===a&&(n.indentation=Math.max(0,n.indentation-1))):s.test(a)?(e.eatWhile(s),i.name="operator",i.eos=";"!==a):/\d/.test(a)?(e.eatWhile(/[\w\d]/),i.name="number"):/[\w_]/.test(a)?(e.eatWhile(/[\w\d_]/),i.name=n.expectVariable?u.test(e.current())?"keyword":"variable":null):i.eos=n.expectVariable,i},c=function(e,t){return e.eatWhile(/[^"]/),new o("comment",e.eat('"')?t.parent:t,!0)},l=function(e,t){return e.eatWhile(/[^']/),new o("string",e.eat("'")?t.parent:t,!1)},d=function(e,t){return e.eatWhile(/[^']/),new o("string-2",e.eat("'")?t.parent:t,!1)},f=function(e,t){var n=new o(null,t,!1);return"|"===e.next()?(n.context=t.parent,n.eos=!0):(e.eatWhile(/[^|]/),n.name="variable"),n};return{startState:function(){return new e},token:function(e,t){if(t.userIndent(e.indentation()),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){e.userIndent(0)},indent:function(e,t){var n=e.context.next===a&&t&&"]"===t.charAt(0)?-1:e.userIndentationDelta;return(e.indentation+n)*i.indentUnit},electricChars:"]"}}),e.defineMIME("text/x-stsrc",{name:"smalltalk"})});