Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/soy.tar
Назад
soy.js 0000604 00000053001 15245622072 0005714 0 ustar 00 // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod); else // Plain browser env mod(CodeMirror); })(function(CodeMirror) { "use strict"; var paramData = { noEndTag: true, soyState: "param-def" }; var tags = { "alias": { noEndTag: true }, "delpackage": { noEndTag: true }, "namespace": { noEndTag: true, soyState: "namespace-def" }, "@attribute": paramData, "@attribute?": paramData, "@param": paramData, "@param?": paramData, "@inject": paramData, "@inject?": paramData, "@state": paramData, "template": { soyState: "templ-def", variableScope: true}, "literal": { }, "msg": {}, "fallbackmsg": { noEndTag: true, reduceIndent: true}, "select": {}, "plural": {}, "let": { soyState: "var-def" }, "if": {}, "elseif": { noEndTag: true, reduceIndent: true}, "else": { noEndTag: true, reduceIndent: true}, "switch": {}, "case": { noEndTag: true, reduceIndent: true}, "default": { noEndTag: true, reduceIndent: true}, "foreach": { variableScope: true, soyState: "for-loop" }, "ifempty": { noEndTag: true, reduceIndent: true}, "for": { variableScope: true, soyState: "for-loop" }, "call": { soyState: "templ-ref" }, "param": { soyState: "param-ref"}, "print": { noEndTag: true }, "deltemplate": { soyState: "templ-def", variableScope: true}, "delcall": { soyState: "templ-ref" }, "log": {}, "element": { variableScope: true }, }; var indentingTags = Object.keys(tags).filter(function(tag) { return !tags[tag].noEndTag || tags[tag].reduceIndent; }); CodeMirror.defineMode("soy", function(config) { var textMode = CodeMirror.getMode(config, "text/plain"); var modes = { html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false, allowMissingTagName: true}), attributes: textMode, text: textMode, uri: textMode, trusted_resource_uri: textMode, css: CodeMirror.getMode(config, "text/css"), js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit}) }; function last(array) { return array[array.length - 1]; } function tokenUntil(stream, state, untilRegExp) { if (stream.sol()) { for (var indent = 0; indent < state.indent; indent++) { if (!stream.eat(/\s/)) break; } if (indent) return null; } var oldString = stream.string; var match = untilRegExp.exec(oldString.substr(stream.pos)); if (match) { // We don't use backUp because it backs up just the position, not the state. // This uses an undocumented API. stream.string = oldString.substr(0, stream.pos + match.index); } var result = stream.hideFirstChars(state.indent, function() { var localState = last(state.localStates); return localState.mode.token(stream, localState.state); }); stream.string = oldString; return result; } function contains(list, element) { while (list) { if (list.element === element) return true; list = list.next; } return false; } function prepend(list, element) { return { element: element, next: list }; } function popcontext(state) { if (!state.context) return; if (state.context.scope) { state.variables = state.context.scope; } state.context = state.context.previousContext; } // Reference a variable `name` in `list`. // Let `loose` be truthy to ignore missing identifiers. function ref(list, name, loose) { return contains(list, name) ? "variable-2" : (loose ? "variable" : "variable-2 error"); } // Data for an open soy tag. function Context(previousContext, tag, scope) { this.previousContext = previousContext; this.tag = tag; this.kind = null; this.scope = scope; } function expression(stream, state) { var match; if (stream.match(/[[]/)) { state.soyState.push("list-literal"); state.context = new Context(state.context, "list-literal", state.variables); state.lookupVariables = false; return null; } else if (stream.match(/map\b/)) { state.soyState.push("map-literal"); return "keyword"; } else if (stream.match(/record\b/)) { state.soyState.push("record-literal"); return "keyword"; } else if (stream.match(/([\w]+)(?=\()/)) { return "variable callee"; } else if (match = stream.match(/^["']/)) { state.soyState.push("string"); state.quoteKind = match[0]; return "string"; } else if (stream.match(/^[(]/)) { state.soyState.push("open-parentheses"); return null; } else if (stream.match(/(null|true|false)(?!\w)/) || stream.match(/0x([0-9a-fA-F]{2,})/) || stream.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)) { return "atom"; } else if (stream.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)) { // Tokenize filter, binary, null propagator, and equality operators. return "operator"; } else if (match = stream.match(/^\$([\w]+)/)) { return ref(state.variables, match[1], !state.lookupVariables); } else if (match = stream.match(/^\w+/)) { return /^(?:as|and|or|not|in|if)$/.test(match[0]) ? "keyword" : null; } stream.next(); return null; } return { startState: function() { return { soyState: [], variables: prepend(null, 'ij'), scopes: null, indent: 0, quoteKind: null, context: null, lookupVariables: true, // Is unknown variables considered an error localStates: [{ mode: modes.html, state: CodeMirror.startState(modes.html) }] }; }, copyState: function(state) { return { tag: state.tag, // Last seen Soy tag. soyState: state.soyState.concat([]), variables: state.variables, context: state.context, indent: state.indent, // Indentation of the following line. quoteKind: state.quoteKind, lookupVariables: state.lookupVariables, localStates: state.localStates.map(function(localState) { return { mode: localState.mode, state: CodeMirror.copyState(localState.mode, localState.state) }; }) }; }, token: function(stream, state) { var match; switch (last(state.soyState)) { case "comment": if (stream.match(/^.*?\*\//)) { state.soyState.pop(); } else { stream.skipToEnd(); } if (!state.context || !state.context.scope) { var paramRe = /@param\??\s+(\S+)/g; var current = stream.current(); for (var match; (match = paramRe.exec(current)); ) { state.variables = prepend(state.variables, match[1]); } } return "comment"; case "string": var match = stream.match(/^.*?(["']|\\[\s\S])/); if (!match) { stream.skipToEnd(); } else if (match[1] == state.quoteKind) { state.quoteKind = null; state.soyState.pop(); } return "string"; } if (!state.soyState.length || last(state.soyState) != "literal") { if (stream.match(/^\/\*/)) { state.soyState.push("comment"); return "comment"; } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) { return "comment"; } } switch (last(state.soyState)) { case "templ-def": if (match = stream.match(/^\.?([\w]+(?!\.[\w]+)*)/)) { state.soyState.pop(); return "def"; } stream.next(); return null; case "templ-ref": if (match = stream.match(/(\.?[a-zA-Z_][a-zA-Z_0-9]+)+/)) { state.soyState.pop(); // If the first character is '.', it can only be a local template. if (match[0][0] == '.') { return "variable-2" } // Otherwise return "variable"; } if (match = stream.match(/^\$([\w]+)/)) { state.soyState.pop(); return ref(state.variables, match[1], !state.lookupVariables); } stream.next(); return null; case "namespace-def": if (match = stream.match(/^\.?([\w\.]+)/)) { state.soyState.pop(); return "variable"; } stream.next(); return null; case "param-def": if (match = stream.match(/^\*/)) { state.soyState.pop(); state.soyState.push("param-type"); return "type"; } if (match = stream.match(/^\w+/)) { state.variables = prepend(state.variables, match[0]); state.soyState.pop(); state.soyState.push("param-type"); return "def"; } stream.next(); return null; case "param-ref": if (match = stream.match(/^\w+/)) { state.soyState.pop(); return "property"; } stream.next(); return null; case "open-parentheses": if (stream.match(/[)]/)) { state.soyState.pop(); return null; } return expression(stream, state); case "param-type": var peekChar = stream.peek(); if ("}]=>,".indexOf(peekChar) != -1) { state.soyState.pop(); return null; } else if (peekChar == "[") { state.soyState.push('param-type-record'); return null; } else if (peekChar == "(") { state.soyState.push('param-type-template'); return null; } else if (peekChar == "<") { state.soyState.push('param-type-parameter'); return null; } else if (match = stream.match(/^([\w]+|[?])/)) { return "type"; } stream.next(); return null; case "param-type-record": var peekChar = stream.peek(); if (peekChar == "]") { state.soyState.pop(); return null; } if (stream.match(/^\w+/)) { state.soyState.push('param-type'); return "property"; } stream.next(); return null; case "param-type-parameter": if (stream.match(/^[>]/)) { state.soyState.pop(); return null; } if (stream.match(/^[<,]/)) { state.soyState.push('param-type'); return null; } stream.next(); return null; case "param-type-template": if (stream.match(/[>]/)) { state.soyState.pop(); state.soyState.push('param-type'); return null; } if (stream.match(/^\w+/)) { state.soyState.push('param-type'); return "def"; } stream.next(); return null; case "var-def": if (match = stream.match(/^\$([\w]+)/)) { state.variables = prepend(state.variables, match[1]); state.soyState.pop(); return "def"; } stream.next(); return null; case "for-loop": if (stream.match(/\bin\b/)) { state.soyState.pop(); return "keyword"; } if (stream.peek() == "$") { state.soyState.push('var-def'); return null; } stream.next(); return null; case "record-literal": if (stream.match(/^[)]/)) { state.soyState.pop(); return null; } if (stream.match(/[(,]/)) { state.soyState.push("map-value") state.soyState.push("record-key") return null; } stream.next() return null; case "map-literal": if (stream.match(/^[)]/)) { state.soyState.pop(); return null; } if (stream.match(/[(,]/)) { state.soyState.push("map-value") state.soyState.push("map-value") return null; } stream.next() return null; case "list-literal": if (stream.match(']')) { state.soyState.pop(); state.lookupVariables = true; popcontext(state); return null; } if (stream.match(/\bfor\b/)) { state.lookupVariables = true; state.soyState.push('for-loop'); return "keyword"; } return expression(stream, state); case "record-key": if (stream.match(/[\w]+/)) { return "property"; } if (stream.match(/^[:]/)) { state.soyState.pop(); return null; } stream.next(); return null; case "map-value": if (stream.peek() == ")" || stream.peek() == "," || stream.match(/^[:)]/)) { state.soyState.pop(); return null; } return expression(stream, state); case "import": if (stream.eat(";")) { state.soyState.pop(); state.indent -= 2 * config.indentUnit; return null; } if (stream.match(/\w+(?=\s+as)/)) { return "variable"; } if (match = stream.match(/\w+/)) { return /(from|as)/.test(match[0]) ? "keyword" : "def"; } if (match = stream.match(/^["']/)) { state.soyState.push("string"); state.quoteKind = match[0]; return "string"; } stream.next(); return null; case "tag": var endTag; var tagName; if (state.tag === undefined) { endTag = true; tagName = ''; } else { endTag = state.tag[0] == "/"; tagName = endTag ? state.tag.substring(1) : state.tag; } var tag = tags[tagName]; if (stream.match(/^\/?}/)) { var selfClosed = stream.current() == "/}"; if (selfClosed && !endTag) { popcontext(state); } if (state.tag == "/template" || state.tag == "/deltemplate") { state.variables = prepend(null, 'ij'); state.indent = 0; } else { state.indent -= config.indentUnit * (selfClosed || indentingTags.indexOf(state.tag) == -1 ? 2 : 1); } state.soyState.pop(); return "keyword"; } else if (stream.match(/^([\w?]+)(?==)/)) { if (state.context && state.context.tag == tagName && stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) { var kind = match[1]; state.context.kind = kind; var mode = modes[kind] || modes.html; var localState = last(state.localStates); if (localState.mode.indent) { state.indent += localState.mode.indent(localState.state, "", ""); } state.localStates.push({ mode: mode, state: CodeMirror.startState(mode) }); } return "attribute"; } return expression(stream, state); case "template-call-expression": if (stream.match(/^([\w-?]+)(?==)/)) { return "attribute"; } else if (stream.eat('>')) { state.soyState.pop(); return "keyword"; } else if (stream.eat('/>')) { state.soyState.pop(); return "keyword"; } return expression(stream, state); case "literal": if (stream.match('{/literal}', false)) { state.soyState.pop(); return this.token(stream, state); } return tokenUntil(stream, state, /\{\/literal}/); } if (stream.match('{literal}')) { state.indent += config.indentUnit; state.soyState.push("literal"); state.context = new Context(state.context, "literal", state.variables); return "keyword"; // A tag-keyword must be followed by whitespace, comment or a closing tag. } else if (match = stream.match(/^\{([/@\\]?\w+\??)(?=$|[\s}]|\/[/*])/)) { var prevTag = state.tag; state.tag = match[1]; var endTag = state.tag[0] == "/"; var indentingTag = !!tags[state.tag]; var tagName = endTag ? state.tag.substring(1) : state.tag; var tag = tags[tagName]; if (state.tag != "/switch") state.indent += ((endTag || tag && tag.reduceIndent) && prevTag != "switch" ? 1 : 2) * config.indentUnit; state.soyState.push("tag"); var tagError = false; if (tag) { if (!endTag) { if (tag.soyState) state.soyState.push(tag.soyState); } // If a new tag, open a new context. if (!tag.noEndTag && (indentingTag || !endTag)) { state.context = new Context(state.context, state.tag, tag.variableScope ? state.variables : null); // Otherwise close the current context. } else if (endTag) { if (!state.context || state.context.tag != tagName) { tagError = true; } else if (state.context) { if (state.context.kind) { state.localStates.pop(); var localState = last(state.localStates); if (localState.mode.indent) { state.indent -= localState.mode.indent(localState.state, "", ""); } } popcontext(state); } } } else if (endTag) { // Assume all tags with a closing tag are defined in the config. tagError = true; } return (tagError ? "error " : "") + "keyword"; // Not a tag-keyword; it's an implicit print tag. } else if (stream.eat('{')) { state.tag = "print"; state.indent += 2 * config.indentUnit; state.soyState.push("tag"); return "keyword"; } else if (!state.context && stream.match(/\bimport\b/)) { state.soyState.push("import"); state.indent += 2 * config.indentUnit; return "keyword"; } else if (match = stream.match('<{')) { state.soyState.push("template-call-expression"); state.indent += 2 * config.indentUnit; state.soyState.push("tag"); return "keyword"; } else if (match = stream.match('</>')) { state.indent -= 1 * config.indentUnit; return "keyword"; } return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/); }, indent: function(state, textAfter, line) { var indent = state.indent, top = last(state.soyState); if (top == "comment") return CodeMirror.Pass; if (top == "literal") { if (/^\{\/literal}/.test(textAfter)) indent -= config.indentUnit; } else { if (/^\s*\{\/(template|deltemplate)\b/.test(textAfter)) return 0; if (/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(textAfter)) indent -= config.indentUnit; if (state.tag != "switch" && /^\{(case|default)\b/.test(textAfter)) indent -= config.indentUnit; if (/^\{\/switch\b/.test(textAfter)) indent -= config.indentUnit; } var localState = last(state.localStates); if (indent && localState.mode.indent) { indent += localState.mode.indent(localState.state, textAfter, line); } return indent; }, innerMode: function(state) { if (state.soyState.length && last(state.soyState) != "literal") return null; else return last(state.localStates); }, electricInput: /^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/, lineComment: "//", blockCommentStart: "/*", blockCommentEnd: "*/", blockCommentContinue: " * ", useInnerComments: false, fold: "indent" }; }, "htmlmixed"); CodeMirror.registerHelper("wordChars", "soy", /[\w$]/); CodeMirror.registerHelper("hintWords", "soy", Object.keys(tags).concat( ["css", "debugger"])); CodeMirror.defineMIME("text/x-soy", "soy"); }); soy.min.js 0000604 00000023361 15245622072 0006504 0 ustar 00 !(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],a):a(CodeMirror)})((function(a){"use strict";var b={noEndTag:!0,soyState:"param-def"},c={alias:{noEndTag:!0},delpackage:{noEndTag:!0},namespace:{noEndTag:!0,soyState:"namespace-def"},"@attribute":b,"@attribute?":b,"@param":b,"@param?":b,"@inject":b,"@inject?":b,"@state":b,template:{soyState:"templ-def",variableScope:!0},literal:{},msg:{},fallbackmsg:{noEndTag:!0,reduceIndent:!0},select:{},plural:{},let:{soyState:"var-def"},if:{},elseif:{noEndTag:!0,reduceIndent:!0},else:{noEndTag:!0,reduceIndent:!0},switch:{},case:{noEndTag:!0,reduceIndent:!0},default:{noEndTag:!0,reduceIndent:!0},foreach:{variableScope:!0,soyState:"for-loop"},ifempty:{noEndTag:!0,reduceIndent:!0},for:{variableScope:!0,soyState:"for-loop"},call:{soyState:"templ-ref"},param:{soyState:"param-ref"},print:{noEndTag:!0},deltemplate:{soyState:"templ-def",variableScope:!0},delcall:{soyState:"templ-ref"},log:{},element:{variableScope:!0}},d=Object.keys(c).filter((function(a){return!c[a].noEndTag||c[a].reduceIndent}));a.defineMode("soy",(function(b){function e(a){return a[a.length-1]}function f(a,b,c){if(a.sol()){for(var d=0;d<b.indent&&a.eat(/\s/);d++);if(d)return null}var f=a.string,g=c.exec(f.substr(a.pos));g&&(a.string=f.substr(0,a.pos+g.index));var h=a.hideFirstChars(b.indent,(function(){var c=e(b.localStates);return c.mode.token(a,c.state)}));return a.string=f,h}function g(a,b){for(;a;){if(a.element===b)return!0;a=a.next}return!1}function h(a,b){return{element:b,next:a}}function i(a){a.context&&(a.context.scope&&(a.variables=a.context.scope),a.context=a.context.previousContext)}function j(a,b,c){return g(a,b)?"variable-2":c?"variable":"variable-2 error"}function k(a,b,c){this.previousContext=a,this.tag=b,this.kind=null,this.scope=c}function l(a,b){var c;return a.match(/[[]/)?(b.soyState.push("list-literal"),b.context=new k(b.context,"list-literal",b.variables),b.lookupVariables=!1,null):a.match(/map\b/)?(b.soyState.push("map-literal"),"keyword"):a.match(/record\b/)?(b.soyState.push("record-literal"),"keyword"):a.match(/([\w]+)(?=\()/)?"variable callee":(c=a.match(/^["']/))?(b.soyState.push("string"),b.quoteKind=c[0],"string"):a.match(/^[(]/)?(b.soyState.push("open-parentheses"),null):a.match(/(null|true|false)(?!\w)/)||a.match(/0x([0-9a-fA-F]{2,})/)||a.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)?"atom":a.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)?"operator":(c=a.match(/^\$([\w]+)/))?j(b.variables,c[1],!b.lookupVariables):(c=a.match(/^\w+/))?/^(?:as|and|or|not|in|if)$/.test(c[0])?"keyword":null:(a.next(),null)}var m=a.getMode(b,"text/plain"),n={html:a.getMode(b,{name:"text/html",multilineTagIndentFactor:2,multilineTagIndentPastTag:!1,allowMissingTagName:!0}),attributes:m,text:m,uri:m,trusted_resource_uri:m,css:a.getMode(b,"text/css"),js:a.getMode(b,{name:"text/javascript",statementIndent:2*b.indentUnit})};return{startState:function(){return{soyState:[],variables:h(null,"ij"),scopes:null,indent:0,quoteKind:null,context:null,lookupVariables:!0,localStates:[{mode:n.html,state:a.startState(n.html)}]}},copyState:function(b){return{tag:b.tag,soyState:b.soyState.concat([]),variables:b.variables,context:b.context,indent:b.indent,quoteKind:b.quoteKind,lookupVariables:b.lookupVariables,localStates:b.localStates.map((function(b){return{mode:b.mode,state:a.copyState(b.mode,b.state)}}))}},token:function(g,m){var o;switch(e(m.soyState)){case"comment":if(g.match(/^.*?\*\//)?m.soyState.pop():g.skipToEnd(),!m.context||!m.context.scope)for(var o,p=/@param\??\s+(\S+)/g,q=g.current();o=p.exec(q);)m.variables=h(m.variables,o[1]);return"comment";case"string":var o=g.match(/^.*?(["']|\\[\s\S])/);return o?o[1]==m.quoteKind&&(m.quoteKind=null,m.soyState.pop()):g.skipToEnd(),"string"}if(!m.soyState.length||"literal"!=e(m.soyState)){if(g.match(/^\/\*/))return m.soyState.push("comment"),"comment";if(g.match(g.sol()?/^\s*\/\/.*/:/^\s+\/\/.*/))return"comment"}switch(e(m.soyState)){case"templ-def":return(o=g.match(/^\.?([\w]+(?!\.[\w]+)*)/))?(m.soyState.pop(),"def"):(g.next(),null);case"templ-ref":return(o=g.match(/(\.?[a-zA-Z_][a-zA-Z_0-9]+)+/))?(m.soyState.pop(),"."==o[0][0]?"variable-2":"variable"):(o=g.match(/^\$([\w]+)/))?(m.soyState.pop(),j(m.variables,o[1],!m.lookupVariables)):(g.next(),null);case"namespace-def":return(o=g.match(/^\.?([\w\.]+)/))?(m.soyState.pop(),"variable"):(g.next(),null);case"param-def":return(o=g.match(/^\*/))?(m.soyState.pop(),m.soyState.push("param-type"),"type"):(o=g.match(/^\w+/))?(m.variables=h(m.variables,o[0]),m.soyState.pop(),m.soyState.push("param-type"),"def"):(g.next(),null);case"param-ref":return(o=g.match(/^\w+/))?(m.soyState.pop(),"property"):(g.next(),null);case"open-parentheses":return g.match(/[)]/)?(m.soyState.pop(),null):l(g,m);case"param-type":var r=g.peek();return-1!="}]=>,".indexOf(r)?(m.soyState.pop(),null):"["==r?(m.soyState.push("param-type-record"),null):"("==r?(m.soyState.push("param-type-template"),null):"<"==r?(m.soyState.push("param-type-parameter"),null):(o=g.match(/^([\w]+|[?])/))?"type":(g.next(),null);case"param-type-record":var r=g.peek();return"]"==r?(m.soyState.pop(),null):g.match(/^\w+/)?(m.soyState.push("param-type"),"property"):(g.next(),null);case"param-type-parameter":return g.match(/^[>]/)?(m.soyState.pop(),null):g.match(/^[<,]/)?(m.soyState.push("param-type"),null):(g.next(),null);case"param-type-template":return g.match(/[>]/)?(m.soyState.pop(),m.soyState.push("param-type"),null):g.match(/^\w+/)?(m.soyState.push("param-type"),"def"):(g.next(),null);case"var-def":return(o=g.match(/^\$([\w]+)/))?(m.variables=h(m.variables,o[1]),m.soyState.pop(),"def"):(g.next(),null);case"for-loop":return g.match(/\bin\b/)?(m.soyState.pop(),"keyword"):"$"==g.peek()?(m.soyState.push("var-def"),null):(g.next(),null);case"record-literal":return g.match(/^[)]/)?(m.soyState.pop(),null):g.match(/[(,]/)?(m.soyState.push("map-value"),m.soyState.push("record-key"),null):(g.next(),null);case"map-literal":return g.match(/^[)]/)?(m.soyState.pop(),null):g.match(/[(,]/)?(m.soyState.push("map-value"),m.soyState.push("map-value"),null):(g.next(),null);case"list-literal":return g.match("]")?(m.soyState.pop(),m.lookupVariables=!0,i(m),null):g.match(/\bfor\b/)?(m.lookupVariables=!0,m.soyState.push("for-loop"),"keyword"):l(g,m);case"record-key":return g.match(/[\w]+/)?"property":g.match(/^[:]/)?(m.soyState.pop(),null):(g.next(),null);case"map-value":return")"==g.peek()||","==g.peek()||g.match(/^[:)]/)?(m.soyState.pop(),null):l(g,m);case"import":return g.eat(";")?(m.soyState.pop(),m.indent-=2*b.indentUnit,null):g.match(/\w+(?=\s+as)/)?"variable":(o=g.match(/\w+/))?/(from|as)/.test(o[0])?"keyword":"def":(o=g.match(/^["']/))?(m.soyState.push("string"),m.quoteKind=o[0],"string"):(g.next(),null);case"tag":var s,t;void 0===m.tag?(s=!0,t=""):(s="/"==m.tag[0],t=s?m.tag.substring(1):m.tag);var u=c[t];if(g.match(/^\/?}/)){var v="/}"==g.current();return v&&!s&&i(m),"/template"==m.tag||"/deltemplate"==m.tag?(m.variables=h(null,"ij"),m.indent=0):m.indent-=b.indentUnit*(v||-1==d.indexOf(m.tag)?2:1),m.soyState.pop(),"keyword"}if(g.match(/^([\w?]+)(?==)/)){if(m.context&&m.context.tag==t&&"kind"==g.current()&&(o=g.match(/^="([^"]+)/,!1))){var w=o[1];m.context.kind=w;var x=n[w]||n.html,y=e(m.localStates);y.mode.indent&&(m.indent+=y.mode.indent(y.state,"","")),m.localStates.push({mode:x,state:a.startState(x)})}return"attribute"}return l(g,m);case"template-call-expression":return g.match(/^([\w-?]+)(?==)/)?"attribute":g.eat(">")?(m.soyState.pop(),"keyword"):g.eat("/>")?(m.soyState.pop(),"keyword"):l(g,m);case"literal":return g.match("{/literal}",!1)?(m.soyState.pop(),this.token(g,m)):f(g,m,/\{\/literal}/)}if(g.match("{literal}"))return m.indent+=b.indentUnit,m.soyState.push("literal"),m.context=new k(m.context,"literal",m.variables),"keyword";if(o=g.match(/^\{([\/@\\]?\w+\??)(?=$|[\s}]|\/[\/*])/)){var z=m.tag;m.tag=o[1];var s="/"==m.tag[0],A=!!c[m.tag],t=s?m.tag.substring(1):m.tag,u=c[t];"/switch"!=m.tag&&(m.indent+=((s||u&&u.reduceIndent)&&"switch"!=z?1:2)*b.indentUnit),m.soyState.push("tag");var B=!1;if(u)if(s||u.soyState&&m.soyState.push(u.soyState),u.noEndTag||!A&&s){if(s)if(m.context&&m.context.tag==t){if(m.context){if(m.context.kind){m.localStates.pop();var y=e(m.localStates);y.mode.indent&&(m.indent-=y.mode.indent(y.state,"",""))}i(m)}}else B=!0}else m.context=new k(m.context,m.tag,u.variableScope?m.variables:null);else s&&(B=!0);return(B?"error ":"")+"keyword"}return g.eat("{")?(m.tag="print",m.indent+=2*b.indentUnit,m.soyState.push("tag"),"keyword"):!m.context&&g.match(/\bimport\b/)?(m.soyState.push("import"),m.indent+=2*b.indentUnit,"keyword"):(o=g.match("<{"))?(m.soyState.push("template-call-expression"),m.indent+=2*b.indentUnit,m.soyState.push("tag"),"keyword"):(o=g.match("</>"))?(m.indent-=1*b.indentUnit,"keyword"):f(g,m,/\{|\s+\/\/|\/\*/)},indent:function(c,d,f){var g=c.indent,h=e(c.soyState);if("comment"==h)return a.Pass;if("literal"==h)/^\{\/literal}/.test(d)&&(g-=b.indentUnit);else{if(/^\s*\{\/(template|deltemplate)\b/.test(d))return 0;/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(d)&&(g-=b.indentUnit),"switch"!=c.tag&&/^\{(case|default)\b/.test(d)&&(g-=b.indentUnit),/^\{\/switch\b/.test(d)&&(g-=b.indentUnit)}var i=e(c.localStates);return g&&i.mode.indent&&(g+=i.mode.indent(i.state,d,f)),g},innerMode:function(a){return a.soyState.length&&"literal"!=e(a.soyState)?null:e(a.localStates)},electricInput:/^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",useInnerComments:!1,fold:"indent"}}),"htmlmixed"),a.registerHelper("wordChars","soy",/[\w$]/),a.registerHelper("hintWords","soy",Object.keys(c).concat(["css","debugger"])),a.defineMIME("text/x-soy","soy")}));
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка