realms-wiki/realms/static/js/ace/mode-logiql.js

1 line
11 KiB
JavaScript
Raw Normal View History

2013-10-01 07:10:10 +03:00
define("ace/mode/logiql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/logiql_highlight_rules","ace/mode/folding/coffee","ace/token_iterator","ace/range","ace/mode/behaviour/cstyle","ace/mode/matching_brace_outdent"],function(e,t,n){var r=e("../lib/oop"),i=e("./text").Mode,s=e("../tokenizer").Tokenizer,o=e("./logiql_highlight_rules").LogiQLHighlightRules,u=e("./folding/coffee").FoldMode,a=e("../token_iterator").TokenIterator,f=e("../range").Range,l=e("./behaviour/cstyle").CstyleBehaviour,c=e("./matching_brace_outdent").MatchingBraceOutdent,h=function(){var e=new o;this.foldingRules=new u,this.$tokenizer=new s(e.getRules()),this.$outdent=new c,this.$behaviour=new l};r.inherits(h,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.$tokenizer.getLineTokens(t,e),s=i.tokens,o=i.state;if(/comment|string/.test(o))return r;if(s.length&&s[s.length-1].type=="comment.single")return r;var u=t.match();return/(-->|<--|<-|->|{)\s*$/.test(t)&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)?!0:n!=="\n"&&n!=="\r\n"?!1:/^\s+/.test(t)?!0:!1},this.autoOutdent=function(e,t,n){if(this.$outdent.autoOutdent(t,n))return;var r=t.getLine(n),i=r.match(/^\s+/),s=r.lastIndexOf(".")+1;if(!i||!n||!s)return 0;var o=t.getLine(n+1),u=this.getMatching(t,{row:n,column:s});if(!u||u.start.row==n)return 0;s=i[0].length;var a=this.$getIndent(t.getLine(u.start.row));t.replace(new f(n+1,0,n+1,s),a)},this.getMatching=function(e,t,n){t==undefined&&(t=e.selection.lead),typeof t=="object"&&(n=t.column,t=t.row);var r=e.getTokenAt(t,n),i="keyword.start",s="keyword.end",o;if(!r)return;if(r.type==i){var u=new a(e,t,n);u.step=u.stepForward}else{if(r.type!=s)return;var u=new a(e,t,n);u.step=u.stepBackward}while(o=u.step())if(o.type==i||o.type==s)break;if(!o||o.type==r.type)return;var l=u.getCurrentTokenColumn(),t=u.getCurrentTokenRow();return new f(t,l,t,l+o.value.length)}}.call(h.prototype),t.Mode=h}),define("ace/mode/logiql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.block",regex:"/\\*",push:[{token:"comment.block",regex:"\\*/",next:"pop"},{defaultToken:"comment.block"}]},{token:"comment.single",regex:"//.*"},{token:"constant.numeric",regex:"\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?[fd]?"},{token:"string",regex:'"',push:[{token:"string",regex:'"',next:"pop"},{defaultToken:"string"}]},{token:"constant.language",regex:"\\b(true|false)\\b"},{token:"entity.name.type.logicblox",regex:"`[a-zA-Z_:]+(\\d|\\a)*\\b"},{token:"keyword.start",regex:"->",comment:"Constraint"},{token:"keyword.start",regex:"-->",comment:"Level 1 Constraint"},{token:"keyword.start",regex:"<-",comment:"Rule"},{token:"keyword.start",regex:"<--",comment:"Level 1 Rule"},{token:"keyword.end",regex:"\\.",comment:"Terminator"},{token:"keyword.other",regex:"!",comment:"Negation"},{token:"keyword.other",regex:",",comment:"Conjunction"},{token:"keyword.other",regex:";",comment:"Disjunction"},{token:"keyword.operator",regex:"<=|>=|!=|<|>",comment:"Equality"},{token:"keyword.other",regex:"@",comment:"Equality"},{token:"keyword.operator",regex:"\\+|-|\\*|/",comment:"Arithmetic operations"},{token:"keyword",regex:"::",comment:"Colon colon"},{token:"support.function",regex:"\\b(agg\\s*<<)",push:[{include:"$self"},{token:"support.function",regex:">>",next:"pop"}]},{token:"storage.modifier",regex:"\\b(lang:[\\w:]*)"},{token:["storage.type","text"],regex:"(export|sealed|clauses|block|alias)(\\s*\\()(?=`)"},{token:"entity.name",regex:"[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))"},{token:"variable.parameter",regex:"([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))"}]},this.normalizeRules()};r.inherits(s,i),t.LogiQLHighlightRules=s}),define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],functi