File manager - Edit - /home/opticamezl/www/newok/soy.tar
Back
soy.min.js 0000644 00000024324 15174674672 0006526 0 ustar 00 (function(l){typeof exports=="object"&&typeof module=="object"?l(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed")):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed"],l):l(CodeMirror)})(function(l){"use strict";var d={noEndTag:!0,soyState:"param-def"},y={alias:{noEndTag:!0},delpackage:{noEndTag:!0},namespace:{noEndTag:!0,soyState:"namespace-def"},"@attribute":d,"@attribute?":d,"@param":d,"@param?":d,"@inject":d,"@inject?":d,"@state":d,template:{soyState:"templ-def",variableScope:!0},extern:{soyState:"param-def"},export:{soyState:"export"},literal:{},msg:{},fallbackmsg:{noEndTag:!0,reduceIndent:!0},select:{},plural:{},let:{soyState:"var-def"},if:{},javaimpl:{},jsimpl:{},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},velog:{},const:{soyState:"const-def"}},U=Object.keys(y).filter(function(r){return!y[r].noEndTag||y[r].reduceIndent});l.defineMode("soy",function(r){var m=l.getMode(r,"text/plain"),v={html:l.getMode(r,{name:"text/html",multilineTagIndentFactor:2,multilineTagIndentPastTag:!1,allowMissingTagName:!0}),attributes:m,text:m,uri:m,trusted_resource_uri:m,css:l.getMode(r,"text/css"),js:l.getMode(r,{name:"text/javascript",statementIndent:2*r.indentUnit})};function p(n){return n[n.length-1]}function w(n,e,t){if(n.sol()){for(var o=0;o<e.indent&&n.eat(/\s/);o++);if(o)return null}var c=n.string,i=t.exec(c.substr(n.pos));i&&(n.string=c.substr(0,n.pos+i.index));var u=n.hideFirstChars(e.indent,function(){var a=p(e.localStates);return a.mode.token(n,a.state)});return n.string=c,u}function j(n,e){for(;n;){if(n.element===e)return!0;n=n.next}return!1}function S(n,e){return{element:e,next:n}}function b(n){n.context&&(n.context.scope&&(n.variables=n.context.scope),n.context=n.context.previousContext)}function k(n,e,t){return j(n,e)?"variable-2":t?"variable":"variable-2 error"}function x(n,e,t){this.previousContext=n,this.tag=e,this.kind=null,this.scope=t}function s(n,e){var t;return n.match(/[[]/)?(e.soyState.push("list-literal"),e.context=new x(e.context,"list-literal",e.variables),e.lookupVariables=!1,null):n.match(/\bmap(?=\()/)?(e.soyState.push("map-literal"),"keyword"):n.match(/\brecord(?=\()/)?(e.soyState.push("record-literal"),"keyword"):n.match(/([\w]+)(?=\()/)?"variable callee":(t=n.match(/^["']/))?(e.soyState.push("string"),e.quoteKind=t[0],"string"):n.match(/^[(]/)?(e.soyState.push("open-parentheses"),null):n.match(/(null|true|false)(?!\w)/)||n.match(/0x([0-9a-fA-F]{2,})/)||n.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)?"atom":n.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)?"operator":(t=n.match(/^\$([\w]+)/))?k(e.variables,t[1],!e.lookupVariables):(t=n.match(/^\w+/))?/^(?:as|and|or|not|in|if)$/.test(t[0])?"keyword":null:(n.next(),null)}return{startState:function(){return{soyState:[],variables:S(null,"ij"),scopes:null,indent:0,quoteKind:null,context:null,lookupVariables:!0,localStates:[{mode:v.html,state:l.startState(v.html)}]}},copyState:function(n){return{tag:n.tag,soyState:n.soyState.concat([]),variables:n.variables,context:n.context,indent:n.indent,quoteKind:n.quoteKind,lookupVariables:n.lookupVariables,localStates:n.localStates.map(function(e){return{mode:e.mode,state:l.copyState(e.mode,e.state)}})}},token:function(n,e){var t;switch(p(e.soyState)){case"comment":if(n.match(/^.*?\*\//)?e.soyState.pop():n.skipToEnd(),!e.context||!e.context.scope)for(var o=/@param\??\s+(\S+)/g,c=n.current(),t;t=o.exec(c);)e.variables=S(e.variables,t[1]);return"comment";case"string":var t=n.match(/^.*?(["']|\\[\s\S])/);return t?t[1]==e.quoteKind&&(e.quoteKind=null,e.soyState.pop()):n.skipToEnd(),"string"}if(!e.soyState.length||p(e.soyState)!="literal"){if(n.match(/^\/\*/))return e.soyState.push("comment"),"comment";if(n.match(n.sol()?/^\s*\/\/.*/:/^\s+\/\/.*/))return"comment"}switch(p(e.soyState)){case"templ-def":return(t=n.match(/^\.?([\w]+(?!\.[\w]+)*)/))?(e.soyState.pop(),"def"):(n.next(),null);case"templ-ref":return(t=n.match(/(\.?[a-zA-Z_][a-zA-Z_0-9]+)+/))?(e.soyState.pop(),t[0][0]=="."?"variable-2":"variable"):(t=n.match(/^\$([\w]+)/))?(e.soyState.pop(),k(e.variables,t[1],!e.lookupVariables)):(n.next(),null);case"namespace-def":return(t=n.match(/^\.?([\w\.]+)/))?(e.soyState.pop(),"variable"):(n.next(),null);case"param-def":return(t=n.match(/^\*/))?(e.soyState.pop(),e.soyState.push("param-type"),"type"):(t=n.match(/^\w+/))?(e.variables=S(e.variables,t[0]),e.soyState.pop(),e.soyState.push("param-type"),"def"):(n.next(),null);case"param-ref":return(t=n.match(/^\w+/))?(e.soyState.pop(),"property"):(n.next(),null);case"open-parentheses":return n.match(/[)]/)?(e.soyState.pop(),null):s(n,e);case"param-type":var i=n.peek();return"}]=>,".indexOf(i)!=-1?(e.soyState.pop(),null):i=="["?(e.soyState.push("param-type-record"),null):i=="("?(e.soyState.push("param-type-template"),null):i=="<"?(e.soyState.push("param-type-parameter"),null):(t=n.match(/^([\w]+|[?])/))?"type":(n.next(),null);case"param-type-record":var i=n.peek();return i=="]"?(e.soyState.pop(),null):n.match(/^\w+/)?(e.soyState.push("param-type"),"property"):(n.next(),null);case"param-type-parameter":return n.match(/^[>]/)?(e.soyState.pop(),null):n.match(/^[<,]/)?(e.soyState.push("param-type"),null):(n.next(),null);case"param-type-template":return n.match(/[>]/)?(e.soyState.pop(),e.soyState.push("param-type"),null):n.match(/^\w+/)?(e.soyState.push("param-type"),"def"):(n.next(),null);case"var-def":return(t=n.match(/^\$([\w]+)/))?(e.variables=S(e.variables,t[1]),e.soyState.pop(),"def"):(n.next(),null);case"for-loop":return n.match(/\bin\b/)?(e.soyState.pop(),"keyword"):n.peek()=="$"?(e.soyState.push("var-def"),null):(n.next(),null);case"record-literal":return n.match(/^[)]/)?(e.soyState.pop(),null):n.match(/[(,]/)?(e.soyState.push("map-value"),e.soyState.push("record-key"),null):(n.next(),null);case"map-literal":return n.match(/^[)]/)?(e.soyState.pop(),null):n.match(/[(,]/)?(e.soyState.push("map-value"),e.soyState.push("map-value"),null):(n.next(),null);case"list-literal":return n.match("]")?(e.soyState.pop(),e.lookupVariables=!0,b(e),null):n.match(/\bfor\b/)?(e.lookupVariables=!0,e.soyState.push("for-loop"),"keyword"):s(n,e);case"record-key":return n.match(/[\w]+/)?"property":n.match(/^[:]/)?(e.soyState.pop(),null):(n.next(),null);case"map-value":return n.peek()==")"||n.peek()==","||n.match(/^[:)]/)?(e.soyState.pop(),null):s(n,e);case"import":return n.eat(";")?(e.soyState.pop(),e.indent-=2*r.indentUnit,null):n.match(/\w+(?=\s+as\b)/)?"variable":(t=n.match(/\w+/))?/\b(from|as)\b/.test(t[0])?"keyword":"def":(t=n.match(/^["']/))?(e.soyState.push("string"),e.quoteKind=t[0],"string"):(n.next(),null);case"tag":var u,a;e.tag===void 0?(u=!0,a=""):(u=e.tag[0]=="/",a=u?e.tag.substring(1):e.tag);var f=y[a];if(n.match(/^\/?}/)){var T=n.current()=="/}";return T&&!u&&b(e),e.tag=="/template"||e.tag=="/deltemplate"?(e.variables=S(null,"ij"),e.indent=0):e.indent-=r.indentUnit*(T||U.indexOf(e.tag)==-1?2:1),e.soyState.pop(),"keyword"}else if(n.match(/^([\w?]+)(?==)/)){if(e.context&&e.context.tag==a&&n.current()=="kind"&&(t=n.match(/^="([^"]+)/,!1))){var E=t[1];e.context.kind=E;var I=v[E]||v.html,h=p(e.localStates);h.mode.indent&&(e.indent+=h.mode.indent(h.state,"","")),e.localStates.push({mode:I,state:l.startState(I)})}return"attribute"}return s(n,e);case"template-call-expression":return n.match(/^([\w-?]+)(?==)/)?"attribute":n.eat(">")||n.eat("/>")?(e.soyState.pop(),"keyword"):s(n,e);case"literal":return n.match("{/literal}",!1)?(e.soyState.pop(),this.token(n,e)):w(n,e,/\{\/literal}/);case"export":if(t=n.match(/\w+/)){if(e.soyState.pop(),t=="const")return e.soyState.push("const-def"),"keyword";if(t=="extern")return e.soyState.push("param-def"),"keyword"}else n.next();return null;case"const-def":return n.match(/^\w+/)?(e.soyState.pop(),"def"):(n.next(),null)}if(n.match("{literal}"))return e.indent+=r.indentUnit,e.soyState.push("literal"),e.context=new x(e.context,"literal",e.variables),"keyword";if(t=n.match(/^\{([/@\\]?\w+\??)(?=$|[\s}]|\/[/*])/)){var q=e.tag;e.tag=t[1];var u=e.tag[0]=="/",V=!!y[e.tag],a=u?e.tag.substring(1):e.tag,f=y[a];e.tag!="/switch"&&(e.indent+=((u||f&&f.reduceIndent)&&q!="switch"?1:2)*r.indentUnit),e.soyState.push("tag");var g=!1;if(f){if(u||f.soyState&&e.soyState.push(f.soyState),!f.noEndTag&&(V||!u))e.context=new x(e.context,e.tag,f.variableScope?e.variables:null);else if(u){var $=a=="extern"&&e.context&&e.context.tag=="export";if(!e.context||e.context.tag!=a&&!$)g=!0;else if(e.context){if(e.context.kind){e.localStates.pop();var h=p(e.localStates);h.mode.indent&&(e.indent-=h.mode.indent(h.state,"",""))}b(e)}}}else u&&(g=!0);return(g?"error ":"")+"keyword"}else{if(n.eat("{"))return e.tag="print",e.indent+=2*r.indentUnit,e.soyState.push("tag"),"keyword";if(!e.context&&n.sol()&&n.match(/import\b/))return e.soyState.push("import"),e.indent+=2*r.indentUnit,"keyword";if(t=n.match("<{"))return e.soyState.push("template-call-expression"),e.indent+=2*r.indentUnit,e.soyState.push("tag"),"keyword";if(t=n.match("</>"))return e.indent-=1*r.indentUnit,"keyword"}return w(n,e,/\{|\s+\/\/|\/\*/)},indent:function(n,e,t){var o=n.indent,c=p(n.soyState);if(c=="comment")return l.Pass;if(c=="literal")/^\{\/literal}/.test(e)&&(o-=r.indentUnit);else{if(/^\s*\{\/(template|deltemplate)\b/.test(e))return 0;/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(e)&&(o-=r.indentUnit),n.tag!="switch"&&/^\{(case|default)\b/.test(e)&&(o-=r.indentUnit),/^\{\/switch\b/.test(e)&&(o-=r.indentUnit)}var i=p(n.localStates);return o&&i.mode.indent&&(o+=i.mode.indent(i.state,e,t)),o},innerMode:function(n){return n.soyState.length&&p(n.soyState)!="literal"?null:p(n.localStates)},electricInput:/^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",useInnerComments:!1,fold:"indent"}},"htmlmixed"),l.registerHelper("wordChars","soy",/[\w$]/),l.registerHelper("hintWords","soy",Object.keys(y).concat(["css","debugger"])),l.defineMIME("text/x-soy","soy")}); soy.min.js.gz 0000644 00000006340 15174674672 0007143 0 ustar 00 � �Zm��8�~�"��rv�@z��Z��F��]�g��fE��f� �_.��Oe0 I��N� �K�\/O���]�F"�R���x�y����<+D��6_x$�l�{ٶJx��&��_���Y�mYvo�(��C\Y�5���!9��|ۿ!BM|�wq �[��l�ڬ�u�+�����4!N�ʶ��J��M���Rq$�1,&[vL���S�w�+Zf/w"�AyX����PC_�1L�ṯ ��$��p�O:���<����n�^ � QěJp�l�OW}Kn�W��R3ƻ�(ax��'��_]�ɕ�cX��&�wQ�s�;�H��$�����54�/��96�P���dF��D��U�?�[� �h� ��'�&��:�a�y�w�%|�C.�~)�7������^c�)�=P��Wo�.��ʨ]V�h��ܰ�]V,�,��.�!/��V�Q�$�VPH�J��\wq*�M��-k˓k<$�^i�`w�s�\�����lP�����/���R�b��D�ǁ�.�"��xE`��k�iʸ!��RX�1�r���Q�`ȁ%֞9��H�ga�I���Gvxr�GpG��NDU"�$N��p�V�9�DV8oF�~ K!�pK�$ɞ>�e��O�@w�j��tr�*b�(�R��/�����9*K�|QY"B���/,�"��s@w�>��+�����hH�n7�q��`�z���t/A� y�)�T�c�éUf &�� ��j���l�Z<�K���ł���H�@�$ ̊Xj��{3a�g��*�M) �ZyV��g3�c]��E,�|&D����}��?�E)~���<�F�l$d9�V�Ea"m�$k�^h�-�D��S��Вr$M7��V�|��|�D��Z�I;c���OW딥VʟE�[n{"w���8���)wҦ���V���v)"�n����ؒ���5]y��*Rߤ_�ս��ګ���o�#�O�=.S���sKL����,��Y�{���C�n،��`��W*��RE��C(�{l{^`s��&+��{���K!���<��GR�f%Y�P�wr��R�8����e>&�����=𗧬آ��GY��BD x����`A:2��&8GkУ?{�/�M�VS�/�����;(Hx��v]�A�k �y��Â�➗p�Dt�kQT�ޅI� v���I]wcV��[-�.w?.�oh3�_��?�{V@\���\5��쀌E����r��j�MV��S{o�̕r�r^�"+N��h ���a)Tx����9!�g�:aY��Ί:�D�u�#7�%x)0��������`-E�-�R��PA� �����^Х�s'�NQ�*���KP�ΊvZW��U���!�1@�� �ΣqVE('�z.��!M�@Z����ޅ���N 8�gWiocQ�F��^@����3�y��^�c�����/=U�`��a,@�n'=�K�pu:�t[Ǻ��a�!MCep2���J�qn8!GH�Q� � G���ꬹ��}�&��Y��ˇ8��&`�ZTuݿ��'�:�����-���飪 gDŽ��`��dMOawg~ӆݎ��܌FG� ���j��ҿ��n�A�ܚͰ�b҄O�p*�v�&��1X%Mu=���������?�I���c�]B���u �ڟ�r�۾m�m>�����n��FNpԬ!0Y��6 `K�ܜ��E@�����X�_��������A�"�,Ɨ�Vc�B�\��D��>��m�}aw��9��E��-ҟ�G���=3.EJ?`_�9��5�\�~�ZẈ?��������,^.�=�4��,���(��JHT�i�(7#�'f��s��;�j��"u,�e�c2e�ۋ�cƐ�Fң~����9�2��&�}e�|�ݬ���ԞH�UVsM�&�� [�(��_e}�%�n��>{ﮙ�1�- ^�J��~:���n�e����l�}��y�W�9��������o��ߌ�fp�Q����v[W�tr���M�����0�8ѫ^���\��<J��Y4;�p88K���4n�g���`N�Oڻ�h bd�ӝi �D{C��n �tLdp� ������:�%δ�'E����|s���r�_�th}A�� �d���ܟPS(a�o����=��+�C���\8�JD�_�#���P *���91��������L�L���Uɦ�h�*W��rd���-qd��D�؋듄�ml�j��mP?�f�j6�&��Bv�k3j��u�#|�G�[����Ou�[���m0H[�8�cx�ꩁ���`�\Ufb���:en���Tl��}h6h�!�}F]��h�gL�==Y&|/���=z�U���Rェ���J�`�|�N�!�Q`ԟ����Z�Ҵ���'ꖉ闭�P�[���e ���8^v Ҏv�wH���"MF.����] -��d�VW�9!��1����͵�2��*g�,�8c�R ]90�wN���r��-�����̼[�X�k]PiW<W�H�u%�iB�N�Fu���������=V�>���#��|?p����`x7��MP��g��y@:�W��K���k�!|�Φ�O�W��j�S�lU�@�Ÿ���l������!=��uސAIb (��-�a'��wc�>B���r6ÿ��"�*�&��ժk��QѪ��J�����I�z����U��+� �M��7dϦ�n�n��%ʒ� �aK�}�.�#m�i�V��Z�{�[� r"����7����A $����$�7��sL ��2�hQ)��Fga�2�����KA��w�5ׇhr JKv{��6�u����Z?���nV��jP���R|�r���mr$�.��e�װ,���2NNf3� � �h`?��z�m� �6��>o�0Vk���]c�7�Z��"����@�|� �j��NR��S�?[L�(���ׇ6�.���f��ā�4�X{.(��t���M��������l�[�^�ʋ�S��)�1�!�+�hUaiT��|3;�[YԗTc ��S�ٌߐ��??)�s�m#�I��A��A�� {>l~�n4?W�qZqM�D�� ����#�e��AJ�� 2~٣�U�}\ ^��'9/0g��; ������M`����S�Ϭ�vcO~�io��k�ʦ��y���7>��ꇓ�$"I�?�v�6C�( soy.js 0000644 00000054756 15174674672 0005760 0 ustar 00 // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/5/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}, "extern": {soyState: "param-def"}, "export": {soyState: "export"}, "literal": { }, "msg": {}, "fallbackmsg": { noEndTag: true, reduceIndent: true}, "select": {}, "plural": {}, "let": { soyState: "var-def" }, "if": {}, "javaimpl": {}, "jsimpl": {}, "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 }, "velog": {}, "const": { soyState: "const-def"}, }; 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(/\bmap(?=\()/)) { state.soyState.push("map-literal"); return "keyword"; } else if (stream.match(/\brecord(?=\()/)) { 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\b)/)) { return "variable"; } if (match = stream.match(/\w+/)) { return /\b(from|as)\b/.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}/); case "export": if (match = stream.match(/\w+/)) { state.soyState.pop(); if (match == "const") { state.soyState.push("const-def") return "keyword"; } else if (match == "extern") { state.soyState.push("param-def") return "keyword"; } } else { stream.next(); } return null; case "const-def": if (stream.match(/^\w+/)) { state.soyState.pop(); return "def"; } stream.next(); return null; } 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) { var isBalancedForExtern = tagName == 'extern' && (state.context && state.context.tag == 'export'); if (!state.context || ((state.context.tag != tagName) && !isBalancedForExtern)) { 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.sol() && stream.match(/import\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"); });
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings