%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/webmin/authentic-theme/unauthenticated/js/codemirror/mode/soy/
Upload File :
Create Path :
Current File : //usr/share/webmin/authentic-theme/unauthenticated/js/codemirror/mode/soy/soy.js

!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],t):t(CodeMirror)}(function(t){"use strict";var e=["template","literal","msg","fallbackmsg","let","if","elseif","else","switch","case","default","foreach","ifempty","for","call","param","deltemplate","delcall","log"];t.defineMode("soy",function(a){function n(t){return t[t.length-1]}function s(t,e,a){if(t.sol()){for(var s=0;s<e.indent&&t.eat(/\s/);s++);if(s)return null}var r=t.string,i=a.exec(r.substr(t.pos));i&&(t.string=r.substr(0,t.pos+i.index));var l=t.hideFirstChars(e.indent,function(){var a=n(e.localStates);return a.mode.token(t,a.state)});return t.string=r,l}function r(t,e){for(;t;){if(t.element===e)return!0;t=t.next}return!1}function i(t,e){return{element:e,next:t}}function l(t,e,a){return r(t,e)?"variable-2":a?"variable":"variable-2 error"}function o(t){t.scopes&&(t.variables=t.scopes.element,t.scopes=t.scopes.next)}var c=t.getMode(a,"text/plain"),d={html:t.getMode(a,{name:"text/html",multilineTagIndentFactor:2,multilineTagIndentPastTag:!1}),attributes:c,text:c,uri:c,trusted_resource_uri:c,css:t.getMode(a,"text/css"),js:t.getMode(a,{name:"text/javascript",statementIndent:2*a.indentUnit})};return{startState:function(){return{kind:[],kindTag:[],soyState:[],templates:null,variables:i(null,"ij"),scopes:null,indent:0,quoteKind:null,localStates:[{mode:d.html,state:t.startState(d.html)}]}},copyState:function(e){return{tag:e.tag,kind:e.kind.concat([]),kindTag:e.kindTag.concat([]),soyState:e.soyState.concat([]),templates:e.templates,variables:e.variables,scopes:e.scopes,indent:e.indent,quoteKind:e.quoteKind,localStates:e.localStates.map(function(e){return{mode:e.mode,state:t.copyState(e.mode,e.state)}})}},token:function(r,c){var m;switch(n(c.soyState)){case"comment":if(r.match(/^.*?\*\//)?c.soyState.pop():r.skipToEnd(),!c.scopes)for(var m,u=/@param\??\s+(\S+)/g,p=r.current();m=u.exec(p);)c.variables=i(c.variables,m[1]);return"comment";case"string":var m=r.match(/^.*?(["']|\\[\s\S])/);return m?m[1]==c.quoteKind&&(c.quoteKind=null,c.soyState.pop()):r.skipToEnd(),"string"}if(!c.soyState.length||"literal"!=n(c.soyState)){if(r.match(/^\/\*/))return c.soyState.push("comment"),"comment";if(r.match(r.sol()?/^\s*\/\/.*/:/^\s+\/\/.*/))return"comment"}switch(n(c.soyState)){case"templ-def":return(m=r.match(/^\.?([\w]+(?!\.[\w]+)*)/))?(c.templates=i(c.templates,m[1]),c.scopes=i(c.scopes,c.variables),c.soyState.pop(),"def"):(r.next(),null);case"templ-ref":return(m=r.match(/^\.?([\w]+)/))?(c.soyState.pop(),"."==m[0][0]?l(c.templates,m[1],!0):"variable"):(r.next(),null);case"param-def":return(m=r.match(/^\w+/))?(c.variables=i(c.variables,m[0]),c.soyState.pop(),c.soyState.push("param-type"),"def"):(r.next(),null);case"param-type":return"}"==r.peek()?(c.soyState.pop(),null):r.eatWhile(/^[\w]+/)?"variable-3":(r.next(),null);case"var-def":return(m=r.match(/^\$([\w]+)/))?(c.variables=i(c.variables,m[1]),c.soyState.pop(),"def"):(r.next(),null);case"tag":if(r.match(/^\/?}/))return"/template"==c.tag||"/deltemplate"==c.tag?(o(c),c.variables=i(null,"ij"),c.indent=0):("/for"!=c.tag&&"/foreach"!=c.tag||o(c),c.indent-=a.indentUnit*("/}"==r.current()||e.indexOf(c.tag)==-1?2:1)),c.soyState.pop(),"keyword";if(r.match(/^([\w?]+)(?==)/)){if("kind"==r.current()&&(m=r.match(/^="([^"]+)/,!1))){var f=m[1];c.kind.push(f),c.kindTag.push(c.tag);var h=d[f]||d.html,g=n(c.localStates);g.mode.indent&&(c.indent+=g.mode.indent(g.state,"")),c.localStates.push({mode:h,state:t.startState(h)})}return"attribute"}return(m=r.match(/^["']/))?(c.soyState.push("string"),c.quoteKind=m,"string"):(m=r.match(/^\$([\w]+)/))?l(c.variables,m[1]):(m=r.match(/^\w+/))?/^(?:as|and|or|not|in)$/.test(m[0])?"keyword":null:(r.next(),null);case"literal":return r.match(/^(?=\{\/literal})/)?(c.indent-=a.indentUnit,c.soyState.pop(),this.token(r,c)):s(r,c,/\{\/literal}/)}if(r.match(/^\{literal}/))return c.indent+=a.indentUnit,c.soyState.push("literal"),"keyword";if(m=r.match(/^\{([\/@\\]?\w+\??)(?=$|[\s}]|\/[\/*])/)){if("/switch"!=m[1]&&(c.indent+=(/^(\/|(else|elseif|ifempty|case|fallbackmsg|default)$)/.test(m[1])&&"switch"!=c.tag?1:2)*a.indentUnit),c.tag=m[1],c.tag=="/"+n(c.kindTag)){c.kind.pop(),c.kindTag.pop(),c.localStates.pop();var g=n(c.localStates);g.mode.indent&&(c.indent-=g.mode.indent(g.state,""))}return c.soyState.push("tag"),"template"==c.tag||"deltemplate"==c.tag?c.soyState.push("templ-def"):"call"==c.tag||"delcall"==c.tag?c.soyState.push("templ-ref"):"let"==c.tag?c.soyState.push("var-def"):"for"==c.tag||"foreach"==c.tag?(c.scopes=i(c.scopes,c.variables),c.soyState.push("var-def")):"namespace"==c.tag?c.scopes||(c.variables=i(null,"ij")):c.tag.match(/^@(?:param\??|inject|prop)/)&&c.soyState.push("param-def"),"keyword"}return r.eat("{")?(c.tag="print",c.indent+=2*a.indentUnit,c.soyState.push("tag"),"keyword"):s(r,c,/\{|\s+\/\/|\/\*/)},indent:function(e,s){var r=e.indent,i=n(e.soyState);if("comment"==i)return t.Pass;if("literal"==i)/^\{\/literal}/.test(s)&&(r-=a.indentUnit);else{if(/^\s*\{\/(template|deltemplate)\b/.test(s))return 0;/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(s)&&(r-=a.indentUnit),"switch"!=e.tag&&/^\{(case|default)\b/.test(s)&&(r-=a.indentUnit),/^\{\/switch\b/.test(s)&&(r-=a.indentUnit)}var l=n(e.localStates);return r&&l.mode.indent&&(r+=l.mode.indent(l.state,s)),r},innerMode:function(t){return t.soyState.length&&"literal"!=n(t.soyState)?null:n(t.localStates)},electricInput:/^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",useInnerComments:!1,fold:"indent"}},"htmlmixed"),t.registerHelper("wordChars","soy",/[\w$]/),t.registerHelper("hintWords","soy",e.concat(["delpackage","namespace","alias","print","css","debugger"])),t.defineMIME("text/x-soy","soy")});

Zerion Mini Shell 1.0