From c2805e03c84b6e598556fd06d1ede7aaeea7ce9c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 16:17:54 -0800 Subject: Squashed commit FileIO-Build-Candidate into Master Fixing issues with HTML and CSS URLs. Adjusted RegEx logic. Also code a mirror update and undo/redo changes were merged into this request. Signed-off-by: Valerio Virgillito --- imports/codemirror/mode/clike/clike.js | 19 +- imports/codemirror/mode/clike/index.html | 2 +- imports/codemirror/mode/clojure/clojure.js | 2 +- imports/codemirror/mode/clojure/index.html | 0 imports/codemirror/mode/coffeescript/LICENSE | 0 .../codemirror/mode/coffeescript/coffeescript.js | 90 ++-- imports/codemirror/mode/coffeescript/index.html | 0 imports/codemirror/mode/css/css.js | 0 imports/codemirror/mode/css/index.html | 0 imports/codemirror/mode/diff/diff.css | 0 imports/codemirror/mode/diff/diff.js | 0 imports/codemirror/mode/diff/index.html | 0 imports/codemirror/mode/ecl/ecl.js | 203 +++++++ imports/codemirror/mode/ecl/index.html | 42 ++ imports/codemirror/mode/gfm/gfm.js | 2 +- imports/codemirror/mode/gfm/index.html | 0 imports/codemirror/mode/go/go.js | 170 ++++++ imports/codemirror/mode/go/index.html | 72 +++ imports/codemirror/mode/groovy/groovy.js | 0 imports/codemirror/mode/groovy/index.html | 0 imports/codemirror/mode/haskell/haskell.js | 0 imports/codemirror/mode/haskell/index.html | 0 .../codemirror/mode/htmlembedded/htmlembedded.js | 0 imports/codemirror/mode/htmlembedded/index.html | 0 imports/codemirror/mode/htmlmixed/htmlmixed.js | 0 imports/codemirror/mode/htmlmixed/index.html | 0 imports/codemirror/mode/javascript/index.html | 0 imports/codemirror/mode/javascript/javascript.js | 4 +- imports/codemirror/mode/jinja2/index.html | 0 imports/codemirror/mode/jinja2/jinja2.js | 0 imports/codemirror/mode/less/index.html | 588 +++++++++++++++++++++ imports/codemirror/mode/less/less.js | 189 +++++++ imports/codemirror/mode/lua/index.html | 0 imports/codemirror/mode/lua/lua.js | 0 imports/codemirror/mode/markdown/index.html | 0 imports/codemirror/mode/markdown/markdown.js | 82 ++- imports/codemirror/mode/mysql/index.html | 41 ++ imports/codemirror/mode/mysql/mysql.js | 188 +++++++ imports/codemirror/mode/ntriples/index.html | 0 imports/codemirror/mode/ntriples/ntriples.js | 0 imports/codemirror/mode/pascal/LICENSE | 0 imports/codemirror/mode/pascal/index.html | 0 imports/codemirror/mode/pascal/pascal.js | 48 +- imports/codemirror/mode/perl/LICENSE | 0 imports/codemirror/mode/perl/index.html | 0 imports/codemirror/mode/perl/perl.js | 2 +- imports/codemirror/mode/php/index.html | 0 imports/codemirror/mode/php/php.js | 78 ++- imports/codemirror/mode/plsql/index.html | 0 imports/codemirror/mode/plsql/plsql.js | 0 imports/codemirror/mode/properties/index.html | 40 ++ imports/codemirror/mode/properties/properties.css | 3 + imports/codemirror/mode/properties/properties.js | 57 ++ imports/codemirror/mode/python/LICENSE.txt | 0 imports/codemirror/mode/python/index.html | 0 imports/codemirror/mode/python/python.js | 41 +- imports/codemirror/mode/r/LICENSE | 0 imports/codemirror/mode/r/index.html | 0 imports/codemirror/mode/r/r.js | 0 imports/codemirror/mode/rpm/changes/changes.js | 0 imports/codemirror/mode/rpm/changes/index.html | 0 imports/codemirror/mode/rpm/spec/index.html | 0 imports/codemirror/mode/rpm/spec/spec.css | 0 imports/codemirror/mode/rpm/spec/spec.js | 2 +- imports/codemirror/mode/rst/index.html | 0 imports/codemirror/mode/rst/rst.js | 0 imports/codemirror/mode/ruby/LICENSE | 0 imports/codemirror/mode/ruby/index.html | 0 imports/codemirror/mode/ruby/ruby.js | 17 +- imports/codemirror/mode/rust/index.html | 6 +- imports/codemirror/mode/rust/rust.js | 51 +- imports/codemirror/mode/scheme/index.html | 0 imports/codemirror/mode/smalltalk/index.html | 0 imports/codemirror/mode/smalltalk/smalltalk.js | 32 +- imports/codemirror/mode/sparql/index.html | 0 imports/codemirror/mode/sparql/sparql.js | 0 imports/codemirror/mode/stex/index.html | 2 +- imports/codemirror/mode/stex/stex.js | 0 imports/codemirror/mode/tiddlywiki/index.html | 0 imports/codemirror/mode/tiddlywiki/tiddlywiki.css | 0 imports/codemirror/mode/tiddlywiki/tiddlywiki.js | 0 imports/codemirror/mode/velocity/index.html | 0 imports/codemirror/mode/velocity/velocity.js | 0 imports/codemirror/mode/verilog/index.html | 210 ++++++++ imports/codemirror/mode/verilog/verilog.js | 194 +++++++ imports/codemirror/mode/xml/index.html | 0 imports/codemirror/mode/xml/xml.js | 35 +- imports/codemirror/mode/xmlpure/index.html | 0 imports/codemirror/mode/xmlpure/xmlpure.js | 5 + imports/codemirror/mode/yaml/index.html | 0 imports/codemirror/mode/yaml/yaml.js | 0 91 files changed, 2294 insertions(+), 223 deletions(-) mode change 100755 => 100644 imports/codemirror/mode/clike/clike.js mode change 100755 => 100644 imports/codemirror/mode/clike/index.html mode change 100755 => 100644 imports/codemirror/mode/clojure/clojure.js mode change 100755 => 100644 imports/codemirror/mode/clojure/index.html mode change 100755 => 100644 imports/codemirror/mode/coffeescript/LICENSE mode change 100755 => 100644 imports/codemirror/mode/coffeescript/coffeescript.js mode change 100755 => 100644 imports/codemirror/mode/coffeescript/index.html mode change 100755 => 100644 imports/codemirror/mode/css/css.js mode change 100755 => 100644 imports/codemirror/mode/css/index.html mode change 100755 => 100644 imports/codemirror/mode/diff/diff.css mode change 100755 => 100644 imports/codemirror/mode/diff/diff.js mode change 100755 => 100644 imports/codemirror/mode/diff/index.html create mode 100644 imports/codemirror/mode/ecl/ecl.js create mode 100644 imports/codemirror/mode/ecl/index.html mode change 100755 => 100644 imports/codemirror/mode/gfm/gfm.js mode change 100755 => 100644 imports/codemirror/mode/gfm/index.html create mode 100644 imports/codemirror/mode/go/go.js create mode 100644 imports/codemirror/mode/go/index.html mode change 100755 => 100644 imports/codemirror/mode/groovy/groovy.js mode change 100755 => 100644 imports/codemirror/mode/groovy/index.html mode change 100755 => 100644 imports/codemirror/mode/haskell/haskell.js mode change 100755 => 100644 imports/codemirror/mode/haskell/index.html mode change 100755 => 100644 imports/codemirror/mode/htmlembedded/htmlembedded.js mode change 100755 => 100644 imports/codemirror/mode/htmlembedded/index.html mode change 100755 => 100644 imports/codemirror/mode/htmlmixed/htmlmixed.js mode change 100755 => 100644 imports/codemirror/mode/htmlmixed/index.html mode change 100755 => 100644 imports/codemirror/mode/javascript/index.html mode change 100755 => 100644 imports/codemirror/mode/javascript/javascript.js mode change 100755 => 100644 imports/codemirror/mode/jinja2/index.html mode change 100755 => 100644 imports/codemirror/mode/jinja2/jinja2.js create mode 100644 imports/codemirror/mode/less/index.html create mode 100644 imports/codemirror/mode/less/less.js mode change 100755 => 100644 imports/codemirror/mode/lua/index.html mode change 100755 => 100644 imports/codemirror/mode/lua/lua.js mode change 100755 => 100644 imports/codemirror/mode/markdown/index.html mode change 100755 => 100644 imports/codemirror/mode/markdown/markdown.js create mode 100644 imports/codemirror/mode/mysql/index.html create mode 100644 imports/codemirror/mode/mysql/mysql.js mode change 100755 => 100644 imports/codemirror/mode/ntriples/index.html mode change 100755 => 100644 imports/codemirror/mode/ntriples/ntriples.js mode change 100755 => 100644 imports/codemirror/mode/pascal/LICENSE mode change 100755 => 100644 imports/codemirror/mode/pascal/index.html mode change 100755 => 100644 imports/codemirror/mode/pascal/pascal.js mode change 100755 => 100644 imports/codemirror/mode/perl/LICENSE mode change 100755 => 100644 imports/codemirror/mode/perl/index.html mode change 100755 => 100644 imports/codemirror/mode/perl/perl.js mode change 100755 => 100644 imports/codemirror/mode/php/index.html mode change 100755 => 100644 imports/codemirror/mode/php/php.js mode change 100755 => 100644 imports/codemirror/mode/plsql/index.html mode change 100755 => 100644 imports/codemirror/mode/plsql/plsql.js create mode 100755 imports/codemirror/mode/properties/index.html create mode 100755 imports/codemirror/mode/properties/properties.css create mode 100755 imports/codemirror/mode/properties/properties.js mode change 100755 => 100644 imports/codemirror/mode/python/LICENSE.txt mode change 100755 => 100644 imports/codemirror/mode/python/index.html mode change 100755 => 100644 imports/codemirror/mode/python/python.js mode change 100755 => 100644 imports/codemirror/mode/r/LICENSE mode change 100755 => 100644 imports/codemirror/mode/r/index.html mode change 100755 => 100644 imports/codemirror/mode/r/r.js mode change 100755 => 100644 imports/codemirror/mode/rpm/changes/changes.js mode change 100755 => 100644 imports/codemirror/mode/rpm/changes/index.html mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/index.html mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/spec.css mode change 100755 => 100644 imports/codemirror/mode/rpm/spec/spec.js mode change 100755 => 100644 imports/codemirror/mode/rst/index.html mode change 100755 => 100644 imports/codemirror/mode/rst/rst.js mode change 100755 => 100644 imports/codemirror/mode/ruby/LICENSE mode change 100755 => 100644 imports/codemirror/mode/ruby/index.html mode change 100755 => 100644 imports/codemirror/mode/ruby/ruby.js mode change 100755 => 100644 imports/codemirror/mode/rust/index.html mode change 100755 => 100644 imports/codemirror/mode/rust/rust.js mode change 100755 => 100644 imports/codemirror/mode/scheme/index.html mode change 100755 => 100644 imports/codemirror/mode/smalltalk/index.html mode change 100755 => 100644 imports/codemirror/mode/smalltalk/smalltalk.js mode change 100755 => 100644 imports/codemirror/mode/sparql/index.html mode change 100755 => 100644 imports/codemirror/mode/sparql/sparql.js mode change 100755 => 100644 imports/codemirror/mode/stex/index.html mode change 100755 => 100644 imports/codemirror/mode/stex/stex.js mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/index.html mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/tiddlywiki.css mode change 100755 => 100644 imports/codemirror/mode/tiddlywiki/tiddlywiki.js mode change 100755 => 100644 imports/codemirror/mode/velocity/index.html mode change 100755 => 100644 imports/codemirror/mode/velocity/velocity.js create mode 100644 imports/codemirror/mode/verilog/index.html create mode 100644 imports/codemirror/mode/verilog/verilog.js mode change 100755 => 100644 imports/codemirror/mode/xml/index.html mode change 100755 => 100644 imports/codemirror/mode/xml/xml.js mode change 100755 => 100644 imports/codemirror/mode/xmlpure/index.html mode change 100755 => 100644 imports/codemirror/mode/xmlpure/xmlpure.js mode change 100755 => 100644 imports/codemirror/mode/yaml/index.html mode change 100755 => 100644 imports/codemirror/mode/yaml/yaml.js (limited to 'imports/codemirror/mode') diff --git a/imports/codemirror/mode/clike/clike.js b/imports/codemirror/mode/clike/clike.js old mode 100755 new mode 100644 index 69877efd..66443fb8 --- a/imports/codemirror/mode/clike/clike.js +++ b/imports/codemirror/mode/clike/clike.js @@ -59,7 +59,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { escaped = !escaped && next == "\\"; } if (end || !(escaped || multiLineStrings)) - state.tokenize = tokenBase; + state.tokenize = null; return "string"; }; } @@ -68,7 +68,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { var maybeEnd = false, ch; while (ch = stream.next()) { if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; + state.tokenize = null; break; } maybeEnd = (ch == "*"); @@ -231,19 +231,4 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { } } }); - CodeMirror.defineMIME("text/x-groovy", { - name: "clike", - keywords: words("abstract as assert boolean break byte case catch char class const continue def default " + - "do double else enum extends final finally float for goto if implements import " + - "in instanceof int interface long native new package property private protected public " + - "return short static strictfp super switch synchronized this throw throws transient " + - "try void volatile while"), - atoms: words("true false null"), - hooks: { - "@": function(stream, state) { - stream.eatWhile(/[\w\$_]/); - return "meta"; - } - } - }); }()); diff --git a/imports/codemirror/mode/clike/index.html b/imports/codemirror/mode/clike/index.html old mode 100755 new mode 100644 index 5e375ef4..5c327451 --- a/imports/codemirror/mode/clike/index.html +++ b/imports/codemirror/mode/clike/index.html @@ -96,6 +96,6 @@ void* zmq_thread_init(void* zmq_context, int signal_fd) {

MIME types defined: text/x-csrc (C code), text/x-c++src (C++ code), text/x-java (Java - code), text/x-groovy (Groovy code).

+ code).

