text: CodeMirror.defineMode("xquery",function(){function e(e,t,n){return k=e,b=n,t}function t(e,t,n){return t.tokenize=n,n(e,t)}function n(n,u){var m=n.next(),g=!1,y=p(n);if("<"==m){if(n.match("!--",!0))return t(n,u,c);if(n.match("![CDATA",!1))return u.tokenize=s,e("tag","tag");if(n.match("?",!1))return t(n,u,l);var k=n.eat("/");n.eatSpace();for(var b,z="";b=n.eat(/[^\s\u00a0=<>\"\'\/?]/);)z+=b;return t(n,u,o(z,k))}if("{"==m)return h(u,{type:"codeblock"}),e("",null);if("}"==m)return x(u),e("",null);if(f(u))return">"==m?e("tag","tag"):"/"==m&&n.eat(">")?(x(u),e("tag","tag")):e("word","variable");if(/\d/.test(m))return n.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/),e("number","atom");if("("===m&&n.eat(":"))return h(u,{type:"comment"}),t(n,u,r);if(y||'"'!==m&&"'"!==m){if("$"===m)return t(n,u,i);if(":"===m&&n.eat("="))return e("operator","keyword");if("("===m)return h(u,{type:"paren"}),e("",null);if(")"===m)return x(u),e("",null);if("["===m)return h(u,{type:"bracket"}),e("",null);if("]"===m)return x(u),e("",null);var w=v.propertyIsEnumerable(m)&&v[m];if(y&&'"'===m)for(;'"'!==n.next(););if(y&&"'"===m)for(;"'"!==n.next(););w||n.eatWhile(/[\w\$_-]/);var q=n.eat(":");!n.eat(":")&&q&&n.eatWhile(/[\w\$_-]/),n.match(/^[ \t]*\(/,!1)&&(g=!0);var _=n.current();return w=v.propertyIsEnumerable(_)&&v[_],g&&!w&&(w={type:"function_call",style:"variable def"}),d(u)?(x(u),e("word","variable",_)):(("element"==_||"attribute"==_||"axis_specifier"==w.type)&&h(u,{type:"xmlconstructor"}),w?e(w.type,w.style,_):e("word","variable",_))}return t(n,u,a(m))}function r(t,n){for(var r,a=!1,i=!1,o=0;r=t.next();){if(")"==r&&a){if(!(o>0)){x(n);break}o--}else":"==r&&i&&o++;a=":"==r,i="("==r}return e("comment","comment")}function a(t,r){return function(i,o){var u;if(g(o)&&i.current()==t)return x(o),r&&(o.tokenize=r),e("string","string");if(h(o,{type:"string",name:t,tokenize:a(t,r)}),i.match("{",!1)&&m(o))return o.tokenize=n,e("string","string");for(;u=i.next();){if(u==t){x(o),r&&(o.tokenize=r);break}if(i.match("{",!1)&&m(o))return o.tokenize=n,e("string","string")}return e("string","string")}}function i(t,r){var a=/[\w\$_-]/;if(t.eat('"')){for(;'"'!==t.next(););t.eat(":")}else t.eatWhile(a),t.match(":=",!1)||t.eat(":");return t.eatWhile(a),r.tokenize=n,e("variable","variable")}function o(t,r){return function(a,i){return a.eatSpace(),r&&a.eat(">")?(x(i),i.tokenize=n,e("tag","tag")):(a.eat("/")||h(i,{type:"tag",name:t,tokenize:n}),a.eat(">")?(i.tokenize=n,e("tag","tag")):(i.tokenize=u,e("tag","tag")))}}function u(r,i){var o=r.next();return"/"==o&&r.eat(">")?(m(i)&&x(i),f(i)&&x(i),e("tag","tag")):">"==o?(m(i)&&x(i),e("tag","tag")):"="==o?e("",null):'"'==o||"'"==o?t(r,i,a(o,u)):(m(i)||h(i,{type:"attribute",tokenize:u}),r.eat(/[a-zA-Z_:]/),r.eatWhile(/[-a-zA-Z0-9_:.]/),r.eatSpace(),(r.match(">",!1)||r.match("/",!1))&&(x(i),i.tokenize=n),e("attribute","attribute"))}function c(t,r){for(var a;a=t.next();)if("-"==a&&t.match("->",!0))return r.tokenize=n,e("comment","comment")}function s(t,r){for(var a;a=t.next();)if("]"==a&&t.match("]",!0))return r.tokenize=n,e("comment","comment")}function l(t,r){for(var a;a=t.next();)if("?"==a&&t.match(">",!0))return r.tokenize=n,e("comment","comment meta")}function f(e){return y(e,"tag")}function m(e){return y(e,"attribute")}function d(e){return y(e,"xmlconstructor")}function g(e){return y(e,"string")}function p(e){return'"'===e.current()?e.match(/^[^\"]+\"\:/,!1):"'"===e.current()?e.match(/^[^\"]+\'\:/,!1):!1}function y(e,t){return e.stack.length&&e.stack[e.stack.length-1].type==t}function h(e,t){e.stack.push(t)}function x(e){e.stack.pop();var t=e.stack.length&&e.stack[e.stack.length-1].tokenize;e.tokenize=t||n}var k,b,v=function(){function e(e){return{type:e,style:"keyword"}}for(var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),a=e("operator"),i={type:"atom",style:"atom"},o={type:"punctuation",style:null},u={type:"axis_specifier",style:"qualifier"},c={"if":t,"switch":t,"while":t,"for":t,"else":n,then:n,"try":n,"finally":n,"catch":n,element:r,attribute:r,let:r,"implements":r,"import":r,module:r,namespace:r,"return":r,"super":r,"this":r,"throws":r,where:r,"private":r,",":o,"null":i,"fn:false()":i,"fn:true()":i},s=["after","ancestor","ancestor-or-self","and","as","ascending","assert","attribute","before","by","case","cast","child","comment","declare","default","define","descendant","descendant-or-self","descending","document","document-node","element","else","eq","every","except","external","following","following-sibling","follows","for","function","if","import","in","instance","intersect","item","let","module","namespace","node","node","of","only","or","order","parent","precedes","preceding","preceding-sibling","processing-instruction","ref","return","returns","satisfies","schema","schema-element","self","some","sortby","stable","text","then","to","treat","typeswitch","union","variable","version","where","xquery","empty-sequence"],l=0,f=s.length;f>l;l++)c[s[l]]=e(s[l]);for(var m=["xs:string","xs:float","xs:decimal","xs:double","xs:integer","xs:boolean","xs:date","xs:dateTime","xs:time","xs:duration","xs:dayTimeDuration","xs:time","xs:yearMonthDuration","numeric","xs:hexBinary","xs:base64Binary","xs:anyURI","xs:QName","xs:byte","xs:boolean","xs:anyURI","xf:yearMonthDuration"],l=0,f=m.length;f>l;l++)c[m[l]]=i;for(var d=["eq","ne","lt","le","gt","ge",":=","=",">",">=","<","<=",".","|","?","and","or","div","idiv","mod","*","/","+","-"],l=0,f=d.length;f>l;l++)c[d[l]]=a;for(var g=["self::","attribute::","child::","descendant::","descendant-or-self::","parent::","ancestor::","ancestor-or-self::","following::","preceding::","following-sibling::","preceding-sibling::"],l=0,f=g.length;f>l;l++)c[g[l]]=u;return c}();return{startState:function(){return{tokenize:n,cc:[],stack:[]}},token:function(e,t){if(e.eatSpace())return null;var n=t.tokenize(e,t);return n},blockCommentStart:"(:",blockCommentEnd:":)"}}),CodeMirror.defineMIME("application/xquery","xquery");