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