diff --git a/imports/codemirror/mode/clojure/clojure.js b/imports/codemirror/mode/clojure/clojure.js old mode 100755 new mode 100644 index a951589e..cce7ce37 --- a/imports/codemirror/mode/clojure/clojure.js +++ b/imports/codemirror/mode/clojure/clojure.js @@ -103,7 +103,7 @@ CodeMirror.defineMode("clojure", function (config, mode) { return { indentStack: null, indentation: 0, - mode: false, + mode: false }; }, diff --git a/imports/codemirror/mode/clojure/index.html b/imports/codemirror/mode/clojure/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/coffeescript/LICENSE b/imports/codemirror/mode/coffeescript/LICENSE old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/coffeescript/coffeescript.js b/imports/codemirror/mode/coffeescript/coffeescript.js old mode 100755 new mode 100644 index d4d57239..4f2bd66d --- a/imports/codemirror/mode/coffeescript/coffeescript.js +++ b/imports/codemirror/mode/coffeescript/coffeescript.js @@ -4,17 +4,17 @@ */ CodeMirror.defineMode('coffeescript', function(conf) { var ERRORCLASS = 'error'; - + function wordRegexp(words) { return new RegExp("^((" + words.join(")|(") + "))\\b"); } - + var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!\?]"); var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]'); var doubleOperators = new RegExp("^((\->)|(\=>)|(\\+\\+)|(\\+\\=)|(\\-\\-)|(\\-\\=)|(\\*\\*)|(\\*\\=)|(\\/\\/)|(\\/\\=)|(==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//))"); var doubleDelimiters = new RegExp("^((\\.\\.)|(\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))"); var tripleDelimiters = new RegExp("^((\\.\\.\\.)|(//=)|(>>=)|(<<=)|(\\*\\*=))"); - var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); + var identifiers = new RegExp("^[_A-Za-z$][_A-Za-z$0-9]*"); var wordOperators = wordRegexp(['and', 'or', 'not', 'is', 'isnt', 'in', @@ -57,15 +57,21 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (stream.eatSpace()) { return null; } - + var ch = stream.peek(); - - // Handle comments + + // Handle multi line comments + if (stream.match("###")) { + state.tokenize = longComment; + return state.tokenize(stream, state); + } + + // Single line comment if (ch === '#') { stream.skipToEnd(); return 'comment'; } - + // Handle number literals if (stream.match(/^-?[0-9\.]/, false)) { var floatLiteral = false; @@ -79,7 +85,12 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (stream.match(/^-?\.\d+/)) { floatLiteral = true; } + if (floatLiteral) { + // prevent from getting extra . on 1.. + if (stream.peek() == "."){ + stream.backUp(1); + } return 'number'; } // Integers @@ -100,7 +111,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { return 'number'; } } - + // Handle strings if (stream.match(stringPrefixes)) { state.tokenize = tokenFactory(stream.current(), 'string'); @@ -115,7 +126,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { stream.backUp(1); } } - + // Handle operators and delimiters if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { return 'punctuation'; @@ -128,28 +139,26 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (stream.match(singleDelimiters)) { return 'punctuation'; } - + if (stream.match(constants)) { return 'atom'; } - + if (stream.match(keywords)) { return 'keyword'; } - + if (stream.match(identifiers)) { return 'variable'; } - + // Handle non-detected items stream.next(); return ERRORCLASS; } - + function tokenFactory(delimiter, outclass) { - var delim_re = new RegExp(delimiter); var singleline = delimiter.length == 1; - return function tokenString(stream, state) { while (!stream.eol()) { stream.eatWhile(/[^'"\/\\]/); @@ -158,7 +167,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (singleline && stream.eol()) { return outclass; } - } else if (stream.match(delim_re)) { + } else if (stream.match(delimiter)) { state.tokenize = tokenBase; return outclass; } else { @@ -175,7 +184,19 @@ CodeMirror.defineMode('coffeescript', function(conf) { return outclass; }; } - + + function longComment(stream, state) { + while (!stream.eol()) { + stream.eatWhile(/[^#]/); + if (stream.match("###")) { + state.tokenize = tokenBase; + break; + } + stream.eatWhile("#"); + } + return "comment" + } + function indent(stream, state, type) { type = type || 'coffee'; var indentUnit = 0; @@ -194,7 +215,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { type: type }); } - + function dedent(stream, state) { if (state.scopes.length == 1) return; if (state.scopes[0].type === 'coffee') { @@ -233,18 +254,13 @@ CodeMirror.defineMode('coffeescript', function(conf) { return ERRORCLASS; } } - + // Handle properties if (current === '@') { - style = state.tokenize(stream, state); - current = stream.current(); - if (style === 'variable') { - return 'variable-2'; - } else { - return ERRORCLASS; - } + stream.eat('@'); + return 'keyword'; } - + // Handle scope changes. if (current === 'return') { state.dedent += 1; @@ -266,7 +282,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (current == 'then'){ dedent(stream, state); } - + if (style === 'dedent') { if (dedent(stream, state)) { @@ -283,7 +299,7 @@ CodeMirror.defineMode('coffeescript', function(conf) { if (state.scopes.length > 1) state.scopes.shift(); state.dedent -= 1; } - + return style; } @@ -297,27 +313,27 @@ CodeMirror.defineMode('coffeescript', function(conf) { dedent: 0 }; }, - + token: function(stream, state) { var style = tokenLexer(stream, state); - + state.lastToken = {style:style, content: stream.current()}; - + if (stream.eol() && stream.lambda) { state.lambda = false; } - + return style; }, - + indent: function(state, textAfter) { if (state.tokenize != tokenBase) { return 0; } - + return state.scopes[0].offset; } - + }; return external; }); diff --git a/imports/codemirror/mode/coffeescript/index.html b/imports/codemirror/mode/coffeescript/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/css/css.js b/imports/codemirror/mode/css/css.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/css/index.html b/imports/codemirror/mode/css/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/diff/diff.css b/imports/codemirror/mode/diff/diff.css old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/diff/diff.js b/imports/codemirror/mode/diff/diff.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/diff/index.html b/imports/codemirror/mode/diff/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/ecl/ecl.js b/imports/codemirror/mode/ecl/ecl.js new file mode 100644 index 00000000..9c94e670 --- /dev/null +++ b/imports/codemirror/mode/ecl/ecl.js @@ -0,0 +1,203 @@ +CodeMirror.defineMode("ecl", function(config) { + + function words(str) { + var obj = {}, words = str.split(" "); + for (var i = 0; i < words.length; ++i) obj[words[i]] = true; + return obj; + } + + function metaHook(stream, state) { + if (!state.startOfLine) return false; + stream.skipToEnd(); + return "meta"; + } + + function tokenAtString(stream, state) { + var next; + while ((next = stream.next()) != null) { + if (next == '"' && !stream.eat('"')) { + state.tokenize = null; + break; + } + } + return "string"; + } + + var indentUnit = config.indentUnit; + var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode"); + var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait"); + var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath"); + var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode"); + var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when"); + var blockKeywords = words("catch class do else finally for if switch try while"); + var atoms = words("true false null"); + var hooks = {"#": metaHook}; + var multiLineStrings; + var isOperatorChar = /[+\-*&%=<>!?|\/]/; + + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (hooks[ch]) { + var result = hooks[ch](stream, state); + if (result !== false) return result; + } + if (ch == '"' || ch == "'") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null + } + if (/\d/.test(ch)) { + stream.eatWhile(/[\w\.]/); + return "number"; + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current().toLowerCase(); + if (keyword.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "keyword"; + } else if (variable.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable"; + } else if (variable_2.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable-2"; + } else if (variable_3.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "variable-3"; + } else if (builtin.propertyIsEnumerable(cur)) { + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; + return "builtin"; + } else { //Data types are of from KEYWORD## + var i = cur.length - 1; + while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_')) + --i; + + if (i > 0) { + var cur2 = cur.substr(0, i + 1); + if (variable_3.propertyIsEnumerable(cur2)) { + if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement"; + return "variable-3"; + } + } + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "word"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || multiLineStrings)) + state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment" || style == "meta") return style; + if (ctx.align == null) ctx.align = true; + + if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state); + else if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "}") { + while (ctx.type == "statement") ctx = popContext(state); + if (ctx.type == "}") ctx = popContext(state); + while (ctx.type == "statement") ctx = popContext(state); + } + else if (curPunc == ctx.type) popContext(state); + else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement")) + pushContext(state, stream.column(), "statement"); + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev; + var closing = firstChar == ctx.type; + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit); + else if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "{}" + }; +}); + +CodeMirror.defineMIME("text/x-ecl"); diff --git a/imports/codemirror/mode/ecl/index.html b/imports/codemirror/mode/ecl/index.html new file mode 100644 index 00000000..d6b41f4e --- /dev/null +++ b/imports/codemirror/mode/ecl/index.html @@ -0,0 +1,42 @@ + + + + CodeMirror: ECL mode + + + + + + + +

CodeMirror: ECL mode

+
+ + +

Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

+

MIME types defined: text/x-ecl.

+ + + diff --git a/imports/codemirror/mode/gfm/gfm.js b/imports/codemirror/mode/gfm/gfm.js old mode 100755 new mode 100644 index 1e9d7d87..01afed7b --- a/imports/codemirror/mode/gfm/gfm.js +++ b/imports/codemirror/mode/gfm/gfm.js @@ -8,7 +8,7 @@ CodeMirror.defineMode("gfm", function(config, parserConfig) { "c++": "text/x-c++src", java: "text/x-java", csharp: "text/x-csharp", - "c#": "text/x-csharp", + "c#": "text/x-csharp" }; // make this lazy so that we don't need to load GFM last diff --git a/imports/codemirror/mode/gfm/index.html b/imports/codemirror/mode/gfm/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/go/go.js b/imports/codemirror/mode/go/go.js new file mode 100644 index 00000000..00e5d6c2 --- /dev/null +++ b/imports/codemirror/mode/go/go.js @@ -0,0 +1,170 @@ +CodeMirror.defineMode("go", function(config, parserConfig) { + var indentUnit = config.indentUnit; + + var keywords = { + "break":true, "case":true, "chan":true, "const":true, "continue":true, + "default":true, "defer":true, "else":true, "fallthrough":true, "for":true, + "func":true, "go":true, "goto":true, "if":true, "import":true, + "interface":true, "map":true, "package":true, "range":true, "return":true, + "select":true, "struct":true, "switch":true, "type":true, "var":true, + "bool":true, "byte":true, "complex64":true, "complex128":true, + "float32":true, "float64":true, "int8":true, "int16":true, "int32":true, + "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true, + "uint64":true, "int":true, "uint":true, "uintptr":true + }; + + var atoms = { + "true":true, "false":true, "iota":true, "nil":true, "append":true, + "cap":true, "close":true, "complex":true, "copy":true, "imag":true, + "len":true, "make":true, "new":true, "panic":true, "print":true, + "println":true, "real":true, "recover":true + }; + + var blockKeywords = { + "else":true, "for":true, "func":true, "if":true, "interface":true, + "select":true, "struct":true, "switch":true + }; + + var isOperatorChar = /[+\-*&^%:=<>!|\/]/; + + var curPunc; + + function tokenBase(stream, state) { + var ch = stream.next(); + if (ch == '"' || ch == "'" || ch == "`") { + state.tokenize = tokenString(ch); + return state.tokenize(stream, state); + } + if (/[\d\.]/.test(ch)) { + if (ch == ".") { + stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/); + } else if (ch == "0") { + stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/); + } else { + stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/); + } + return "number"; + } + if (/[\[\]{}\(\),;\:\.]/.test(ch)) { + curPunc = ch; + return null + } + if (ch == "/") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_]/); + var cur = stream.current(); + if (keywords.propertyIsEnumerable(cur)) { + if (cur == "case" || cur == "default") curPunc = "case"; + return "keyword"; + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "word"; + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, next, end = false; + while ((next = stream.next()) != null) { + if (next == quote && !escaped) {end = true; break;} + escaped = !escaped && next == "\\"; + } + if (end || !(escaped || quote == "`")) + state.tokenize = tokenBase; + return "string"; + }; + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if (ch == "/" && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + if (ctx.type == "case") ctx.type = "}"; + } + if (stream.eatSpace()) return null; + curPunc = null; + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + if (curPunc == "{") pushContext(state, stream.column(), "}"); + else if (curPunc == "[") pushContext(state, stream.column(), "]"); + else if (curPunc == "(") pushContext(state, stream.column(), ")"); + else if (curPunc == "case") ctx.type = "case" + else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state); + else if (curPunc == ctx.type) popContext(state); + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0); + if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) { + state.context.type = "}"; + return ctx.indented; + } + var closing = firstChar == ctx.type; + if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "{}:" + }; +}); + +CodeMirror.defineMIME("text/x-go", "go"); diff --git a/imports/codemirror/mode/go/index.html b/imports/codemirror/mode/go/index.html new file mode 100644 index 00000000..9cdad1ad --- /dev/null +++ b/imports/codemirror/mode/go/index.html @@ -0,0 +1,72 @@ + + + + CodeMirror: Go mode + + + + + + + + +

CodeMirror: Go mode

+ +
+ + + +

MIME type: text/x-go

+ + diff --git a/imports/codemirror/mode/groovy/groovy.js b/imports/codemirror/mode/groovy/groovy.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/groovy/index.html b/imports/codemirror/mode/groovy/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/haskell/haskell.js b/imports/codemirror/mode/haskell/haskell.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/haskell/index.html b/imports/codemirror/mode/haskell/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlembedded/htmlembedded.js b/imports/codemirror/mode/htmlembedded/htmlembedded.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlembedded/index.html b/imports/codemirror/mode/htmlembedded/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlmixed/htmlmixed.js b/imports/codemirror/mode/htmlmixed/htmlmixed.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/htmlmixed/index.html b/imports/codemirror/mode/htmlmixed/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/javascript/index.html b/imports/codemirror/mode/javascript/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/javascript/javascript.js b/imports/codemirror/mode/javascript/javascript.js old mode 100755 new mode 100644 index be2a0698..b9388bc9 --- a/imports/codemirror/mode/javascript/javascript.js +++ b/imports/codemirror/mode/javascript/javascript.js @@ -69,7 +69,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { else if (state.reAllowed) { nextUntilUnescaped(stream, "/"); stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla - return ret("regexp", "string"); + return ret("regexp", "string-2"); } else { stream.eatWhile(isOperatorChar); @@ -230,7 +230,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator); if (type == "function") return cont(functiondef); if (type == "keyword c") return cont(maybeexpression); - if (type == "(") return cont(pushlex(")"), expression, expect(")"), poplex, maybeoperator); + if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator); if (type == "operator") return cont(expression); if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator); if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator); diff --git a/imports/codemirror/mode/jinja2/index.html b/imports/codemirror/mode/jinja2/index.html old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/jinja2/jinja2.js b/imports/codemirror/mode/jinja2/jinja2.js old mode 100755 new mode 100644 diff --git a/imports/codemirror/mode/less/index.html b/imports/codemirror/mode/less/index.html new file mode 100644 index 00000000..bd3ef198 --- /dev/null +++ b/imports/codemirror/mode/less/index.html @@ -0,0 +1,588 @@ + + + + CodeMirror: LESS mode + + + + + + + + +

CodeMirror: LESS mode

+
+ + +

MIME types defined: text/less.

+ + diff --git a/imports/codemirror/mode/less/less.js b/imports/codemirror/mode/less/less.js new file mode 100644 index 00000000..dc584f02 --- /dev/null +++ b/imports/codemirror/mode/less/less.js @@ -0,0 +1,189 @@ +CodeMirror.defineMode("less", function(config) { + var indentUnit = config.indentUnit, type; + function ret(style, tp) {type = tp; return style;} + //html5 tags + var tags = ["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","command","datalist","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","keygen","kbd","label","legend","li","link","map","mark","menu","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr"]; + + function inTagsArray(val){ + for(var i=0; i*\/]/.test(ch)) {//removed . dot character original was [,.+>*\/] + return ret(null, "select-op"); + } + else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]] + if(ch == ":"){ + stream.eatWhile(/[active|hover|link|visited]/); + if( stream.current().match(/active|hover|link|visited/)){ + return ret("tag", "tag"); + }else{ + return ret(null, ch); + } + }else{ + return ret(null, ch); + } + } + else if (ch == ".") { // lesscss + stream.eatWhile(/[\a-zA-Z0-9\-_]/); + return ret("tag", "tag"); + } + else if (ch == "#") { // lesscss + stream.match(/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/); + if(stream.current().length >1){ + if(stream.current().match(/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/) != null){ + return ret("number", "unit"); + }else{ + stream.eatWhile(/[\w\-]/); + return ret("atom", "tag"); + } + }else{ + stream.eatWhile(/[\w\-]/); + return ret("atom", "tag"); + } + } + else if (ch == "&") { + stream.eatWhile(/[\w\-]/); + return ret(null, ch); + } + else { + stream.eatWhile(/[\w\\\-_.%]/); + if( stream.eat("(") ){ // lesscss + return ret(null, ch); + }else if( stream.current().match(/\-\d|\-.\d/) ){ // lesscss match e.g.: -5px -0.4 etc... + return ret("number", "unit"); + }else if( inTagsArray(stream.current()) ){ // lesscss match html tags + return ret("tag", "tag"); + }else if( (stream.peek() == ")" || stream.peek() == "/") && stream.current().indexOf('.') !== -1){ + return ret("string", "string");//let url(logo.png) without quotes and froward slash return as string + }else{ + return ret("variable", "variable"); + } + } + + } + + function tokenSComment(stream, state) {// SComment = Slash comment + stream.skipToEnd(); + state.tokenize = tokenBase; + return ret("comment", "comment"); + } + + function tokenCComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == "/") { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return ret("comment", "comment"); + } + + function tokenSGMLComment(stream, state) { + var dashes = 0, ch; + while ((ch = stream.next()) != null) { + if (dashes >= 2 && ch == ">") { + state.tokenize = tokenBase; + break; + } + dashes = (ch == "-") ? dashes + 1 : 0; + } + return ret("comment", "comment"); + } + + function tokenString(quote) { + return function(stream, state) { + var escaped = false, ch; + while ((ch = stream.next()) != null) { + if (ch == quote && !escaped) + break; + escaped = !escaped && ch == "\\"; + } + if (!escaped) state.tokenize = tokenBase; + return ret("string", "string"); + }; + } + + return { + startState: fu