You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2013/09/20 04:29:24 UTC
svn commit: r1524887 [17/34] - in /tomee/tomee/trunk/tomee: ./
tomee-webaccess/ tomee-webaccess/src/ tomee-webaccess/src/main/
tomee-webaccess/src/main/config/ tomee-webaccess/webaccess-gui-libs/
tomee-webaccess/webaccess-gui-libs/backbone/ tomee-webac...
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/haxe.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/haxe.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/haxe.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/haxe.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,429 @@
+CodeMirror.defineMode("haxe", function(config, parserConfig) {
+ var indentUnit = config.indentUnit;
+
+ // Tokenizer
+
+ var keywords = function(){
+ function kw(type) {return {type: type, style: "keyword"};}
+ var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
+ var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"};
+ var type = kw("typedef");
+ return {
+ "if": A, "while": A, "else": B, "do": B, "try": B,
+ "return": C, "break": C, "continue": C, "new": C, "throw": C,
+ "var": kw("var"), "inline":attribute, "static": attribute, "using":kw("import"),
+ "public": attribute, "private": attribute, "cast": kw("cast"), "import": kw("import"), "macro": kw("macro"),
+ "function": kw("function"), "catch": kw("catch"), "untyped": kw("untyped"), "callback": kw("cb"),
+ "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
+ "in": operator, "never": kw("property_access"), "trace":kw("trace"),
+ "class": type, "enum":type, "interface":type, "typedef":type, "extends":type, "implements":type, "dynamic":type,
+ "true": atom, "false": atom, "null": atom
+ };
+ }();
+
+ var isOperatorChar = /[+\-*&%=<>!?|]/;
+
+ function chain(stream, state, f) {
+ state.tokenize = f;
+ return f(stream, state);
+ }
+
+ function nextUntilUnescaped(stream, end) {
+ var escaped = false, next;
+ while ((next = stream.next()) != null) {
+ if (next == end && !escaped)
+ return false;
+ escaped = !escaped && next == "\\";
+ }
+ return escaped;
+ }
+
+ // Used as scratch variables to communicate multiple values without
+ // consing up tons of objects.
+ var type, content;
+ function ret(tp, style, cont) {
+ type = tp; content = cont;
+ return style;
+ }
+
+ function haxeTokenBase(stream, state) {
+ var ch = stream.next();
+ if (ch == '"' || ch == "'")
+ return chain(stream, state, haxeTokenString(ch));
+ else if (/[\[\]{}\(\),;\:\.]/.test(ch))
+ return ret(ch);
+ else if (ch == "0" && stream.eat(/x/i)) {
+ stream.eatWhile(/[\da-f]/i);
+ return ret("number", "number");
+ }
+ else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
+ stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
+ return ret("number", "number");
+ }
+ else if (state.reAllowed && (ch == "~" && stream.eat(/\//))) {
+ nextUntilUnescaped(stream, "/");
+ stream.eatWhile(/[gimsu]/);
+ return ret("regexp", "string-2");
+ }
+ else if (ch == "/") {
+ if (stream.eat("*")) {
+ return chain(stream, state, haxeTokenComment);
+ }
+ else if (stream.eat("/")) {
+ stream.skipToEnd();
+ return ret("comment", "comment");
+ }
+ else {
+ stream.eatWhile(isOperatorChar);
+ return ret("operator", null, stream.current());
+ }
+ }
+ else if (ch == "#") {
+ stream.skipToEnd();
+ return ret("conditional", "meta");
+ }
+ else if (ch == "@") {
+ stream.eat(/:/);
+ stream.eatWhile(/[\w_]/);
+ return ret ("metadata", "meta");
+ }
+ else if (isOperatorChar.test(ch)) {
+ stream.eatWhile(isOperatorChar);
+ return ret("operator", null, stream.current());
+ }
+ else {
+ var word;
+ if(/[A-Z]/.test(ch))
+ {
+ stream.eatWhile(/[\w_<>]/);
+ word = stream.current();
+ return ret("type", "variable-3", word);
+ }
+ else
+ {
+ stream.eatWhile(/[\w_]/);
+ var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
+ return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
+ ret("variable", "variable", word);
+ }
+ }
+ }
+
+ function haxeTokenString(quote) {
+ return function(stream, state) {
+ if (!nextUntilUnescaped(stream, quote))
+ state.tokenize = haxeTokenBase;
+ return ret("string", "string");
+ };
+ }
+
+ function haxeTokenComment(stream, state) {
+ var maybeEnd = false, ch;
+ while (ch = stream.next()) {
+ if (ch == "/" && maybeEnd) {
+ state.tokenize = haxeTokenBase;
+ break;
+ }
+ maybeEnd = (ch == "*");
+ }
+ return ret("comment", "comment");
+ }
+
+ // Parser
+
+ var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
+
+ function HaxeLexical(indented, column, type, align, prev, info) {
+ this.indented = indented;
+ this.column = column;
+ this.type = type;
+ this.prev = prev;
+ this.info = info;
+ if (align != null) this.align = align;
+ }
+
+ function inScope(state, varname) {
+ for (var v = state.localVars; v; v = v.next)
+ if (v.name == varname) return true;
+ }
+
+ function parseHaxe(state, style, type, content, stream) {
+ var cc = state.cc;
+ // Communicate our context to the combinators.
+ // (Less wasteful than consing up a hundred closures on every call.)
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
+
+ if (!state.lexical.hasOwnProperty("align"))
+ state.lexical.align = true;
+
+ while(true) {
+ var combinator = cc.length ? cc.pop() : statement;
+ if (combinator(type, content)) {
+ while(cc.length && cc[cc.length - 1].lex)
+ cc.pop()();
+ if (cx.marked) return cx.marked;
+ if (type == "variable" && inScope(state, content)) return "variable-2";
+ if (type == "variable" && imported(state, content)) return "variable-3";
+ return style;
+ }
+ }
+ }
+
+ function imported(state, typename)
+ {
+ if (/[a-z]/.test(typename.charAt(0)))
+ return false;
+ var len = state.importedtypes.length;
+ for (var i = 0; i<len; i++)
+ if(state.importedtypes[i]==typename) return true;
+ }
+
+
+ function registerimport(importname) {
+ var state = cx.state;
+ for (var t = state.importedtypes; t; t = t.next)
+ if(t.name == importname) return;
+ state.importedtypes = { name: importname, next: state.importedtypes };
+ }
+ // Combinator utils
+
+ var cx = {state: null, column: null, marked: null, cc: null};
+ function pass() {
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
+ }
+ function cont() {
+ pass.apply(null, arguments);
+ return true;
+ }
+ function register(varname) {
+ var state = cx.state;
+ if (state.context) {
+ cx.marked = "def";
+ for (var v = state.localVars; v; v = v.next)
+ if (v.name == varname) return;
+ state.localVars = {name: varname, next: state.localVars};
+ }
+ }
+
+ // Combinators
+
+ var defaultVars = {name: "this", next: null};
+ function pushcontext() {
+ if (!cx.state.context) cx.state.localVars = defaultVars;
+ cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
+ }
+ function popcontext() {
+ cx.state.localVars = cx.state.context.vars;
+ cx.state.context = cx.state.context.prev;
+ }
+ function pushlex(type, info) {
+ var result = function() {
+ var state = cx.state;
+ state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
+ };
+ result.lex = true;
+ return result;
+ }
+ function poplex() {
+ var state = cx.state;
+ if (state.lexical.prev) {
+ if (state.lexical.type == ")")
+ state.indented = state.lexical.indented;
+ state.lexical = state.lexical.prev;
+ }
+ }
+ poplex.lex = true;
+
+ function expect(wanted) {
+ return function(type) {
+ if (type == wanted) return cont();
+ else if (wanted == ";") return pass();
+ else return cont(arguments.callee);
+ };
+ }
+
+ function statement(type) {
+ if (type == "@") return cont(metadef);
+ if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
+ if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
+ if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
+ if (type == "{") return cont(pushlex("}"), pushcontext, block, poplex, popcontext);
+ if (type == ";") return cont();
+ if (type == "attribute") return cont(maybeattribute);
+ if (type == "function") return cont(functiondef);
+ if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
+ poplex, statement, poplex);
+ if (type == "variable") return cont(pushlex("stat"), maybelabel);
+ if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
+ block, poplex, poplex);
+ if (type == "case") return cont(expression, expect(":"));
+ if (type == "default") return cont(expect(":"));
+ if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
+ statement, poplex, popcontext);
+ if (type == "import") return cont(importdef, expect(";"));
+ if (type == "typedef") return cont(typedef);
+ return pass(pushlex("stat"), expression, expect(";"), poplex);
+ }
+ function expression(type) {
+ 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(")"), 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);
+ return cont();
+ }
+ function maybeexpression(type) {
+ if (type.match(/[;\}\)\],]/)) return pass();
+ return pass(expression);
+ }
+
+ function maybeoperator(type, value) {
+ if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
+ if (type == "operator" || type == ":") return cont(expression);
+ if (type == ";") return;
+ if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
+ if (type == ".") return cont(property, maybeoperator);
+ if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
+ }
+
+ function maybeattribute(type) {
+ if (type == "attribute") return cont(maybeattribute);
+ if (type == "function") return cont(functiondef);
+ if (type == "var") return cont(vardef1);
+ }
+
+ function metadef(type) {
+ if(type == ":") return cont(metadef);
+ if(type == "variable") return cont(metadef);
+ if(type == "(") return cont(pushlex(")"), comasep(metaargs, ")"), poplex, statement);
+ }
+ function metaargs(type) {
+ if(type == "variable") return cont();
+ }
+
+ function importdef (type, value) {
+ if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
+ else if(type == "variable" || type == "property" || type == ".") return cont(importdef);
+ }
+
+ function typedef (type, value)
+ {
+ if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
+ }
+
+ function maybelabel(type) {
+ if (type == ":") return cont(poplex, statement);
+ return pass(maybeoperator, expect(";"), poplex);
+ }
+ function property(type) {
+ if (type == "variable") {cx.marked = "property"; return cont();}
+ }
+ function objprop(type) {
+ if (type == "variable") cx.marked = "property";
+ if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
+ }
+ function commasep(what, end) {
+ function proceed(type) {
+ if (type == ",") return cont(what, proceed);
+ if (type == end) return cont();
+ return cont(expect(end));
+ }
+ return function(type) {
+ if (type == end) return cont();
+ else return pass(what, proceed);
+ };
+ }
+ function block(type) {
+ if (type == "}") return cont();
+ return pass(statement, block);
+ }
+ function vardef1(type, value) {
+ if (type == "variable"){register(value); return cont(typeuse, vardef2);}
+ return cont();
+ }
+ function vardef2(type, value) {
+ if (value == "=") return cont(expression, vardef2);
+ if (type == ",") return cont(vardef1);
+ }
+ function forspec1(type, value) {
+ if (type == "variable") {
+ register(value);
+ }
+ return cont(pushlex(")"), pushcontext, forin, expression, poplex, statement, popcontext);
+ }
+ function forin(_type, value) {
+ if (value == "in") return cont();
+ }
+ function functiondef(type, value) {
+ if (type == "variable") {register(value); return cont(functiondef);}
+ if (value == "new") return cont(functiondef);
+ if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, typeuse, statement, popcontext);
+ }
+ function typeuse(type) {
+ if(type == ":") return cont(typestring);
+ }
+ function typestring(type) {
+ if(type == "type") return cont();
+ if(type == "variable") return cont();
+ if(type == "{") return cont(pushlex("}"), commasep(typeprop, "}"), poplex);
+ }
+ function typeprop(type) {
+ if(type == "variable") return cont(typeuse);
+ }
+ function funarg(type, value) {
+ if (type == "variable") {register(value); return cont(typeuse);}
+ }
+
+ // Interface
+
+ return {
+ startState: function(basecolumn) {
+ var defaulttypes = ["Int", "Float", "String", "Void", "Std", "Bool", "Dynamic", "Array"];
+ return {
+ tokenize: haxeTokenBase,
+ reAllowed: true,
+ kwAllowed: true,
+ cc: [],
+ lexical: new HaxeLexical((basecolumn || 0) - indentUnit, 0, "block", false),
+ localVars: parserConfig.localVars,
+ importedtypes: defaulttypes,
+ context: parserConfig.localVars && {vars: parserConfig.localVars},
+ indented: 0
+ };
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ if (!state.lexical.hasOwnProperty("align"))
+ state.lexical.align = false;
+ state.indented = stream.indentation();
+ }
+ if (stream.eatSpace()) return null;
+ var style = state.tokenize(stream, state);
+ if (type == "comment") return style;
+ state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/));
+ state.kwAllowed = type != '.';
+ return parseHaxe(state, style, type, content, stream);
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize != haxeTokenBase) return 0;
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
+ if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
+ var type = lexical.type, closing = firstChar == type;
+ if (type == "vardef") return lexical.indented + 4;
+ else if (type == "form" && firstChar == "{") return lexical.indented;
+ else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
+ else if (lexical.info == "switch" && !closing)
+ return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
+ else if (lexical.align) return lexical.column + (closing ? 0 : 1);
+ else return lexical.indented + (closing ? 0 : indentUnit);
+ },
+
+ electricChars: "{}"
+ };
+});
+
+CodeMirror.defineMIME("text/x-haxe", "haxe");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haxe/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,103 @@
+<!doctype html>
+
+<title>CodeMirror: Haxe mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="haxe.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Haxe</a>
+ </ul>
+</div>
+
+<article>
+<h2>Haxe mode</h2>
+
+
+<div><textarea id="code" name="code">
+import one.two.Three;
+
+@attr("test")
+class Foo<T> extends Three
+{
+ public function new()
+ {
+ noFoo = 12;
+ }
+
+ public static inline function doFoo(obj:{k:Int, l:Float}):Int
+ {
+ for(i in 0...10)
+ {
+ obj.k++;
+ trace(i);
+ var var1 = new Array();
+ if(var1.length > 1)
+ throw "Error";
+ }
+ // The following line should not be colored, the variable is scoped out
+ var1;
+ /* Multi line
+ * Comment test
+ */
+ return obj.k;
+ }
+ private function bar():Void
+ {
+ #if flash
+ var t1:String = "1.21";
+ #end
+ try {
+ doFoo({k:3, l:1.2});
+ }
+ catch (e : String) {
+ trace(e);
+ }
+ var t2:Float = cast(3.2);
+ var t3:haxe.Timer = new haxe.Timer();
+ var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
+ var t5 = ~/123+.*$/i;
+ doFoo(t4);
+ untyped t1 = 4;
+ bob = new Foo<Int>
+ }
+ public var okFoo(default, never):Float;
+ var noFoo(getFoo, null):Int;
+ function getFoo():Int {
+ return noFoo;
+ }
+
+ public var three:Int;
+}
+enum Color
+{
+ red;
+ green;
+ blue;
+ grey( v : Int );
+ rgb (r:Int,g:Int,b:Int);
+}
+</textarea></div>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ indentUnit: 4,
+ indentWithTabs: true
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-haxe</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/htmlembedded.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/htmlembedded.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/htmlembedded.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/htmlembedded.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,73 @@
+CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
+
+ //config settings
+ var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
+ scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
+
+ //inner modes
+ var scriptingMode, htmlMixedMode;
+
+ //tokenizer when in html mode
+ function htmlDispatch(stream, state) {
+ if (stream.match(scriptStartRegex, false)) {
+ state.token=scriptingDispatch;
+ return scriptingMode.token(stream, state.scriptState);
+ }
+ else
+ return htmlMixedMode.token(stream, state.htmlState);
+ }
+
+ //tokenizer when in scripting mode
+ function scriptingDispatch(stream, state) {
+ if (stream.match(scriptEndRegex, false)) {
+ state.token=htmlDispatch;
+ return htmlMixedMode.token(stream, state.htmlState);
+ }
+ else
+ return scriptingMode.token(stream, state.scriptState);
+ }
+
+
+ return {
+ startState: function() {
+ scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
+ htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
+ return {
+ token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
+ htmlState : CodeMirror.startState(htmlMixedMode),
+ scriptState : CodeMirror.startState(scriptingMode)
+ };
+ },
+
+ token: function(stream, state) {
+ return state.token(stream, state);
+ },
+
+ indent: function(state, textAfter) {
+ if (state.token == htmlDispatch)
+ return htmlMixedMode.indent(state.htmlState, textAfter);
+ else if (scriptingMode.indent)
+ return scriptingMode.indent(state.scriptState, textAfter);
+ },
+
+ copyState: function(state) {
+ return {
+ token : state.token,
+ htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
+ scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
+ };
+ },
+
+ electricChars: "/{}:",
+
+ innerMode: function(state) {
+ if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
+ else return {state: state.htmlState, mode: htmlMixedMode};
+ }
+ };
+}, "htmlmixed");
+
+CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
+CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
+CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
+CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"});
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlembedded/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,60 @@
+<!doctype html>
+
+<title>CodeMirror: Html Embedded Scripts mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="htmlembedded.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Html Embedded Scripts</a>
+ </ul>
+</div>
+
+<article>
+<h2>Html Embedded Scripts mode</h2>
+<form><textarea id="code" name="code">
+<%
+function hello(who) {
+ return "Hello " + who;
+}
+%>
+This is an example of EJS (embedded javascript)
+<p>The program says <%= hello("world") %>.</p>
+<script>
+ alert("And here is some normal JS code"); // also colored
+</script>
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ mode: "application/x-ejs",
+ indentUnit: 4,
+ indentWithTabs: true,
+ enterMode: "keep",
+ tabMode: "shift"
+ });
+ </script>
+
+ <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
+ JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p>
+
+ <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
+ <code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/htmlmixed.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/htmlmixed.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/htmlmixed.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/htmlmixed.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,104 @@
+CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
+ var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
+ var cssMode = CodeMirror.getMode(config, "css");
+
+ var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes;
+ scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,
+ mode: CodeMirror.getMode(config, "javascript")});
+ if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) {
+ var conf = scriptTypesConf[i];
+ scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)});
+ }
+ scriptTypes.push({matches: /./,
+ mode: CodeMirror.getMode(config, "text/plain")});
+
+ function html(stream, state) {
+ var tagName = state.htmlState.tagName;
+ var style = htmlMode.token(stream, state.htmlState);
+ if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
+ // Script block: mode to change to depends on type attribute
+ var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);
+ scriptType = scriptType ? scriptType[1] : "";
+ if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1);
+ for (var i = 0; i < scriptTypes.length; ++i) {
+ var tp = scriptTypes[i];
+ if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) {
+ if (tp.mode) {
+ state.token = script;
+ state.localMode = tp.mode;
+ state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, ""));
+ }
+ break;
+ }
+ }
+ } else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") {
+ state.token = css;
+ state.localMode = cssMode;
+ state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
+ }
+ return style;
+ }
+ function maybeBackup(stream, pat, style) {
+ var cur = stream.current();
+ var close = cur.search(pat), m;
+ if (close > -1) stream.backUp(cur.length - close);
+ else if (m = cur.match(/<\/?$/)) {
+ stream.backUp(cur.length);
+ if (!stream.match(pat, false)) stream.match(cur[0]);
+ }
+ return style;
+ }
+ function script(stream, state) {
+ if (stream.match(/^<\/\s*script\s*>/i, false)) {
+ state.token = html;
+ state.localState = state.localMode = null;
+ return html(stream, state);
+ }
+ return maybeBackup(stream, /<\/\s*script\s*>/,
+ state.localMode.token(stream, state.localState));
+ }
+ function css(stream, state) {
+ if (stream.match(/^<\/\s*style\s*>/i, false)) {
+ state.token = html;
+ state.localState = state.localMode = null;
+ return html(stream, state);
+ }
+ return maybeBackup(stream, /<\/\s*style\s*>/,
+ cssMode.token(stream, state.localState));
+ }
+
+ return {
+ startState: function() {
+ var state = htmlMode.startState();
+ return {token: html, localMode: null, localState: null, htmlState: state};
+ },
+
+ copyState: function(state) {
+ if (state.localState)
+ var local = CodeMirror.copyState(state.localMode, state.localState);
+ return {token: state.token, localMode: state.localMode, localState: local,
+ htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
+ },
+
+ token: function(stream, state) {
+ return state.token(stream, state);
+ },
+
+ indent: function(state, textAfter) {
+ if (!state.localMode || /^\s*<\//.test(textAfter))
+ return htmlMode.indent(state.htmlState, textAfter);
+ else if (state.localMode.indent)
+ return state.localMode.indent(state.localState, textAfter);
+ else
+ return CodeMirror.Pass;
+ },
+
+ electricChars: "/{}:",
+
+ innerMode: function(state) {
+ return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
+ }
+ };
+}, "xml", "javascript", "css");
+
+CodeMirror.defineMIME("text/html", "htmlmixed");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/htmlmixed/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: HTML mixed mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../vbscript/vbscript.js"></script>
+<script src="htmlmixed.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">HTML mixed</a>
+ </ul>
+</div>
+
+<article>
+<h2>HTML mixed mode</h2>
+<form><textarea id="code" name="code">
+<html style="color: green">
+ <!-- this is a comment -->
+ <head>
+ <title>Mixed HTML Example</title>
+ <style type="text/css">
+ h1 {font-family: comic sans; color: #f0f;}
+ div {background: yellow !important;}
+ body {
+ max-width: 50em;
+ margin: 1em 2em 1em 5em;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>Mixed HTML Example</h1>
+ <script>
+ function jsFunc(arg1, arg2) {
+ if (arg1 && arg2) document.body.innerHTML = "achoo";
+ }
+ </script>
+ </body>
+</html>
+</textarea></form>
+ <script>
+ // Define an extended mixed-mode that understands vbscript and
+ // leaves mustache/handlebars embedded templates in html mode
+ var mixedMode = {
+ name: "htmlmixed",
+ scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
+ mode: null},
+ {matches: /(text|application)\/(x-)?vb(a|script)/i,
+ mode: "vbscript"}]
+ };
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: mixedMode, tabMode: "indent"});
+ </script>
+
+ <p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
+
+ <p>It takes an optional mode configuration
+ option, <code>scriptTypes</code>, which can be used to add custom
+ behavior for specific <code><script type="..."></code> tags. If
+ given, it should hold an array of <code>{matches, mode}</code>
+ objects, where <code>matches</code> is a string or regexp that
+ matches the script type, and <code>mode</code> is
+ either <code>null</code>, for script types that should stay in
+ HTML mode, or a <a href="../../doc/manual.html#option_mode">mode
+ spec</a> corresponding to the mode that should be used for the
+ script.</p>
+
+ <p><strong>MIME types defined:</strong> <code>text/html</code>
+ (redefined, only takes effect if you load this parser after the
+ XML parser).</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/http.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/http.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/http.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/http.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,98 @@
+CodeMirror.defineMode("http", function() {
+ function failFirstLine(stream, state) {
+ stream.skipToEnd();
+ state.cur = header;
+ return "error";
+ }
+
+ function start(stream, state) {
+ if (stream.match(/^HTTP\/\d\.\d/)) {
+ state.cur = responseStatusCode;
+ return "keyword";
+ } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) {
+ state.cur = requestPath;
+ return "keyword";
+ } else {
+ return failFirstLine(stream, state);
+ }
+ }
+
+ function responseStatusCode(stream, state) {
+ var code = stream.match(/^\d+/);
+ if (!code) return failFirstLine(stream, state);
+
+ state.cur = responseStatusText;
+ var status = Number(code[0]);
+ if (status >= 100 && status < 200) {
+ return "positive informational";
+ } else if (status >= 200 && status < 300) {
+ return "positive success";
+ } else if (status >= 300 && status < 400) {
+ return "positive redirect";
+ } else if (status >= 400 && status < 500) {
+ return "negative client-error";
+ } else if (status >= 500 && status < 600) {
+ return "negative server-error";
+ } else {
+ return "error";
+ }
+ }
+
+ function responseStatusText(stream, state) {
+ stream.skipToEnd();
+ state.cur = header;
+ return null;
+ }
+
+ function requestPath(stream, state) {
+ stream.eatWhile(/\S/);
+ state.cur = requestProtocol;
+ return "string-2";
+ }
+
+ function requestProtocol(stream, state) {
+ if (stream.match(/^HTTP\/\d\.\d$/)) {
+ state.cur = header;
+ return "keyword";
+ } else {
+ return failFirstLine(stream, state);
+ }
+ }
+
+ function header(stream) {
+ if (stream.sol() && !stream.eat(/[ \t]/)) {
+ if (stream.match(/^.*?:/)) {
+ return "atom";
+ } else {
+ stream.skipToEnd();
+ return "error";
+ }
+ } else {
+ stream.skipToEnd();
+ return "string";
+ }
+ }
+
+ function body(stream) {
+ stream.skipToEnd();
+ return null;
+ }
+
+ return {
+ token: function(stream, state) {
+ var cur = state.cur;
+ if (cur != header && cur != body && stream.eatSpace()) return null;
+ return cur(stream, state);
+ },
+
+ blankLine: function(state) {
+ state.cur = body;
+ },
+
+ startState: function() {
+ return {cur: start};
+ }
+ };
+});
+
+CodeMirror.defineMIME("message/http", "http");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/http/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,45 @@
+<!doctype html>
+
+<title>CodeMirror: HTTP mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="http.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">HTTP</a>
+ </ul>
+</div>
+
+<article>
+<h2>HTTP mode</h2>
+
+
+<div><textarea id="code" name="code">
+POST /somewhere HTTP/1.1
+Host: example.com
+If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
+Content-Type: application/x-www-form-urlencoded;
+ charset=utf-8
+User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
+
+This is the request body!
+</textarea></div>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>message/http</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,106 @@
+<!doctype html>
+
+<title>CodeMirror: Language Modes</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../index.html">Home</a>
+ <li><a href="../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a class=active href="#">Language modes</a>
+ </ul>
+</div>
+
+<article>
+
+<h2>Language modes</h2>
+
+<p>This is a list of every mode in the distribution. Each mode lives
+in a subdirectory of the <code>mode/</code> directory, and typically
+defines a single JavaScript file that implements the mode. Loading
+such file will make the language available to CodeMirror, through
+the <a href="manual.html#option_mode"><code>mode</code></a>
+option.</p>
+
+<div style="-webkit-columns: 100px 2; -moz-columns: 100px 2; columns: 100px 2;">
+ <ul>
+ <li><a href="apl/index.html">APL</a></li>
+ <li><a href="asterisk/index.html">Asterisk dialplan</a></li>
+ <li><a href="clike/index.html">C, C++, C#</a></li>
+ <li><a href="clojure/index.html">Clojure</a></li>
+ <li><a href="cobol/index.html">COBOL</a></li>
+ <li><a href="coffeescript/index.html">CoffeeScript</a></li>
+ <li><a href="commonlisp/index.html">Common Lisp</a></li>
+ <li><a href="css/index.html">CSS</a></li>
+ <li><a href="python/index.html">Cython</a></li>
+ <li><a href="d/index.html">D</a></li>
+ <li><a href="diff/index.html">diff</a></li>
+ <li><a href="ecl/index.html">ECL</a></li>
+ <li><a href="erlang/index.html">Erlang</a></li>
+ <li><a href="gas/index.html">Gas</a> (AT&T-style assembly)</li>
+ <li><a href="go/index.html">Go</a></li>
+ <li><a href="groovy/index.html">Groovy</a></li>
+ <li><a href="haml/index.html">HAML</a></li>
+ <li><a href="haskell/index.html">Haskell</a></li>
+ <li><a href="haxe/index.html">Haxe</a></li>
+ <li><a href="htmlembedded/index.html">HTML embedded scripts</a></li>
+ <li><a href="htmlmixed/index.html">HTML mixed-mode</a></li>
+ <li><a href="http/index.html">HTTP</a></li>
+ <li><a href="clike/index.html">Java</a></li>
+ <li><a href="jade/index.html">Jade</a></li>
+ <li><a href="javascript/index.html">JavaScript</a></li>
+ <li><a href="jinja2/index.html">Jinja2</a></li>
+ <li><a href="less/index.html">LESS</a></li>
+ <li><a href="livescript/index.html">LiveScript</a></li>
+ <li><a href="lua/index.html">Lua</a></li>
+ <li><a href="markdown/index.html">Markdown</a> (<a href="gfm/index.html">GitHub-flavour</a>)</li>
+ <li><a href="mirc/index.html">mIRC</a></li>
+ <li><a href="nginx/index.html">Nginx</a></li>
+ <li><a href="ntriples/index.html">NTriples</a></li>
+ <li><a href="ocaml/index.html">OCaml</a></li>
+ <li><a href="pascal/index.html">Pascal</a></li>
+ <li><a href="perl/index.html">Perl</a></li>
+ <li><a href="php/index.html">PHP</a></li>
+ <li><a href="pig/index.html">Pig Latin</a></li>
+ <li><a href="properties/index.html">Properties files</a></li>
+ <li><a href="python/index.html">Python</a></li>
+ <li><a href="q/index.html">Q</a></li>
+ <li><a href="r/index.html">R</a></li>
+ <li>RPM <a href="rpm/spec/index.html">spec</a> and <a href="rpm/changes/index.html">changelog</a></li>
+ <li><a href="rst/index.html">reStructuredText</a></li>
+ <li><a href="ruby/index.html">Ruby</a></li>
+ <li><a href="rust/index.html">Rust</a></li>
+ <li><a href="sass/index.html">Sass</a></li>
+ <li><a href="clike/scala.html">Scala</a></li>
+ <li><a href="scheme/index.html">Scheme</a></li>
+ <li><a href="css/scss.html">SCSS</a></li>
+ <li><a href="shell/index.html">Shell</a></li>
+ <li><a href="sieve/index.html">Sieve</a></li>
+ <li><a href="smalltalk/index.html">Smalltalk</a></li>
+ <li><a href="smarty/index.html">Smarty</a></li>
+ <li><a href="smartymixed/index.html">Smarty/HTML mixed</a></li>
+ <li><a href="sql/index.html">SQL</a> (several dialects)</li>
+ <li><a href="sparql/index.html">SPARQL</a></li>
+ <li><a href="stex/index.html">sTeX, LaTeX</a></li>
+ <li><a href="tcl/index.html">Tcl</a></li>
+ <li><a href="tiddlywiki/index.html">Tiddlywiki</a></li>
+ <li><a href="tiki/index.html">Tiki wiki</a></li>
+ <li><a href="turtle/index.html">Turtle</a></li>
+ <li><a href="vb/index.html">VB.NET</a></li>
+ <li><a href="vbscript/index.html">VBScript</a></li>
+ <li><a href="velocity/index.html">Velocity</a></li>
+ <li><a href="verilog/index.html">Verilog</a></li>
+ <li><a href="xml/index.html">XML/HTML</a></li>
+ <li><a href="xquery/index.html">XQuery</a></li>
+ <li><a href="yaml/index.html">YAML</a></li>
+ <li><a href="z80/index.html">Z80</a></li>
+ </ul>
+ </div>
+
+</article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,66 @@
+<!doctype html>
+
+<title>CodeMirror: Jade Templating Mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="jade.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Jade Templating Mode</a>
+ </ul>
+</div>
+
+<article>
+<h2>Jade Templating Mode</h2>
+<form><textarea id="code" name="code">
+doctype 5
+ html
+ head
+ title= "Jade Templating CodeMirror Mode Example"
+ link(rel='stylesheet', href='/css/bootstrap.min.css')
+ link(rel='stylesheet', href='/css/index.css')
+ script(type='text/javascript', src='/js/jquery-1.9.1.min.js')
+ script(type='text/javascript', src='/js/bootstrap.min.js')
+ body
+ div.header
+ h1 Welcome to this Example
+ div.spots
+ if locals.spots
+ each spot in spots
+ div.spot.well
+ div
+ if spot.logo
+ img.img-rounded.logo(src=spot.logo)
+ else
+ img.img-rounded.logo(src="img/placeholder.png")
+ h3
+ a(href=spot.hash) ##{spot.hash}
+ if spot.title
+ span.title #{spot.title}
+ if spot.desc
+ div #{spot.desc}
+ else
+ h3 There are no spots currently available.
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode: {name: "jade", alignCDATA: true},
+ lineNumbers: true
+ });
+ </script>
+ <h3>The Jade Templating Mode</h3>
+ <p> Created by Drew Bratcher. Managed as part of an Adobe Brackets extension at <a href="https://github.com/dbratcher/brackets-jade">https://github.com/dbratcher/brackets-jade</a>.</p>
+ <p><strong>MIME type defined:</strong> <code>text/x-jade</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/jade.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/jade.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/jade.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jade/jade.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,90 @@
+CodeMirror.defineMode("jade", function () {
+ var symbol_regex1 = /^(?:~|!|%|\^|\*|\+|=|\\|:|;|,|\/|\?|&|<|>|\|)/;
+ var open_paren_regex = /^(\(|\[)/;
+ var close_paren_regex = /^(\)|\])/;
+ var keyword_regex1 = /^(if|else|return|var|function|include|doctype|each)/;
+ var keyword_regex2 = /^(#|{|}|\.)/;
+ var keyword_regex3 = /^(in)/;
+ var html_regex1 = /^(html|head|title|meta|link|script|body|br|div|input|span|a|img)/;
+ var html_regex2 = /^(h1|h2|h3|h4|h5|p|strong|em)/;
+ return {
+ startState: function () {
+ return {
+ inString: false,
+ stringType: "",
+ beforeTag: true,
+ justMatchedKeyword: false,
+ afterParen: false
+ };
+ },
+ token: function (stream, state) {
+ //check for state changes
+ if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
+ state.stringType = stream.peek();
+ stream.next(); // Skip quote
+ state.inString = true; // Update state
+ }
+
+ //return state
+ if (state.inString) {
+ if (stream.skipTo(state.stringType)) { // Quote found on this line
+ stream.next(); // Skip quote
+ state.inString = false; // Clear flag
+ } else {
+ stream.skipToEnd(); // Rest of line is string
+ }
+ state.justMatchedKeyword = false;
+ return "string"; // Token style
+ } else if (stream.sol() && stream.eatSpace()) {
+ if (stream.match(keyword_regex1)) {
+ state.justMatchedKeyword = true;
+ stream.eatSpace();
+ return "keyword";
+ }
+ if (stream.match(html_regex1) || stream.match(html_regex2)) {
+ state.justMatchedKeyword = true;
+ return "variable";
+ }
+ } else if (stream.sol() && stream.match(keyword_regex1)) {
+ state.justMatchedKeyword = true;
+ stream.eatSpace();
+ return "keyword";
+ } else if (stream.sol() && (stream.match(html_regex1) || stream.match(html_regex2))) {
+ state.justMatchedKeyword = true;
+ return "variable";
+ } else if (stream.eatSpace()) {
+ state.justMatchedKeyword = false;
+ if (stream.match(keyword_regex3) && stream.eatSpace()) {
+ state.justMatchedKeyword = true;
+ return "keyword";
+ }
+ } else if (stream.match(symbol_regex1)) {
+ state.justMatchedKeyword = false;
+ return "atom";
+ } else if (stream.match(open_paren_regex)) {
+ state.afterParen = true;
+ state.justMatchedKeyword = true;
+ return "def";
+ } else if (stream.match(close_paren_regex)) {
+ state.afterParen = false;
+ state.justMatchedKeyword = true;
+ return "def";
+ } else if (stream.match(keyword_regex2)) {
+ state.justMatchedKeyword = true;
+ return "keyword";
+ } else if (stream.eatSpace()) {
+ state.justMatchedKeyword = false;
+ } else {
+ stream.next();
+ if (state.justMatchedKeyword) {
+ return "property";
+ } else if (state.afterParen) {
+ return "property";
+ }
+ }
+ return null;
+ }
+ };
+});
+
+CodeMirror.defineMIME('text/x-jade', 'jade');
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,107 @@
+<!doctype html>
+
+<title>CodeMirror: JavaScript mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../../addon/comment/continuecomment.js"></script>
+<script src="../../addon/comment/comment.js"></script>
+<script src="javascript.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">JavaScript</a>
+ </ul>
+</div>
+
+<article>
+<h2>JavaScript mode</h2>
+
+
+<div><textarea id="code" name="code">
+// Demo code (the actual new parser character stream implementation)
+
+function StringStream(string) {
+ this.pos = 0;
+ this.string = string;
+}
+
+StringStream.prototype = {
+ done: function() {return this.pos >= this.string.length;},
+ peek: function() {return this.string.charAt(this.pos);},
+ next: function() {
+ if (this.pos < this.string.length)
+ return this.string.charAt(this.pos++);
+ },
+ eat: function(match) {
+ var ch = this.string.charAt(this.pos);
+ if (typeof match == "string") var ok = ch == match;
+ else var ok = ch && match.test ? match.test(ch) : match(ch);
+ if (ok) {this.pos++; return ch;}
+ },
+ eatWhile: function(match) {
+ var start = this.pos;
+ while (this.eat(match));
+ if (this.pos > start) return this.string.slice(start, this.pos);
+ },
+ backUp: function(n) {this.pos -= n;},
+ column: function() {return this.pos;},
+ eatSpace: function() {
+ var start = this.pos;
+ while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
+ return this.pos - start;
+ },
+ match: function(pattern, consume, caseInsensitive) {
+ if (typeof pattern == "string") {
+ function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
+ if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
+ if (consume !== false) this.pos += str.length;
+ return true;
+ }
+ }
+ else {
+ var match = this.string.slice(this.pos).match(pattern);
+ if (match && consume !== false) this.pos += match[0].length;
+ return match;
+ }
+ }
+};
+</textarea></div>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ continueComments: "Enter",
+ extraKeys: {"Ctrl-Q": "toggleComment"}
+ });
+ </script>
+
+ <p>
+ JavaScript mode supports a two configuration
+ options:
+ <ul>
+ <li><code>json</code> which will set the mode to expect JSON
+ data rather than a JavaScript program.</li>
+ <li><code>typescript</code> which will activate additional
+ syntax highlighting and some other things for TypeScript code
+ (<a href="typescript.html">demo</a>).</li>
+ <li><code>statementIndent</code> which (given a number) will
+ determine the amount of indentation to use for statements
+ continued on a new line.</li>
+ </ul>
+ </p>
+
+ <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/javascript.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/javascript.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/javascript.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/javascript.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,480 @@
+// TODO actually recognize syntax of TypeScript constructs
+
+CodeMirror.defineMode("javascript", function(config, parserConfig) {
+ var indentUnit = config.indentUnit;
+ var statementIndent = parserConfig.statementIndent;
+ var jsonMode = parserConfig.json;
+ var isTS = parserConfig.typescript;
+
+ // Tokenizer
+
+ var keywords = function(){
+ function kw(type) {return {type: type, style: "keyword"};}
+ var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
+ var operator = kw("operator"), atom = {type: "atom", style: "atom"};
+
+ var jsKeywords = {
+ "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
+ "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
+ "var": kw("var"), "const": kw("var"), "let": kw("var"),
+ "function": kw("function"), "catch": kw("catch"),
+ "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
+ "in": operator, "typeof": operator, "instanceof": operator,
+ "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
+ "this": kw("this")
+ };
+
+ // Extend the 'normal' keywords with the TypeScript language extensions
+ if (isTS) {
+ var type = {type: "variable", style: "variable-3"};
+ var tsKeywords = {
+ // object-like things
+ "interface": kw("interface"),
+ "class": kw("class"),
+ "extends": kw("extends"),
+ "constructor": kw("constructor"),
+
+ // scope modifiers
+ "public": kw("public"),
+ "private": kw("private"),
+ "protected": kw("protected"),
+ "static": kw("static"),
+
+ "super": kw("super"),
+
+ // types
+ "string": type, "number": type, "bool": type, "any": type
+ };
+
+ for (var attr in tsKeywords) {
+ jsKeywords[attr] = tsKeywords[attr];
+ }
+ }
+
+ return jsKeywords;
+ }();
+
+ var isOperatorChar = /[+\-*&%=<>!?|~^]/;
+
+ function chain(stream, state, f) {
+ state.tokenize = f;
+ return f(stream, state);
+ }
+
+ function nextUntilUnescaped(stream, end) {
+ var escaped = false, next;
+ while ((next = stream.next()) != null) {
+ if (next == end && !escaped)
+ return false;
+ escaped = !escaped && next == "\\";
+ }
+ return escaped;
+ }
+
+ // Used as scratch variables to communicate multiple values without
+ // consing up tons of objects.
+ var type, content;
+ function ret(tp, style, cont) {
+ type = tp; content = cont;
+ return style;
+ }
+ function jsTokenBase(stream, state) {
+ var ch = stream.next();
+ if (ch == '"' || ch == "'")
+ return chain(stream, state, jsTokenString(ch));
+ else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/))
+ return ret("number", "number");
+ else if (/[\[\]{}\(\),;\:\.]/.test(ch))
+ return ret(ch);
+ else if (ch == "0" && stream.eat(/x/i)) {
+ stream.eatWhile(/[\da-f]/i);
+ return ret("number", "number");
+ }
+ else if (/\d/.test(ch)) {
+ stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
+ return ret("number", "number");
+ }
+ else if (ch == "/") {
+ if (stream.eat("*")) {
+ return chain(stream, state, jsTokenComment);
+ }
+ else if (stream.eat("/")) {
+ stream.skipToEnd();
+ return ret("comment", "comment");
+ }
+ else if (state.lastType == "operator" || state.lastType == "keyword c" ||
+ /^[\[{}\(,;:]$/.test(state.lastType)) {
+ nextUntilUnescaped(stream, "/");
+ stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
+ return ret("regexp", "string-2");
+ }
+ else {
+ stream.eatWhile(isOperatorChar);
+ return ret("operator", null, stream.current());
+ }
+ }
+ else if (ch == "#") {
+ stream.skipToEnd();
+ return ret("error", "error");
+ }
+ else if (isOperatorChar.test(ch)) {
+ stream.eatWhile(isOperatorChar);
+ return ret("operator", null, stream.current());
+ }
+ else {
+ stream.eatWhile(/[\w\$_]/);
+ var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
+ return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
+ ret("variable", "variable", word);
+ }
+ }
+
+ function jsTokenString(quote) {
+ return function(stream, state) {
+ if (!nextUntilUnescaped(stream, quote))
+ state.tokenize = jsTokenBase;
+ return ret("string", "string");
+ };
+ }
+
+ function jsTokenComment(stream, state) {
+ var maybeEnd = false, ch;
+ while (ch = stream.next()) {
+ if (ch == "/" && maybeEnd) {
+ state.tokenize = jsTokenBase;
+ break;
+ }
+ maybeEnd = (ch == "*");
+ }
+ return ret("comment", "comment");
+ }
+
+ // Parser
+
+ var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true};
+
+ function JSLexical(indented, column, type, align, prev, info) {
+ this.indented = indented;
+ this.column = column;
+ this.type = type;
+ this.prev = prev;
+ this.info = info;
+ if (align != null) this.align = align;
+ }
+
+ function inScope(state, varname) {
+ for (var v = state.localVars; v; v = v.next)
+ if (v.name == varname) return true;
+ }
+
+ function parseJS(state, style, type, content, stream) {
+ var cc = state.cc;
+ // Communicate our context to the combinators.
+ // (Less wasteful than consing up a hundred closures on every call.)
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
+
+ if (!state.lexical.hasOwnProperty("align"))
+ state.lexical.align = true;
+
+ while(true) {
+ var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
+ if (combinator(type, content)) {
+ while(cc.length && cc[cc.length - 1].lex)
+ cc.pop()();
+ if (cx.marked) return cx.marked;
+ if (type == "variable" && inScope(state, content)) return "variable-2";
+ return style;
+ }
+ }
+ }
+
+ // Combinator utils
+
+ var cx = {state: null, column: null, marked: null, cc: null};
+ function pass() {
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
+ }
+ function cont() {
+ pass.apply(null, arguments);
+ return true;
+ }
+ function register(varname) {
+ function inList(list) {
+ for (var v = list; v; v = v.next)
+ if (v.name == varname) return true;
+ return false;
+ }
+ var state = cx.state;
+ if (state.context) {
+ cx.marked = "def";
+ if (inList(state.localVars)) return;
+ state.localVars = {name: varname, next: state.localVars};
+ } else {
+ if (inList(state.globalVars)) return;
+ state.globalVars = {name: varname, next: state.globalVars};
+ }
+ }
+
+ // Combinators
+
+ var defaultVars = {name: "this", next: {name: "arguments"}};
+ function pushcontext() {
+ cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
+ cx.state.localVars = defaultVars;
+ }
+ function popcontext() {
+ cx.state.localVars = cx.state.context.vars;
+ cx.state.context = cx.state.context.prev;
+ }
+ function pushlex(type, info) {
+ var result = function() {
+ var state = cx.state, indent = state.indented;
+ if (state.lexical.type == "stat") indent = state.lexical.indented;
+ state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
+ };
+ result.lex = true;
+ return result;
+ }
+ function poplex() {
+ var state = cx.state;
+ if (state.lexical.prev) {
+ if (state.lexical.type == ")")
+ state.indented = state.lexical.indented;
+ state.lexical = state.lexical.prev;
+ }
+ }
+ poplex.lex = true;
+
+ function expect(wanted) {
+ return function(type) {
+ if (type == wanted) return cont();
+ else if (wanted == ";") return pass();
+ else return cont(arguments.callee);
+ };
+ }
+
+ function statement(type) {
+ if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
+ if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
+ if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
+ if (type == "{") return cont(pushlex("}"), block, poplex);
+ if (type == ";") return cont();
+ if (type == "if") return cont(pushlex("form"), expression, statement, poplex, maybeelse);
+ if (type == "function") return cont(functiondef);
+ if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
+ poplex, statement, poplex);
+ if (type == "variable") return cont(pushlex("stat"), maybelabel);
+ if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
+ block, poplex, poplex);
+ if (type == "case") return cont(expression, expect(":"));
+ if (type == "default") return cont(expect(":"));
+ if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
+ statement, poplex, popcontext);
+ return pass(pushlex("stat"), expression, expect(";"), poplex);
+ }
+ function expression(type) {
+ return expressionInner(type, false);
+ }
+ function expressionNoComma(type) {
+ return expressionInner(type, true);
+ }
+ function expressionInner(type, noComma) {
+ var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
+ if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
+ if (type == "function") return cont(functiondef);
+ if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
+ if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
+ if (type == "operator") return cont(noComma ? expressionNoComma : expression);
+ if (type == "[") return cont(pushlex("]"), commasep(expressionNoComma, "]"), poplex, maybeop);
+ if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeop);
+ return cont();
+ }
+ function maybeexpression(type) {
+ if (type.match(/[;\}\)\],]/)) return pass();
+ return pass(expression);
+ }
+ function maybeexpressionNoComma(type) {
+ if (type.match(/[;\}\)\],]/)) return pass();
+ return pass(expressionNoComma);
+ }
+
+ function maybeoperatorComma(type, value) {
+ if (type == ",") return cont(expression);
+ return maybeoperatorNoComma(type, value, false);
+ }
+ function maybeoperatorNoComma(type, value, noComma) {
+ var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
+ var expr = noComma == false ? expression : expressionNoComma;
+ if (type == "operator") {
+ if (/\+\+|--/.test(value)) return cont(me);
+ if (value == "?") return cont(expression, expect(":"), expr);
+ return cont(expr);
+ }
+ if (type == ";") return;
+ if (type == "(") return cont(pushlex(")", "call"), commasep(expressionNoComma, ")"), poplex, me);
+ if (type == ".") return cont(property, me);
+ if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
+ }
+ function maybelabel(type) {
+ if (type == ":") return cont(poplex, statement);
+ return pass(maybeoperatorComma, expect(";"), poplex);
+ }
+ function property(type) {
+ if (type == "variable") {cx.marked = "property"; return cont();}
+ }
+ function objprop(type, value) {
+ if (type == "variable") {
+ cx.marked = "property";
+ if (value == "get" || value == "set") return cont(getterSetter);
+ } else if (type == "number" || type == "string") {
+ cx.marked = type + " property";
+ }
+ if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expressionNoComma);
+ }
+ function getterSetter(type) {
+ if (type == ":") return cont(expression);
+ if (type != "variable") return cont(expect(":"), expression);
+ cx.marked = "property";
+ return cont(functiondef);
+ }
+ function commasep(what, end) {
+ function proceed(type) {
+ if (type == ",") {
+ var lex = cx.state.lexical;
+ if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
+ return cont(what, proceed);
+ }
+ if (type == end) return cont();
+ return cont(expect(end));
+ }
+ return function(type) {
+ if (type == end) return cont();
+ else return pass(what, proceed);
+ };
+ }
+ function block(type) {
+ if (type == "}") return cont();
+ return pass(statement, block);
+ }
+ function maybetype(type) {
+ if (type == ":") return cont(typedef);
+ return pass();
+ }
+ function typedef(type) {
+ if (type == "variable"){cx.marked = "variable-3"; return cont();}
+ return pass();
+ }
+ function vardef1(type, value) {
+ if (type == "variable") {
+ register(value);
+ return isTS ? cont(maybetype, vardef2) : cont(vardef2);
+ }
+ return pass();
+ }
+ function vardef2(type, value) {
+ if (value == "=") return cont(expressionNoComma, vardef2);
+ if (type == ",") return cont(vardef1);
+ }
+ function maybeelse(type, value) {
+ if (type == "keyword b" && value == "else") return cont(pushlex("form"), statement, poplex);
+ }
+ function forspec1(type) {
+ if (type == "var") return cont(vardef1, expect(";"), forspec2);
+ if (type == ";") return cont(forspec2);
+ if (type == "variable") return cont(formaybein);
+ return pass(expression, expect(";"), forspec2);
+ }
+ function formaybein(_type, value) {
+ if (value == "in") return cont(expression);
+ return cont(maybeoperatorComma, forspec2);
+ }
+ function forspec2(type, value) {
+ if (type == ";") return cont(forspec3);
+ if (value == "in") return cont(expression);
+ return pass(expression, expect(";"), forspec3);
+ }
+ function forspec3(type) {
+ if (type != ")") cont(expression);
+ }
+ function functiondef(type, value) {
+ if (type == "variable") {register(value); return cont(functiondef);}
+ if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
+ }
+ function funarg(type, value) {
+ if (type == "variable") {register(value); return isTS ? cont(maybetype) : cont();}
+ }
+
+ // Interface
+
+ return {
+ startState: function(basecolumn) {
+ return {
+ tokenize: jsTokenBase,
+ lastType: null,
+ cc: [],
+ lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
+ localVars: parserConfig.localVars,
+ globalVars: parserConfig.globalVars,
+ context: parserConfig.localVars && {vars: parserConfig.localVars},
+ indented: 0
+ };
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ if (!state.lexical.hasOwnProperty("align"))
+ state.lexical.align = false;
+ state.indented = stream.indentation();
+ }
+ if (state.tokenize != jsTokenComment && stream.eatSpace()) return null;
+ var style = state.tokenize(stream, state);
+ if (type == "comment") return style;
+ state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
+ return parseJS(state, style, type, content, stream);
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize == jsTokenComment) return CodeMirror.Pass;
+ if (state.tokenize != jsTokenBase) return 0;
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
+ // Kludge to prevent 'maybelse' from blocking lexical scope pops
+ for (var i = state.cc.length - 1; i >= 0; --i) {
+ var c = state.cc[i];
+ if (c == poplex) lexical = lexical.prev;
+ else if (c != maybeelse || /^else\b/.test(textAfter)) break;
+ }
+ if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
+ if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
+ lexical = lexical.prev;
+ var type = lexical.type, closing = firstChar == type;
+
+ if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0);
+ else if (type == "form" && firstChar == "{") return lexical.indented;
+ else if (type == "form") return lexical.indented + indentUnit;
+ else if (type == "stat")
+ return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? statementIndent || indentUnit : 0);
+ else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
+ return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
+ else if (lexical.align) return lexical.column + (closing ? 0 : 1);
+ else return lexical.indented + (closing ? 0 : indentUnit);
+ },
+
+ electricChars: ":{}",
+ blockCommentStart: jsonMode ? null : "/*",
+ blockCommentEnd: jsonMode ? null : "*/",
+ lineComment: jsonMode ? null : "//",
+ fold: "brace",
+
+ helperType: jsonMode ? "json" : "javascript",
+ jsonMode: jsonMode
+ };
+});
+
+CodeMirror.defineMIME("text/javascript", "javascript");
+CodeMirror.defineMIME("text/ecmascript", "javascript");
+CodeMirror.defineMIME("application/javascript", "javascript");
+CodeMirror.defineMIME("application/ecmascript", "javascript");
+CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
+CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
+CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
+CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/test.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/test.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/test.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/test.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,10 @@
+(function() {
+ var mode = CodeMirror.getMode({indentUnit: 2}, "javascript");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("locals",
+ "[keyword function] [variable foo]([def a], [def b]) { [keyword var] [def c] = [number 10]; [keyword return] [variable-2 a] + [variable-2 c] + [variable d]; }");
+
+ MT("comma-and-binop",
+ "[keyword function](){ [keyword var] [def x] = [number 1] + [number 2], [def y]; }");
+})();
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/typescript.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/typescript.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/typescript.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/javascript/typescript.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,61 @@
+<!doctype html>
+
+<title>CodeMirror: TypeScript mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="javascript.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">TypeScript</a>
+ </ul>
+</div>
+
+<article>
+<h2>TypeScript mode</h2>
+
+
+<div><textarea id="code" name="code">
+class Greeter {
+ greeting: string;
+ constructor (message: string) {
+ this.greeting = message;
+ }
+ greet() {
+ return "Hello, " + this.greeting;
+ }
+}
+
+var greeter = new Greeter("world");
+
+var button = document.createElement('button')
+button.innerText = "Say Hello"
+button.onclick = function() {
+ alert(greeter.greet())
+}
+
+document.body.appendChild(button)
+
+</textarea></div>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/typescript"
+ });
+ </script>
+
+ <p>This is a specialization of the <a href="index.html">JavaScript mode</a>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/index.html
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/index.html?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,50 @@
+<!doctype html>
+
+<title>CodeMirror: Jinja2 mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="jinja2.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/marijnh/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Jinja2</a>
+ </ul>
+</div>
+
+<article>
+<h2>Jinja2 mode</h2>
+<form><textarea id="code" name="code">
+<html style="color: green">
+ <!-- this is a comment -->
+ <head>
+ <title>Jinja2 Example</title>
+ </head>
+ <body>
+ <ul>
+ {# this is a comment #}
+ {%- for item in li -%}
+ <li>
+ {{ item.label }}
+ </li>
+ {% endfor -%}
+ </ul>
+ </body>
+</html>
+</textarea></form>
+ <script>
+ var editor =
+ CodeMirror.fromTextArea(document.getElementById("code"), {mode:
+ {name: "jinja2", htmlMode: true}});
+ </script>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/jinja2.js
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/jinja2.js?rev=1524887&view=auto
==============================================================================
--- tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/jinja2.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/jinja2/jinja2.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,42 @@
+CodeMirror.defineMode("jinja2", function() {
+ var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
+ "loop", "none", "self", "super", "if", "as", "not", "and",
+ "else", "import", "with", "without", "context"];
+ keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
+
+ function tokenBase (stream, state) {
+ var ch = stream.next();
+ if (ch == "{") {
+ if (ch = stream.eat(/\{|%|#/)) {
+ stream.eat("-");
+ state.tokenize = inTag(ch);
+ return "tag";
+ }
+ }
+ }
+ function inTag (close) {
+ if (close == "{") {
+ close = "}";
+ }
+ return function (stream, state) {
+ var ch = stream.next();
+ if ((ch == close || (ch == "-" && stream.eat(close)))
+ && stream.eat("}")) {
+ state.tokenize = tokenBase;
+ return "tag";
+ }
+ if (stream.match(keywords)) {
+ return "keyword";
+ }
+ return close == "#" ? "comment" : "string";
+ };
+ }
+ return {
+ startState: function () {
+ return {tokenize: tokenBase};
+ },
+ token: function (stream, state) {
+ return state.tokenize(stream, state);
+ }
+ };
+});