realms-wiki/reimagine/static/js/ace/mode-jsoniq.js

1 line
226 KiB
JavaScript
Raw Normal View History

2013-10-01 07:10:10 +03:00
define("ace/mode/jsoniq",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/xquery/JSONiqLexer","ace/range","ace/mode/behaviour/xquery","ace/mode/folding/cstyle"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("./xquery/JSONiqLexer").JSONiqLexer,o=e("../range").Range,u=e("./behaviour/xquery").XQueryBehaviour,a=e("./folding/cstyle").FoldMode,f=function(){this.$tokenizer=new s,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),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,u=t.findMatchingBracket({row:n,column:s});if(!u||u.row==n)return 0;var a=this.$getIndent(t.getLine(u.row));t.replace(new o(n,0,n,s-1),a)},this.toggleCommentLines=function(e,t,n,r){var i,s,u=!0,a=/^\s*\(:(.*):\)/;for(i=n;i<=r;i++)if(!a.test(t.getLine(i))){u=!1;break}var f=new o(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,u?s.match(a)[1]:"(:"+s+":)")}}.call(f.prototype),t.Mode=f}),define("ace/mode/xquery/JSONiqLexer",["require","exports","module","ace/mode/xquery/JSONiqTokenizer"],function(e,t,n){var r=e("./JSONiqTokenizer").JSONiqTokenizer,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="NaN|after|allowing|ancestor|ancestor-or-self|and|append|array|as|ascending|at|attribute|base-uri|before|boundary-space|break|by|case|cast|castable|catch|child|collation|comment|constraint|construction|contains|context|continue|copy|copy-namespaces|count|decimal-format|decimal-separator|declare|default|delete|descendant|descendant-or-self|descending|digit|div|document|document-node|element|else|empty|empty-sequence|encoding|end|eq|every|except|exit|external|false|first|following|following-sibling|for|from|ft-option|function|ge|greatest|group|grouping-separator|gt|idiv|if|import|in|index|infinity|insert|instance|integrity|intersect|into|is|item|json|json-item|jsoniq|last|lax|le|least|let|loop|lt|minus-sign|mod|modify|module|namespace|namespace-node|ne|next|node|nodes|not|null|object|of|only|option|or|order|ordered|ordering|paragraphs|parent|pattern-separator|per-mille|percent|preceding|preceding-sibling|previous|processing-instruction|rename|replace|return|returning|revalidation|satisfies|schema|schema-attribute|schema-element|score|select|self|sentences|sliding|some|stable|start|strict|switch|text|then|times|to|treat|true|try|tumbling|type|typeswitch|union|unordered|updating|validate|value|variable|version|when|where|while|window|with|words|xquery|zero-digit".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:"ModuleDecl",token:"keyword",next:function(e){e.push("Prefix")}},{name:"OptionDecl",token:"keyword",next:function(e){e.push("_EQName")}},{name:"AttrTest",token:"support.type"},{name:"Variable",token:"variable"},{name:"'<![CDATA['",token:a,next:function(e){e.push("CData")}},{name:"IntegerLiteral",token:f},{name:"DecimalLiteral",tok