mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-20 12:32:39 -05:00
1 line
226 KiB
JavaScript
1 line
226 KiB
JavaScript
|
define("ace/mode/xquery",["require","exports","module","ace/worker/worker_client","ace/lib/oop","ace/mode/text","ace/mode/xquery/XQueryLexer","ace/range","ace/mode/behaviour/xquery","ace/mode/folding/cstyle"],function(e,t,n){var r=e("../worker/worker_client").WorkerClient,i=e("../lib/oop"),s=e("./text").Mode,o=e("./xquery/XQueryLexer").XQueryLexer,u=e("../range").Range,a=e("./behaviour/xquery").XQueryBehaviour,f=e("./folding/cstyle").FoldMode,l=function(){this.$tokenizer=new o,this.$behaviour=new a,this.foldingRules=new f};i.inherits(l,s),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=t.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);return i&&(r+=n),r},this.checkOutdent=function(e,t,n){return/^\s+$/.test(t)?/^\s*[\}\)]/.test(n):!1},this.autoOutdent=function(e,t,n){var r=t.getLine(n),i=r.match(/^(\s*[\}\)])/);if(!i)return 0;var s=i[1].length,o=t.findMatchingBracket({row:n,column:s});if(!o||o.row==n)return 0;var a=this.$getIndent(t.getLine(o.row));t.replace(new u(n,0,n,s-1),a)},this.toggleCommentLines=function(e,t,n,r){var i,s,o=!0,a=/^\s*\(:(.*):\)/;for(i=n;i<=r;i++)if(!a.test(t.getLine(i))){o=!1;break}var f=new u(0,0,0,0);for(i=n;i<=r;i++)s=t.getLine(i),f.start.row=i,f.end.row=i,f.end.column=s.length,t.replace(f,o?s.match(a)[1]:"(:"+s+":)")},this.createWorker=function(e){var t=new r(["ace"],"ace/mode/xquery_worker","XQueryWorker"),n=this;return t.attachToDocument(e.getDocument()),t.on("error",function(t){e.setAnnotations([t.data])}),t.on("ok",function(t){e.clearAnnotations()}),t.on("highlight",function(t){n.$tokenizer.tokens=t.data.tokens,n.$tokenizer.lines=e.getDocument().getAllLines();var r=Object.keys(n.$tokenizer.tokens);for(var i=0;i<r.length;i++){var s=parseInt(r[i]);delete e.bgTokenizer.lines[s],delete e.bgTokenizer.states[s],e.bgTokenizer.fireUpdateEvent(s,s)}}),t}}.call(l.prototype),t.Mode=l}),define("ace/mode/xquery/XQueryLexer",["require","exports","module","ace/mode/xquery/XQueryTokenizer"],function(e,t,n){var r=e("./XQueryTokenizer").XQueryTokenizer,i=function(e){var t=e;this.tokens=[],this.reset=function(e){t=t,this.tokens=[]},this.startNonterminal=function(e,t){},this.endNonterminal=function(e,t){},this.terminal=function(e,n,r){this.tokens.push({name:e,value:t.substring(n,r)})},this.whitespace=function(e,n){this.tokens.push({name:"WS",value:t.substring(e,n)})}},s="after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning|append|json|position|strict".split("|"),o=s.map(function(e){return{name:"'"+e+"'",token:"keyword"}}),u=s.map(function(e){return{name:"'"+e+"'",token:"text",next:function(e){e.pop()}}}),a="constant.language",f="constant",l="comment",c="xml-pe",h="constant.buildin",p={start:[{name:"'(#'",token:h,next:function(e){e.push("Pragma")}},{name:"'(:'",token:"comment",next:function(e){e.push("Comment")}},{name:"'(:~'",token:"comment.doc",next:function(e){e.push("CommentDoc")}},{name:"'<!--'",token:l,next:function(e){e.push("XMLComment")}},{name:"'<?'",token:c,next:function(e){e.push("PI")}},{name:"''''",token:"string",next:function(e){e.push("AposString")}},{name:"'\"'",token:"string",next:function(e){e.push("QuotString")}},{name:"Annotation",token:"support.function"},{name:"Modu
|