Current File : /home/pacjaorg/public_html/kmm/media/vendor/codemirror/mode/smarty/smarty.min.js |
(function(o){typeof exports=="object"&&typeof module=="object"?o(require("../../lib/codemirror")):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("smarty",function(s,p){var k=p.rightDelimiter||"}",f=p.leftDelimiter||"{",v=p.version||2,a=o.getMode(s,p.baseMode||"null"),b=["debug","extends","function","include","literal"],u={operatorChars:/[+\-*&%=<>!?]/,validIdentifier:/[a-zA-Z0-9_]/,stringChar:/['"]/},h;function t(e,i){return h=i,e}function y(e,i,r){return i.tokenize=r,r(e,i)}function z(e,i){return i==null&&(i=e.pos),v===3&&f=="{"&&(i==e.string.length||/\s/.test(e.string.charAt(i)))}function d(e,i){for(var r=e.string,l=e.pos;;){var n=r.indexOf(f,l);if(l=n+f.length,n==-1||!z(e,n+f.length))break}if(n==e.pos)return e.match(f),e.eat("*")?y(e,i,W("comment","*"+k)):(i.depth++,i.tokenize=g,h="startTag","tag");n>-1&&(e.string=r.slice(0,n));var c=a.token(e,i.base);return n>-1&&(e.string=r),c}function g(e,i){if(e.match(k,!0))return v===3?(i.depth--,i.depth<=0&&(i.tokenize=d)):i.tokenize=d,t("tag",null);if(e.match(f,!0))return i.depth++,t("tag","startTag");var r=e.next();if(r=="$")return e.eatWhile(u.validIdentifier),t("variable-2","variable");if(r=="|")return t("operator","pipe");if(r==".")return t("operator","property");if(u.stringChar.test(r))return i.tokenize=I(r),t("string","string");if(u.operatorChars.test(r))return e.eatWhile(u.operatorChars),t("operator","operator");if(r=="["||r=="]")return t("bracket","bracket");if(r=="("||r==")")return t("bracket","operator");if(/\d/.test(r))return e.eatWhile(/\d/),t("number","number");if(i.last=="variable"){if(r=="@")return e.eatWhile(u.validIdentifier),t("property","property");if(r=="|")return e.eatWhile(u.validIdentifier),t("qualifier","modifier")}else{if(i.last=="pipe")return e.eatWhile(u.validIdentifier),t("qualifier","modifier");if(i.last=="whitespace")return e.eatWhile(u.validIdentifier),t("attribute","modifier")}if(i.last=="property")return e.eatWhile(u.validIdentifier),t("property",null);if(/\s/.test(r))return h="whitespace",null;var l="";r!="/"&&(l+=r);for(var n=null;n=e.eat(u.validIdentifier);)l+=n;for(var c=0,w=b.length;c<w;c++)if(b[c]==l)return t("keyword","keyword");return/\s/.test(r)?null:t("tag","tag")}function I(e){return function(i,r){for(var l=null,n=null;!i.eol();){if(n=i.peek(),i.next()==e&&l!=="\\"){r.tokenize=g;break}l=n}return"string"}}function W(e,i){return function(r,l){for(;!r.eol();){if(r.match(i)){l.tokenize=d;break}r.next()}return e}}return{startState:function(){return{base:o.startState(a),tokenize:d,last:null,depth:0}},copyState:function(e){return{base:o.copyState(a,e.base),tokenize:e.tokenize,last:e.last,depth:e.depth}},innerMode:function(e){if(e.tokenize==d)return{mode:a,state:e.base}},token:function(e,i){var r=i.tokenize(e,i);return i.last=h,r},indent:function(e,i,r){return e.tokenize==d&&a.indent?a.indent(e.base,i,r):o.Pass},blockCommentStart:f+"*",blockCommentEnd:"*"+k}}),o.defineMIME("text/x-smarty","smarty")});