?
Path : /home/admin/public_html/old/media/editors/codemirror/mode/stex/ |
Current File : /home/admin/public_html/old/media/editors/codemirror/mode/stex/stex.min.js |
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("stex",function(){function a(a,b){a.cmdState.push(b)}function b(a){return a.cmdState.length>0?a.cmdState[a.cmdState.length-1]:null}function c(a){var b=a.cmdState.pop();b&&b.closeBracket()}function d(a){for(var b=a.cmdState,c=b.length-1;c>=0;c--){var d=b[c];if("DEFAULT"!=d.name)return d}return{styleIdentifier:function(){return null}}}function e(a,b,c){return function(){this.name=a,this.bracketNo=0,this.style=b,this.styles=c,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}function f(a,b){a.f=b}function g(c,e){var g;if(c.match(/^\\[a-zA-Z@]+/)){var k=c.current().slice(1);return g=j[k]||j.DEFAULT,g=new g,a(e,g),f(e,i),g.style}if(c.match(/^\\[$&%#{}_]/))return"tag";if(c.match(/^\\[,;!\/\\]/))return"tag";if(c.match("\\["))return f(e,function(a,b){return h(a,b,"\\]")}),"keyword";if(c.match("$$"))return f(e,function(a,b){return h(a,b,"$$")}),"keyword";if(c.match("$"))return f(e,function(a,b){return h(a,b,"$")}),"keyword";var l=c.next();return"%"==l?(c.skipToEnd(),"comment"):"}"==l||"]"==l?(g=b(e))?(g.closeBracket(l),f(e,i),"bracket"):"error":"{"==l||"["==l?(g=j.DEFAULT,g=new g,a(e,g),"bracket"):/\d/.test(l)?(c.eatWhile(/[\w.%]/),"atom"):(c.eatWhile(/[\w\-_]/),g=d(e),"begin"==g.name&&(g.argument=c.current()),g.styleIdentifier())}function h(a,b,c){if(a.eatSpace())return null;if(a.match(c))return f(b,g),"keyword";if(a.match(/^\\[a-zA-Z@]+/))return"tag";if(a.match(/^[a-zA-Z]+/))return"variable-2";if(a.match(/^\\[$&%#{}_]/))return"tag";if(a.match(/^\\[,;!\/]/))return"tag";if(a.match(/^[\^_&]/))return"tag";if(a.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(a.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=a.next();return"{"==d||"}"==d||"["==d||"]"==d||"("==d||")"==d?"bracket":"%"==d?(a.skipToEnd(),"comment"):"error"}function i(a,d){var e,h=a.peek();return"{"==h||"["==h?(e=b(d),e.openBracket(h),a.eat(h),f(d,g),"bracket"):/[ \t\r]/.test(h)?(a.eat(h),null):(f(d,g),c(d),g(a,d))}var j={};return j.importmodule=e("importmodule","tag",["string","builtin"]),j.documentclass=e("documentclass","tag",["","atom"]),j.usepackage=e("usepackage","tag",["atom"]),j.begin=e("begin","tag",["atom"]),j.end=e("end","tag",["atom"]),j.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:g}},copyState:function(a){return{cmdState:a.cmdState.slice(),f:a.f}},token:function(a,b){return b.f(a,b)},blankLine:function(a){a.f=g,a.cmdState.length=0},lineComment:"%"}}),a.defineMIME("text/x-stex","stex"),a.defineMIME("text/x-latex","stex")});