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 [16/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/erlang/erlang.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/erlang/erlang.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/erlang/erlang.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/erlang/erlang.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,484 @@
+// block; "begin", "case", "fun", "if", "receive", "try": closed by "end"
+// block internal; "after", "catch", "of"
+// guard; "when", closed by "->"
+// "->" opens a clause, closed by ";" or "."
+// "<<" opens a binary, closed by ">>"
+// "," appears in arglists, lists, tuples and terminates lines of code
+// "." resets indentation to 0
+// obsolete; "cond", "let", "query"
+
+CodeMirror.defineMIME("text/x-erlang", "erlang");
+
+CodeMirror.defineMode("erlang", function(cmCfg) {
+
+ function rval(state,_stream,type) {
+ // distinguish between "." as terminator and record field operator
+ state.in_record = (type == "record");
+
+ // erlang -> CodeMirror tag
+ switch (type) {
+ case "atom": return "atom";
+ case "attribute": return "attribute";
+ case "boolean": return "special";
+ case "builtin": return "builtin";
+ case "comment": return "comment";
+ case "fun": return "meta";
+ case "function": return "tag";
+ case "guard": return "property";
+ case "keyword": return "keyword";
+ case "macro": return "variable-2";
+ case "number": return "number";
+ case "operator": return "operator";
+ case "record": return "bracket";
+ case "string": return "string";
+ case "type": return "def";
+ case "variable": return "variable";
+ case "error": return "error";
+ case "separator": return null;
+ case "open_paren": return null;
+ case "close_paren": return null;
+ default: return null;
+ }
+ }
+
+ var typeWords = [
+ "-type", "-spec", "-export_type", "-opaque"];
+
+ var keywordWords = [
+ "after","begin","catch","case","cond","end","fun","if",
+ "let","of","query","receive","try","when"];
+
+ var separatorRE = /[\->\.,:;]/;
+ var separatorWords = [
+ "->",";",":",".",","];
+
+ var operatorWords = [
+ "and","andalso","band","bnot","bor","bsl","bsr","bxor",
+ "div","not","or","orelse","rem","xor"];
+
+ var symbolRE = /[\+\-\*\/<>=\|:!]/;
+ var symbolWords = [
+ "+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"];
+
+ var openParenRE = /[<\(\[\{]/;
+ var openParenWords = [
+ "<<","(","[","{"];
+
+ var closeParenRE = /[>\)\]\}]/;
+ var closeParenWords = [
+ "}","]",")",">>"];
+
+ var guardWords = [
+ "is_atom","is_binary","is_bitstring","is_boolean","is_float",
+ "is_function","is_integer","is_list","is_number","is_pid",
+ "is_port","is_record","is_reference","is_tuple",
+ "atom","binary","bitstring","boolean","function","integer","list",
+ "number","pid","port","record","reference","tuple"];
+
+ var bifWords = [
+ "abs","adler32","adler32_combine","alive","apply","atom_to_binary",
+ "atom_to_list","binary_to_atom","binary_to_existing_atom",
+ "binary_to_list","binary_to_term","bit_size","bitstring_to_list",
+ "byte_size","check_process_code","contact_binary","crc32",
+ "crc32_combine","date","decode_packet","delete_module",
+ "disconnect_node","element","erase","exit","float","float_to_list",
+ "garbage_collect","get","get_keys","group_leader","halt","hd",
+ "integer_to_list","internal_bif","iolist_size","iolist_to_binary",
+ "is_alive","is_atom","is_binary","is_bitstring","is_boolean",
+ "is_float","is_function","is_integer","is_list","is_number","is_pid",
+ "is_port","is_process_alive","is_record","is_reference","is_tuple",
+ "length","link","list_to_atom","list_to_binary","list_to_bitstring",
+ "list_to_existing_atom","list_to_float","list_to_integer",
+ "list_to_pid","list_to_tuple","load_module","make_ref","module_loaded",
+ "monitor_node","node","node_link","node_unlink","nodes","notalive",
+ "now","open_port","pid_to_list","port_close","port_command",
+ "port_connect","port_control","pre_loaded","process_flag",
+ "process_info","processes","purge_module","put","register",
+ "registered","round","self","setelement","size","spawn","spawn_link",
+ "spawn_monitor","spawn_opt","split_binary","statistics",
+ "term_to_binary","time","throw","tl","trunc","tuple_size",
+ "tuple_to_list","unlink","unregister","whereis"];
+
+// [Ã-Ã] [Ã-Ã]
+// [Ã-ö] [ø-ÿ]
+ var anumRE = /[\w@Ã-ÃÃ-ÃÃ-öø-ÿ]/;
+ var escapesRE =
+ /[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;
+
+ function tokenize(stream, state) {
+
+ // in multi-line string
+ if (state.in_string) {
+ state.in_string = (!doubleQuote(stream));
+ return rval(state,stream,"string");
+ }
+
+ // in multi-line atom
+ if (state.in_atom) {
+ state.in_atom = (!singleQuote(stream));
+ return rval(state,stream,"atom");
+ }
+
+ // whitespace
+ if (stream.eatSpace()) {
+ return rval(state,stream,"whitespace");
+ }
+
+ // attributes and type specs
+ if ((peekToken(state).token == "") &&
+ stream.match(/-\s*[a-zÃ-öø-ÿ][\wÃ-ÃÃ-ÃÃ-öø-ÿ]*/)) {
+ if (isMember(stream.current(),typeWords)) {
+ return rval(state,stream,"type");
+ }else{
+ return rval(state,stream,"attribute");
+ }
+ }
+
+ var ch = stream.next();
+
+ // comment
+ if (ch == '%') {
+ stream.skipToEnd();
+ return rval(state,stream,"comment");
+ }
+
+ // macro
+ if (ch == '?') {
+ stream.eatWhile(anumRE);
+ return rval(state,stream,"macro");
+ }
+
+ // record
+ if (ch == "#") {
+ stream.eatWhile(anumRE);
+ return rval(state,stream,"record");
+ }
+
+ // dollar escape
+ if ( ch == "$" ) {
+ if (stream.next() == "\\" && !stream.match(escapesRE)) {
+ return rval(state,stream,"error");
+ }
+ return rval(state,stream,"number");
+ }
+
+ // quoted atom
+ if (ch == '\'') {
+ if (!(state.in_atom = (!singleQuote(stream)))) {
+ if (stream.match(/\s*\/\s*[0-9]/,false)) {
+ stream.match(/\s*\/\s*[0-9]/,true);
+ popToken(state);
+ return rval(state,stream,"fun"); // 'f'/0 style fun
+ }
+ if (stream.match(/\s*\(/,false) || stream.match(/\s*:/,false)) {
+ return rval(state,stream,"function");
+ }
+ }
+ return rval(state,stream,"atom");
+ }
+
+ // string
+ if (ch == '"') {
+ state.in_string = (!doubleQuote(stream));
+ return rval(state,stream,"string");
+ }
+
+ // variable
+ if (/[A-Z_Ã-ÃÃ-Ã]/.test(ch)) {
+ stream.eatWhile(anumRE);
+ return rval(state,stream,"variable");
+ }
+
+ // atom/keyword/BIF/function
+ if (/[a-z_Ã-öø-ÿ]/.test(ch)) {
+ stream.eatWhile(anumRE);
+
+ if (stream.match(/\s*\/\s*[0-9]/,false)) {
+ stream.match(/\s*\/\s*[0-9]/,true);
+ popToken(state);
+ return rval(state,stream,"fun"); // f/0 style fun
+ }
+
+ var w = stream.current();
+
+ if (isMember(w,keywordWords)) {
+ pushToken(state,stream);
+ return rval(state,stream,"keyword");
+ }else if (stream.match(/\s*\(/,false)) {
+ // 'put' and 'erlang:put' are bifs, 'foo:put' is not
+ if (isMember(w,bifWords) &&
+ (!isPrev(stream,":") || isPrev(stream,"erlang:"))) {
+ return rval(state,stream,"builtin");
+ }else if (isMember(w,guardWords)) {
+ return rval(state,stream,"guard");
+ }else{
+ return rval(state,stream,"function");
+ }
+ }else if (isMember(w,operatorWords)) {
+ return rval(state,stream,"operator");
+ }else if (stream.match(/\s*:/,false)) {
+ if (w == "erlang") {
+ return rval(state,stream,"builtin");
+ } else {
+ return rval(state,stream,"function");
+ }
+ }else if (isMember(w,["true","false"])) {
+ return rval(state,stream,"boolean");
+ }else{
+ return rval(state,stream,"atom");
+ }
+ }
+
+ // number
+ var digitRE = /[0-9]/;
+ var radixRE = /[0-9a-zA-Z]/; // 36#zZ style int
+ if (digitRE.test(ch)) {
+ stream.eatWhile(digitRE);
+ if (stream.eat('#')) {
+ stream.eatWhile(radixRE); // 36#aZ style integer
+ } else {
+ if (stream.eat('.')) { // float
+ stream.eatWhile(digitRE);
+ }
+ if (stream.eat(/[eE]/)) {
+ stream.eat(/[-+]/); // float with exponent
+ stream.eatWhile(digitRE);
+ }
+ }
+ return rval(state,stream,"number"); // normal integer
+ }
+
+ // open parens
+ if (nongreedy(stream,openParenRE,openParenWords)) {
+ pushToken(state,stream);
+ return rval(state,stream,"open_paren");
+ }
+
+ // close parens
+ if (nongreedy(stream,closeParenRE,closeParenWords)) {
+ pushToken(state,stream);
+ return rval(state,stream,"close_paren");
+ }
+
+ // separators
+ if (greedy(stream,separatorRE,separatorWords)) {
+ // distinguish between "." as terminator and record field operator
+ if (!state.in_record) {
+ pushToken(state,stream);
+ }
+ return rval(state,stream,"separator");
+ }
+
+ // operators
+ if (greedy(stream,symbolRE,symbolWords)) {
+ return rval(state,stream,"operator");
+ }
+
+ return rval(state,stream,null);
+ }
+
+ function isPrev(stream,string) {
+ var start = stream.start;
+ var len = string.length;
+ if (len <= start) {
+ var word = stream.string.slice(start-len,start);
+ return word == string;
+ }else{
+ return false;
+ }
+ }
+
+ function nongreedy(stream,re,words) {
+ if (stream.current().length == 1 && re.test(stream.current())) {
+ stream.backUp(1);
+ while (re.test(stream.peek())) {
+ stream.next();
+ if (isMember(stream.current(),words)) {
+ return true;
+ }
+ }
+ stream.backUp(stream.current().length-1);
+ }
+ return false;
+ }
+
+ function greedy(stream,re,words) {
+ if (stream.current().length == 1 && re.test(stream.current())) {
+ while (re.test(stream.peek())) {
+ stream.next();
+ }
+ while (0 < stream.current().length) {
+ if (isMember(stream.current(),words)) {
+ return true;
+ }else{
+ stream.backUp(1);
+ }
+ }
+ stream.next();
+ }
+ return false;
+ }
+
+ function doubleQuote(stream) {
+ return quote(stream, '"', '\\');
+ }
+
+ function singleQuote(stream) {
+ return quote(stream,'\'','\\');
+ }
+
+ function quote(stream,quoteChar,escapeChar) {
+ while (!stream.eol()) {
+ var ch = stream.next();
+ if (ch == quoteChar) {
+ return true;
+ }else if (ch == escapeChar) {
+ stream.next();
+ }
+ }
+ return false;
+ }
+
+ function isMember(element,list) {
+ return (-1 < list.indexOf(element));
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+ function myIndent(state,textAfter) {
+ var indent = cmCfg.indentUnit;
+ var token = (peekToken(state)).token;
+ var wordAfter = takewhile(textAfter,/[^a-z]/);
+
+ if (state.in_string || state.in_atom) {
+ return CodeMirror.Pass;
+ }else if (token == "") {
+ return 0;
+ }else if (isMember(token,openParenWords)) {
+ return (peekToken(state)).column+token.length;
+ }else if (token == "when") {
+ return (peekToken(state)).column+token.length+1;
+ }else if (token == "fun" && wordAfter == "") {
+ return (peekToken(state)).column+token.length;
+ }else if (token == "->") {
+ if (isMember(wordAfter,["end","after","catch"])) {
+ return peekToken(state,2).column;
+ }else if (peekToken(state,2).token == "fun") {
+ return peekToken(state,2).column+indent;
+ }else if (peekToken(state,2).token == "") {
+ return indent;
+ }else{
+ return (peekToken(state)).indent+indent;
+ }
+ }else if (isMember(wordAfter,["after","catch","of"])) {
+ return (peekToken(state)).indent;
+ }else{
+ return (peekToken(state)).column+indent;
+ }
+ }
+
+ function takewhile(str,re) {
+ var m = str.match(re);
+ return m ? str.slice(0,m.index) : str;
+ }
+
+ function Token(stream) {
+ this.token = stream ? stream.current() : "";
+ this.column = stream ? stream.column() : 0;
+ this.indent = stream ? stream.indentation() : 0;
+ }
+
+ function popToken(state) {
+ return state.tokenStack.pop();
+ }
+
+ function peekToken(state,depth) {
+ var len = state.tokenStack.length;
+ var dep = (depth ? depth : 1);
+ if (len < dep) {
+ return new Token;
+ }else{
+ return state.tokenStack[len-dep];
+ }
+ }
+
+ function pushToken(state,stream) {
+ var token = stream.current();
+ var prev_token = peekToken(state).token;
+
+ if (token == ".") {
+ state.tokenStack = [];
+ return false;
+ }else if(isMember(token,[",", ":", "of", "cond", "let", "query"])) {
+ return false;
+ }else if (drop_last(prev_token,token)) {
+ return false;
+ }else if (drop_both(prev_token,token)) {
+ popToken(state);
+ return false;
+ }else if (drop_first(prev_token,token)) {
+ popToken(state);
+ return pushToken(state,stream);
+ }else if (isMember(token,["after","catch"])) {
+ return false;
+ }else{
+ state.tokenStack.push(new Token(stream));
+ return true;
+ }
+ }
+
+ function drop_last(open, close) {
+ switch(open+" "+close) {
+ case "when ;": return true;
+ default: return false;
+ }
+ }
+
+ function drop_first(open, close) {
+ switch (open+" "+close) {
+ case "when ->": return true;
+ case "-> end": return true;
+ default: return false;
+ }
+ }
+
+ function drop_both(open, close) {
+ switch (open+" "+close) {
+ case "( )": return true;
+ case "[ ]": return true;
+ case "{ }": return true;
+ case "<< >>": return true;
+ case "begin end": return true;
+ case "case end": return true;
+ case "fun end": return true;
+ case "if end": return true;
+ case "receive end": return true;
+ case "try end": return true;
+ case "-> catch": return true;
+ case "-> after": return true;
+ case "-> ;": return true;
+ default: return false;
+ }
+ }
+
+ return {
+ startState:
+ function() {
+ return {tokenStack: [],
+ in_record: false,
+ in_string: false,
+ in_atom: false};
+ },
+
+ token:
+ function(stream, state) {
+ return tokenize(stream, state);
+ },
+
+ indent:
+ function(state, textAfter) {
+ return myIndent(state,textAfter);
+ },
+
+ lineComment: "%"
+ };
+});
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/erlang/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/erlang/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/erlang/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/erlang/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,75 @@
+<!doctype html>
+
+<title>CodeMirror: Erlang mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/erlang-dark.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="erlang.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="#">Erlang</a>
+ </ul>
+</div>
+
+<article>
+<h2>Erlang mode</h2>
+<form><textarea id="code" name="code">
+%% -*- mode: erlang; erlang-indent-level: 2 -*-
+%%% Created : 7 May 2012 by mats cronqvist <ma...@klarna.com>
+
+%% @doc
+%% Demonstrates how to print a record.
+%% @end
+
+-module('ex').
+-author('mats cronqvist').
+-export([demo/0,
+ rec_info/1]).
+
+-record(demo,{a="One",b="Two",c="Three",d="Four"}).
+
+rec_info(demo) -> record_info(fields,demo).
+
+demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}).
+
+expand_recs(M,List) when is_list(List) ->
+ [expand_recs(M,L)||L<-List];
+expand_recs(M,Tup) when is_tuple(Tup) ->
+ case tuple_size(Tup) of
+ L when L < 1 -> Tup;
+ L ->
+ try Fields = M:rec_info(element(1,Tup)),
+ L = length(Fields)+1,
+ lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup))))
+ catch _:_ ->
+ list_to_tuple(expand_recs(M,tuple_to_list(Tup)))
+ end
+ end;
+expand_recs(_,Term) ->
+ Term.
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ extraKeys: {"Tab": "indentAuto"},
+ theme: "erlang-dark"
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-erlang</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gas/gas.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/gas/gas.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/gas/gas.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gas/gas.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,330 @@
+CodeMirror.defineMode("gas", function(_config, parserConfig) {
+ 'use strict';
+
+ // If an architecture is specified, its initialization function may
+ // populate this array with custom parsing functions which will be
+ // tried in the event that the standard functions do not find a match.
+ var custom = [];
+
+ // The symbol used to start a line comment changes based on the target
+ // architecture.
+ // If no architecture is pased in "parserConfig" then only multiline
+ // comments will have syntax support.
+ var lineCommentStartSymbol = "";
+
+ // These directives are architecture independent.
+ // Machine specific directives should go in their respective
+ // architecture initialization function.
+ // Reference:
+ // http://sourceware.org/binutils/docs/as/Pseudo-Ops.html#Pseudo-Ops
+ var directives = {
+ ".abort" : "builtin",
+ ".align" : "builtin",
+ ".altmacro" : "builtin",
+ ".ascii" : "builtin",
+ ".asciz" : "builtin",
+ ".balign" : "builtin",
+ ".balignw" : "builtin",
+ ".balignl" : "builtin",
+ ".bundle_align_mode" : "builtin",
+ ".bundle_lock" : "builtin",
+ ".bundle_unlock" : "builtin",
+ ".byte" : "builtin",
+ ".cfi_startproc" : "builtin",
+ ".comm" : "builtin",
+ ".data" : "builtin",
+ ".def" : "builtin",
+ ".desc" : "builtin",
+ ".dim" : "builtin",
+ ".double" : "builtin",
+ ".eject" : "builtin",
+ ".else" : "builtin",
+ ".elseif" : "builtin",
+ ".end" : "builtin",
+ ".endef" : "builtin",
+ ".endfunc" : "builtin",
+ ".endif" : "builtin",
+ ".equ" : "builtin",
+ ".equiv" : "builtin",
+ ".eqv" : "builtin",
+ ".err" : "builtin",
+ ".error" : "builtin",
+ ".exitm" : "builtin",
+ ".extern" : "builtin",
+ ".fail" : "builtin",
+ ".file" : "builtin",
+ ".fill" : "builtin",
+ ".float" : "builtin",
+ ".func" : "builtin",
+ ".global" : "builtin",
+ ".gnu_attribute" : "builtin",
+ ".hidden" : "builtin",
+ ".hword" : "builtin",
+ ".ident" : "builtin",
+ ".if" : "builtin",
+ ".incbin" : "builtin",
+ ".include" : "builtin",
+ ".int" : "builtin",
+ ".internal" : "builtin",
+ ".irp" : "builtin",
+ ".irpc" : "builtin",
+ ".lcomm" : "builtin",
+ ".lflags" : "builtin",
+ ".line" : "builtin",
+ ".linkonce" : "builtin",
+ ".list" : "builtin",
+ ".ln" : "builtin",
+ ".loc" : "builtin",
+ ".loc_mark_labels" : "builtin",
+ ".local" : "builtin",
+ ".long" : "builtin",
+ ".macro" : "builtin",
+ ".mri" : "builtin",
+ ".noaltmacro" : "builtin",
+ ".nolist" : "builtin",
+ ".octa" : "builtin",
+ ".offset" : "builtin",
+ ".org" : "builtin",
+ ".p2align" : "builtin",
+ ".popsection" : "builtin",
+ ".previous" : "builtin",
+ ".print" : "builtin",
+ ".protected" : "builtin",
+ ".psize" : "builtin",
+ ".purgem" : "builtin",
+ ".pushsection" : "builtin",
+ ".quad" : "builtin",
+ ".reloc" : "builtin",
+ ".rept" : "builtin",
+ ".sbttl" : "builtin",
+ ".scl" : "builtin",
+ ".section" : "builtin",
+ ".set" : "builtin",
+ ".short" : "builtin",
+ ".single" : "builtin",
+ ".size" : "builtin",
+ ".skip" : "builtin",
+ ".sleb128" : "builtin",
+ ".space" : "builtin",
+ ".stab" : "builtin",
+ ".string" : "builtin",
+ ".struct" : "builtin",
+ ".subsection" : "builtin",
+ ".symver" : "builtin",
+ ".tag" : "builtin",
+ ".text" : "builtin",
+ ".title" : "builtin",
+ ".type" : "builtin",
+ ".uleb128" : "builtin",
+ ".val" : "builtin",
+ ".version" : "builtin",
+ ".vtable_entry" : "builtin",
+ ".vtable_inherit" : "builtin",
+ ".warning" : "builtin",
+ ".weak" : "builtin",
+ ".weakref" : "builtin",
+ ".word" : "builtin"
+ };
+
+ var registers = {};
+
+ function x86(_parserConfig) {
+ lineCommentStartSymbol = "#";
+
+ registers.ax = "variable";
+ registers.eax = "variable-2";
+ registers.rax = "variable-3";
+
+ registers.bx = "variable";
+ registers.ebx = "variable-2";
+ registers.rbx = "variable-3";
+
+ registers.cx = "variable";
+ registers.ecx = "variable-2";
+ registers.rcx = "variable-3";
+
+ registers.dx = "variable";
+ registers.edx = "variable-2";
+ registers.rdx = "variable-3";
+
+ registers.si = "variable";
+ registers.esi = "variable-2";
+ registers.rsi = "variable-3";
+
+ registers.di = "variable";
+ registers.edi = "variable-2";
+ registers.rdi = "variable-3";
+
+ registers.sp = "variable";
+ registers.esp = "variable-2";
+ registers.rsp = "variable-3";
+
+ registers.bp = "variable";
+ registers.ebp = "variable-2";
+ registers.rbp = "variable-3";
+
+ registers.ip = "variable";
+ registers.eip = "variable-2";
+ registers.rip = "variable-3";
+
+ registers.cs = "keyword";
+ registers.ds = "keyword";
+ registers.ss = "keyword";
+ registers.es = "keyword";
+ registers.fs = "keyword";
+ registers.gs = "keyword";
+ }
+
+ function armv6(_parserConfig) {
+ // Reference:
+ // http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf
+ // http://infocenter.arm.com/help/topic/com.arm.doc.ddi0301h/DDI0301H_arm1176jzfs_r0p7_trm.pdf
+ lineCommentStartSymbol = "@";
+ directives.syntax = "builtin";
+
+ registers.r0 = "variable";
+ registers.r1 = "variable";
+ registers.r2 = "variable";
+ registers.r3 = "variable";
+ registers.r4 = "variable";
+ registers.r5 = "variable";
+ registers.r6 = "variable";
+ registers.r7 = "variable";
+ registers.r8 = "variable";
+ registers.r9 = "variable";
+ registers.r10 = "variable";
+ registers.r11 = "variable";
+ registers.r12 = "variable";
+
+ registers.sp = "variable-2";
+ registers.lr = "variable-2";
+ registers.pc = "variable-2";
+ registers.r13 = registers.sp;
+ registers.r14 = registers.lr;
+ registers.r15 = registers.pc;
+
+ custom.push(function(ch, stream) {
+ if (ch === '#') {
+ stream.eatWhile(/\w/);
+ return "number";
+ }
+ });
+ }
+
+ var arch = parserConfig.architecture.toLowerCase();
+ if (arch === "x86") {
+ x86(parserConfig);
+ } else if (arch === "arm" || arch === "armv6") {
+ armv6(parserConfig);
+ }
+
+ function nextUntilUnescaped(stream, end) {
+ var escaped = false, next;
+ while ((next = stream.next()) != null) {
+ if (next === end && !escaped) {
+ return false;
+ }
+ escaped = !escaped && next === "\\";
+ }
+ return escaped;
+ }
+
+ function clikeComment(stream, state) {
+ var maybeEnd = false, ch;
+ while ((ch = stream.next()) != null) {
+ if (ch === "/" && maybeEnd) {
+ state.tokenize = null;
+ break;
+ }
+ maybeEnd = (ch === "*");
+ }
+ return "comment";
+ }
+
+ return {
+ startState: function() {
+ return {
+ tokenize: null
+ };
+ },
+
+ token: function(stream, state) {
+ if (state.tokenize) {
+ return state.tokenize(stream, state);
+ }
+
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ var style, cur, ch = stream.next();
+
+ if (ch === "/") {
+ if (stream.eat("*")) {
+ state.tokenize = clikeComment;
+ return clikeComment(stream, state);
+ }
+ }
+
+ if (ch === lineCommentStartSymbol) {
+ stream.skipToEnd();
+ return "comment";
+ }
+
+ if (ch === '"') {
+ nextUntilUnescaped(stream, '"');
+ return "string";
+ }
+
+ if (ch === '.') {
+ stream.eatWhile(/\w/);
+ cur = stream.current().toLowerCase();
+ style = directives[cur];
+ return style || null;
+ }
+
+ if (ch === '=') {
+ stream.eatWhile(/\w/);
+ return "tag";
+ }
+
+ if (ch === '{') {
+ return "braket";
+ }
+
+ if (ch === '}') {
+ return "braket";
+ }
+
+ if (/\d/.test(ch)) {
+ if (ch === "0" && stream.eat("x")) {
+ stream.eatWhile(/[0-9a-fA-F]/);
+ return "number";
+ }
+ stream.eatWhile(/\d/);
+ return "number";
+ }
+
+ if (/\w/.test(ch)) {
+ stream.eatWhile(/\w/);
+ if (stream.eat(":")) {
+ return 'tag';
+ }
+ cur = stream.current().toLowerCase();
+ style = registers[cur];
+ return style || null;
+ }
+
+ for (var i = 0; i < custom.length; i++) {
+ style = custom[i](ch, stream, state);
+ if (style) {
+ return style;
+ }
+ }
+ },
+
+ lineComment: lineCommentStartSymbol,
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/"
+ };
+});
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gas/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/gas/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/gas/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gas/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,68 @@
+<!doctype html>
+
+<title>CodeMirror: Gas 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="gas.js"></script>
+<style>.CodeMirror {border: 2px inset #dee;}</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="#">Gas</a>
+ </ul>
+</div>
+
+<article>
+<h2>Gas mode</h2>
+<form>
+<textarea id="code" name="code">
+.syntax unified
+.global main
+
+/*
+ * A
+ * multi-line
+ * comment.
+ */
+
+@ A single line comment.
+
+main:
+ push {sp, lr}
+ ldr r0, =message
+ bl puts
+ mov r0, #0
+ pop {sp, pc}
+
+message:
+ .asciz "Hello world!<br />"
+</textarea>
+ </form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ mode: {name: "gas", architecture: "ARMv6"},
+ });
+ </script>
+
+ <p>Handles AT&T assembler syntax (more specifically this handles
+ the GNU Assembler (gas) syntax.)
+ It takes a single optional configuration parameter:
+ <code>architecture</code>, which can be one of <code>"ARM"</code>,
+ <code>"ARMv6"</code> or <code>"x86"</code>.
+ Including the parameter adds syntax for the registers and special
+ directives for the supplied architecture.
+
+ <p><strong>MIME types defined:</strong> <code>text/x-gas</code></p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gfm/gfm.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/gfm/gfm.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/gfm/gfm.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gfm/gfm.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,96 @@
+CodeMirror.defineMode("gfm", function(config) {
+ var codeDepth = 0;
+ function blankLine(state) {
+ state.code = false;
+ return null;
+ }
+ var gfmOverlay = {
+ startState: function() {
+ return {
+ code: false,
+ codeBlock: false,
+ ateSpace: false
+ };
+ },
+ copyState: function(s) {
+ return {
+ code: s.code,
+ codeBlock: s.codeBlock,
+ ateSpace: s.ateSpace
+ };
+ },
+ token: function(stream, state) {
+ // Hack to prevent formatting override inside code blocks (block and inline)
+ if (state.codeBlock) {
+ if (stream.match(/^```/)) {
+ state.codeBlock = false;
+ return null;
+ }
+ stream.skipToEnd();
+ return null;
+ }
+ if (stream.sol()) {
+ state.code = false;
+ }
+ if (stream.sol() && stream.match(/^```/)) {
+ stream.skipToEnd();
+ state.codeBlock = true;
+ return null;
+ }
+ // If this block is changed, it may need to be updated in Markdown mode
+ if (stream.peek() === '`') {
+ stream.next();
+ var before = stream.pos;
+ stream.eatWhile('`');
+ var difference = 1 + stream.pos - before;
+ if (!state.code) {
+ codeDepth = difference;
+ state.code = true;
+ } else {
+ if (difference === codeDepth) { // Must be exact
+ state.code = false;
+ }
+ }
+ return null;
+ } else if (state.code) {
+ stream.next();
+ return null;
+ }
+ // Check if space. If so, links can be formatted later on
+ if (stream.eatSpace()) {
+ state.ateSpace = true;
+ return null;
+ }
+ if (stream.sol() || state.ateSpace) {
+ state.ateSpace = false;
+ if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) {
+ // User/Project@SHA
+ // User@SHA
+ // SHA
+ return "link";
+ } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
+ // User/Project#Num
+ // User#Num
+ // #Num
+ return "link";
+ }
+ }
+ if (stream.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`!()\[\]{};:'".,<>?«»ââââ]))/i)) {
+ // URLs
+ // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
+ // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
+ return "link";
+ }
+ stream.next();
+ return null;
+ },
+ blankLine: blankLine
+ };
+ CodeMirror.defineMIME("gfmBase", {
+ name: "markdown",
+ underscoresBreakWords: false,
+ taskLists: true,
+ fencedCodeBlocks: true
+ });
+ return CodeMirror.overlayMode(CodeMirror.getMode(config, "gfmBase"), gfmOverlay);
+}, "markdown");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gfm/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/gfm/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/gfm/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gfm/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,82 @@
+<!doctype html>
+
+<title>CodeMirror: GFM 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/mode/overlay.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../markdown/markdown.js"></script>
+<script src="gfm.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="../clike/clike.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="#">GFM</a>
+ </ul>
+</div>
+
+<article>
+<h2>GFM mode</h2>
+<form><textarea id="code" name="code">
+GitHub Flavored Markdown
+========================
+
+Everything from markdown plus GFM features:
+
+## URL autolinking
+
+Underscores_are_allowed_between_words.
+
+## Fenced code blocks (and syntax highlighting)
+
+```javascript
+for (var i = 0; i < items.length; i++) {
+ console.log(items[i], i); // log them
+}
+```
+
+## Task Lists
+
+- [ ] Incomplete task list item
+- [x] **Completed** task list item
+
+## A bit of GitHub spice
+
+* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* \#Num: #1
+* User/#Num: mojombo#1
+* User/Project#Num: mojombo/god#1
+
+See http://github.github.com/github-flavored-markdown/.
+
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode: 'gfm',
+ lineNumbers: true,
+ theme: "default"
+ });
+ </script>
+
+ <p>Optionally depends on other modes for properly highlighted code blocks.</p>
+
+ <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#gfm_*">normal</a>, <a href="../../test/index.html#verbose,gfm_*">verbose</a>.</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gfm/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/gfm/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/gfm/test.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/gfm/test.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,112 @@
+(function() {
+ var mode = CodeMirror.getMode({tabSize: 4}, "gfm");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("emInWordAsterisk",
+ "foo[em *bar*]hello");
+
+ MT("emInWordUnderscore",
+ "foo_bar_hello");
+
+ MT("emStrongUnderscore",
+ "[strong __][em&strong _foo__][em _] bar");
+
+ MT("fencedCodeBlocks",
+ "[comment ```]",
+ "[comment foo]",
+ "",
+ "[comment ```]",
+ "bar");
+
+ MT("fencedCodeBlockModeSwitching",
+ "[comment ```javascript]",
+ "[variable foo]",
+ "",
+ "[comment ```]",
+ "bar");
+
+ MT("taskListAsterisk",
+ "[variable-2 * []] foo]", // Invalid; must have space or x between []
+ "[variable-2 * [ ]]bar]", // Invalid; must have space after ]
+ "[variable-2 * [x]]hello]", // Invalid; must have space after ]
+ "[variable-2 * ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
+ " [variable-3 * ][property [x]]][variable-3 foo]"); // Valid; can be nested
+
+ MT("taskListPlus",
+ "[variable-2 + []] foo]", // Invalid; must have space or x between []
+ "[variable-2 + [ ]]bar]", // Invalid; must have space after ]
+ "[variable-2 + [x]]hello]", // Invalid; must have space after ]
+ "[variable-2 + ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
+ " [variable-3 + ][property [x]]][variable-3 foo]"); // Valid; can be nested
+
+ MT("taskListDash",
+ "[variable-2 - []] foo]", // Invalid; must have space or x between []
+ "[variable-2 - [ ]]bar]", // Invalid; must have space after ]
+ "[variable-2 - [x]]hello]", // Invalid; must have space after ]
+ "[variable-2 - ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
+ " [variable-3 - ][property [x]]][variable-3 foo]"); // Valid; can be nested
+
+ MT("taskListNumber",
+ "[variable-2 1. []] foo]", // Invalid; must have space or x between []
+ "[variable-2 2. [ ]]bar]", // Invalid; must have space after ]
+ "[variable-2 3. [x]]hello]", // Invalid; must have space after ]
+ "[variable-2 4. ][meta [ ]]][variable-2 [world]]]", // Valid; tests reference style links
+ " [variable-3 1. ][property [x]]][variable-3 foo]"); // Valid; can be nested
+
+ MT("SHA",
+ "foo [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] bar");
+
+ MT("shortSHA",
+ "foo [link be6a8cc] bar");
+
+ MT("tooShortSHA",
+ "foo be6a8c bar");
+
+ MT("longSHA",
+ "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd22 bar");
+
+ MT("badSHA",
+ "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cg2 bar");
+
+ MT("userSHA",
+ "foo [link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] hello");
+
+ MT("userProjectSHA",
+ "foo [link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] world");
+
+ MT("num",
+ "foo [link #1] bar");
+
+ MT("badNum",
+ "foo #1bar hello");
+
+ MT("userNum",
+ "foo [link bar#1] hello");
+
+ MT("userProjectNum",
+ "foo [link bar/hello#1] world");
+
+ MT("vanillaLink",
+ "foo [link http://www.example.com/] bar");
+
+ MT("vanillaLinkPunctuation",
+ "foo [link http://www.example.com/]. bar");
+
+ MT("vanillaLinkExtension",
+ "foo [link http://www.example.com/index.html] bar");
+
+ MT("notALink",
+ "[comment ```css]",
+ "[tag foo] {[property color][operator :][keyword black];}",
+ "[comment ```][link http://www.example.com/]");
+
+ MT("notALink",
+ "[comment ``foo `bar` http://www.example.com/``] hello");
+
+ MT("notALink",
+ "[comment `foo]",
+ "[link http://www.example.com/]",
+ "[comment `foo]",
+ "",
+ "[link http://www.example.com/]");
+})();
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/go/go.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/go/go.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/go/go.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/go/go.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,168 @@
+CodeMirror.defineMode("go", function(config) {
+ 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 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 "variable";
+ }
+
+ 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: "{}:",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ lineComment: "//"
+ };
+});
+
+CodeMirror.defineMIME("text/x-go", "go");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/go/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/go/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/go/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/go/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: Go mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/elegant.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="go.js"></script>
+<style>.CodeMirror {border:1px solid #999; background:#ffc}</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="#">Go</a>
+ </ul>
+</div>
+
+<article>
+<h2>Go mode</h2>
+<form><textarea id="code" name="code">
+// Prime Sieve in Go.
+// Taken from the Go specification.
+// Copyright © The Go Authors.
+
+package main
+
+import "fmt"
+
+// Send the sequence 2, 3, 4, ... to channel 'ch'.
+func generate(ch chan<- int) {
+ for i := 2; ; i++ {
+ ch <- i // Send 'i' to channel 'ch'
+ }
+}
+
+// Copy the values from channel 'src' to channel 'dst',
+// removing those divisible by 'prime'.
+func filter(src <-chan int, dst chan<- int, prime int) {
+ for i := range src { // Loop over values received from 'src'.
+ if i%prime != 0 {
+ dst <- i // Send 'i' to channel 'dst'.
+ }
+ }
+}
+
+// The prime sieve: Daisy-chain filter processes together.
+func sieve() {
+ ch := make(chan int) // Create a new channel.
+ go generate(ch) // Start generate() as a subprocess.
+ for {
+ prime := <-ch
+ fmt.Print(prime, "\n")
+ ch1 := make(chan int)
+ go filter(ch, ch1, prime)
+ ch = ch1
+ }
+}
+
+func main() {
+ sieve()
+}
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ theme: "elegant",
+ matchBrackets: true,
+ indentUnit: 8,
+ tabSize: 8,
+ indentWithTabs: true,
+ mode: "text/x-go"
+ });
+ </script>
+
+ <p><strong>MIME type:</strong> <code>text/x-go</code></p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/groovy/groovy.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/groovy/groovy.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/groovy/groovy.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/groovy/groovy.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,211 @@
+CodeMirror.defineMode("groovy", function(config) {
+ function words(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+ var 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 private protected public return " +
+ "short static strictfp super switch synchronized threadsafe throw throws transient " +
+ "try void volatile while");
+ var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
+ var atoms = words("null true false this");
+
+ var curPunc;
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ if (ch == '"' || ch == "'") {
+ return startString(ch, stream, state);
+ }
+ if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+ curPunc = ch;
+ return null;
+ }
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/[\w\.]/);
+ if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
+ return "number";
+ }
+ if (ch == "/") {
+ if (stream.eat("*")) {
+ state.tokenize.push(tokenComment);
+ return tokenComment(stream, state);
+ }
+ if (stream.eat("/")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ if (expectExpression(state.lastToken)) {
+ return startString(ch, stream, state);
+ }
+ }
+ if (ch == "-" && stream.eat(">")) {
+ curPunc = "->";
+ return null;
+ }
+ if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
+ stream.eatWhile(/[+\-*&%=<>|~]/);
+ return "operator";
+ }
+ stream.eatWhile(/[\w\$_]/);
+ if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
+ if (state.lastToken == ".") return "property";
+ if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
+ var cur = stream.current();
+ if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
+ if (keywords.propertyIsEnumerable(cur)) {
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+ return "keyword";
+ }
+ return "variable";
+ }
+ tokenBase.isBase = true;
+
+ function startString(quote, stream, state) {
+ var tripleQuoted = false;
+ if (quote != "/" && stream.eat(quote)) {
+ if (stream.eat(quote)) tripleQuoted = true;
+ else return "string";
+ }
+ function t(stream, state) {
+ var escaped = false, next, end = !tripleQuoted;
+ while ((next = stream.next()) != null) {
+ if (next == quote && !escaped) {
+ if (!tripleQuoted) { break; }
+ if (stream.match(quote + quote)) { end = true; break; }
+ }
+ if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
+ state.tokenize.push(tokenBaseUntilBrace());
+ return "string";
+ }
+ escaped = !escaped && next == "\\";
+ }
+ if (end) state.tokenize.pop();
+ return "string";
+ }
+ state.tokenize.push(t);
+ return t(stream, state);
+ }
+
+ function tokenBaseUntilBrace() {
+ var depth = 1;
+ function t(stream, state) {
+ if (stream.peek() == "}") {
+ depth--;
+ if (depth == 0) {
+ state.tokenize.pop();
+ return state.tokenize[state.tokenize.length-1](stream, state);
+ }
+ } else if (stream.peek() == "{") {
+ depth++;
+ }
+ return tokenBase(stream, state);
+ }
+ t.isBase = true;
+ return t;
+ }
+
+ function tokenComment(stream, state) {
+ var maybeEnd = false, ch;
+ while (ch = stream.next()) {
+ if (ch == "/" && maybeEnd) {
+ state.tokenize.pop();
+ break;
+ }
+ maybeEnd = (ch == "*");
+ }
+ return "comment";
+ }
+
+ function expectExpression(last) {
+ return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
+ last == "newstatement" || last == "keyword" || last == "proplabel";
+ }
+
+ 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: [tokenBase],
+ context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
+ indented: 0,
+ startOfLine: true,
+ lastToken: null
+ };
+ },
+
+ 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;
+ // Automatic semicolon insertion
+ if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
+ popContext(state); ctx = state.context;
+ }
+ }
+ if (stream.eatSpace()) return null;
+ curPunc = null;
+ var style = state.tokenize[state.tokenize.length-1](stream, state);
+ if (style == "comment") return style;
+ if (ctx.align == null) ctx.align = true;
+
+ if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
+ // Handle indentation for {x -> \n ... }
+ else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
+ popContext(state);
+ state.context.align = false;
+ }
+ 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;
+ state.lastToken = curPunc || style;
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
+ if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
+ var closing = firstChar == ctx.type;
+ if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+ else return ctx.indented + (closing ? 0 : config.indentUnit);
+ },
+
+ electricChars: "{}",
+ fold: "brace"
+ };
+});
+
+CodeMirror.defineMIME("text/x-groovy", "groovy");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/groovy/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/groovy/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/groovy/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/groovy/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,84 @@
+<!doctype html>
+
+<title>CodeMirror: Groovy 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="groovy.js"></script>
+<style>.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}</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="#">Groovy</a>
+ </ul>
+</div>
+
+<article>
+<h2>Groovy mode</h2>
+<form><textarea id="code" name="code">
+//Pattern for groovy script
+def p = ~/.*\.groovy/
+new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
+ // imports list
+ def imports = []
+ f.eachLine {
+ // condition to detect an import instruction
+ ln -> if ( ln =~ '^import .*' ) {
+ imports << "${ln - 'import '}"
+ }
+ }
+ // print thmen
+ if ( ! imports.empty ) {
+ println f
+ imports.each{ println " $it" }
+ }
+}
+
+/* Coin changer demo code from http://groovy.codehaus.org */
+
+enum UsCoin {
+ quarter(25), dime(10), nickel(5), penny(1)
+ UsCoin(v) { value = v }
+ final value
+}
+
+enum OzzieCoin {
+ fifty(50), twenty(20), ten(10), five(5)
+ OzzieCoin(v) { value = v }
+ final value
+}
+
+def plural(word, count) {
+ if (count == 1) return word
+ word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
+}
+
+def change(currency, amount) {
+ currency.values().inject([]){ list, coin ->
+ int count = amount / coin.value
+ amount = amount % coin.value
+ list += "$count ${plural(coin.toString(), count)}"
+ }
+}
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/x-groovy"
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-groovy</code></p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haml/haml.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/haml/haml.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/haml/haml.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haml/haml.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,153 @@
+(function() {
+ "use strict";
+
+ // full haml mode. This handled embeded ruby and html fragments too
+ CodeMirror.defineMode("haml", function(config) {
+ var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
+ var rubyMode = CodeMirror.getMode(config, "ruby");
+
+ function rubyInQuote(endQuote) {
+ return function(stream, state) {
+ var ch = stream.peek();
+ if (ch == endQuote && state.rubyState.tokenize.length == 1) {
+ // step out of ruby context as it seems to complete processing all the braces
+ stream.next();
+ state.tokenize = html;
+ return "closeAttributeTag";
+ } else {
+ return ruby(stream, state);
+ }
+ };
+ }
+
+ function ruby(stream, state) {
+ if (stream.match("-#")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ return rubyMode.token(stream, state.rubyState);
+ }
+
+ function html(stream, state) {
+ var ch = stream.peek();
+
+ // handle haml declarations. All declarations that cant be handled here
+ // will be passed to html mode
+ if (state.previousToken.style == "comment" ) {
+ if (state.indented > state.previousToken.indented) {
+ stream.skipToEnd();
+ return "commentLine";
+ }
+ }
+
+ if (state.startOfLine) {
+ if (ch == "!" && stream.match("!!")) {
+ stream.skipToEnd();
+ return "tag";
+ } else if (stream.match(/^%[\w:#\.]+=/)) {
+ state.tokenize = ruby;
+ return "hamlTag";
+ } else if (stream.match(/^%[\w:]+/)) {
+ return "hamlTag";
+ } else if (ch == "/" ) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ }
+
+ if (state.startOfLine || state.previousToken.style == "hamlTag") {
+ if ( ch == "#" || ch == ".") {
+ stream.match(/[\w-#\.]*/);
+ return "hamlAttribute";
+ }
+ }
+
+ // donot handle --> as valid ruby, make it HTML close comment instead
+ if (state.startOfLine && !stream.match("-->", false) && (ch == "=" || ch == "-" )) {
+ state.tokenize = ruby;
+ return null;
+ }
+
+ if (state.previousToken.style == "hamlTag" ||
+ state.previousToken.style == "closeAttributeTag" ||
+ state.previousToken.style == "hamlAttribute") {
+ if (ch == "(") {
+ state.tokenize = rubyInQuote(")");
+ return null;
+ } else if (ch == "{") {
+ state.tokenize = rubyInQuote("}");
+ return null;
+ }
+ }
+
+ return htmlMode.token(stream, state.htmlState);
+ }
+
+ return {
+ // default to html mode
+ startState: function() {
+ var htmlState = htmlMode.startState();
+ var rubyState = rubyMode.startState();
+ return {
+ htmlState: htmlState,
+ rubyState: rubyState,
+ indented: 0,
+ previousToken: { style: null, indented: 0},
+ tokenize: html
+ };
+ },
+
+ copyState: function(state) {
+ return {
+ htmlState : CodeMirror.copyState(htmlMode, state.htmlState),
+ rubyState: CodeMirror.copyState(rubyMode, state.rubyState),
+ indented: state.indented,
+ previousToken: state.previousToken,
+ tokenize: state.tokenize
+ };
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ state.indented = stream.indentation();
+ state.startOfLine = true;
+ }
+ if (stream.eatSpace()) return null;
+ var style = state.tokenize(stream, state);
+ state.startOfLine = false;
+ // dont record comment line as we only want to measure comment line with
+ // the opening comment block
+ if (style && style != "commentLine") {
+ state.previousToken = { style: style, indented: state.indented };
+ }
+ // if current state is ruby and the previous token is not `,` reset the
+ // tokenize to html
+ if (stream.eol() && state.tokenize == ruby) {
+ stream.backUp(1);
+ var ch = stream.peek();
+ stream.next();
+ if (ch && ch != ",") {
+ state.tokenize = html;
+ }
+ }
+ // reprocess some of the specific style tag when finish setting previousToken
+ if (style == "hamlTag") {
+ style = "tag";
+ } else if (style == "commentLine") {
+ style = "comment";
+ } else if (style == "hamlAttribute") {
+ style = "attribute";
+ } else if (style == "closeAttributeTag") {
+ style = null;
+ }
+ return style;
+ },
+
+ indent: function(state) {
+ return state.indented;
+ }
+ };
+ }, "htmlmixed", "ruby");
+
+ CodeMirror.defineMIME("text/x-haml", "haml");
+})();
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haml/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/haml/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/haml/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haml/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,79 @@
+<!doctype html>
+
+<title>CodeMirror: HAML 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="../htmlmixed/htmlmixed.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../ruby/ruby.js"></script>
+<script src="haml.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</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="#">HAML</a>
+ </ul>
+</div>
+
+<article>
+<h2>HAML mode</h2>
+<form><textarea id="code" name="code">
+!!!
+#content
+.left.column(title="title"){:href => "/hello", :test => "#{hello}_#{world}"}
+ <!-- This is a comment -->
+ %h2 Welcome to our site!
+ %p= puts "HAML MODE"
+ .right.column
+ = render :partial => "sidebar"
+
+.container
+ .row
+ .span8
+ %h1.title= @page_title
+%p.title= @page_title
+%p
+ /
+ The same as HTML comment
+ Hello multiline comment
+
+ -# haml comment
+ This wont be displayed
+ nor will this
+ Date/Time:
+ - now = DateTime.now
+ %strong= now
+ - if now > DateTime.parse("December 31, 2006")
+ = "Happy new " + "year!"
+
+%title
+ = @title
+ \= @title
+ <h1>Title</h1>
+ <h1 title="HELLO">
+ Title
+ </h1>
+ </textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ mode: "text/x-haml"
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-haml</code>.</p>
+
+ <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#haml_*">normal</a>, <a href="../../test/index.html#verbose,haml_*">verbose</a>.</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haml/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/haml/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/haml/test.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haml/test.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,94 @@
+(function() {
+ var mode = CodeMirror.getMode({tabSize: 4}, "haml");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ // Requires at least one media query
+ MT("elementName",
+ "[tag %h1] Hey There");
+
+ MT("oneElementPerLine",
+ "[tag %h1] Hey There %h2");
+
+ MT("idSelector",
+ "[tag %h1][attribute #test] Hey There");
+
+ MT("classSelector",
+ "[tag %h1][attribute .hello] Hey There");
+
+ MT("docType",
+ "[tag !!! XML]");
+
+ MT("comment",
+ "[comment / Hello WORLD]");
+
+ MT("notComment",
+ "[tag %h1] This is not a / comment ");
+
+ MT("attributes",
+ "[tag %a]([variable title][operator =][string \"test\"]){[atom :title] [operator =>] [string \"test\"]}");
+
+ MT("htmlCode",
+ "[tag <h1>]Title[tag </h1>]");
+
+ MT("rubyBlock",
+ "[operator =][variable-2 @item]");
+
+ MT("selectorRubyBlock",
+ "[tag %a.selector=] [variable-2 @item]");
+
+ MT("nestedRubyBlock",
+ "[tag %a]",
+ " [operator =][variable puts] [string \"test\"]");
+
+ MT("multilinePlaintext",
+ "[tag %p]",
+ " Hello,",
+ " World");
+
+ MT("multilineRuby",
+ "[tag %p]",
+ " [comment -# this is a comment]",
+ " [comment and this is a comment too]",
+ " Date/Time",
+ " [operator -] [variable now] [operator =] [tag DateTime][operator .][variable now]",
+ " [tag %strong=] [variable now]",
+ " [operator -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][variable parse]([string \"December 31, 2006\"])",
+ " [operator =][string \"Happy\"]",
+ " [operator =][string \"Belated\"]",
+ " [operator =][string \"Birthday\"]");
+
+ MT("multilineComment",
+ "[comment /]",
+ " [comment Multiline]",
+ " [comment Comment]");
+
+ MT("hamlComment",
+ "[comment -# this is a comment]");
+
+ MT("multilineHamlComment",
+ "[comment -# this is a comment]",
+ " [comment and this is a comment too]");
+
+ MT("multilineHTMLComment",
+ "[comment <!--]",
+ " [comment what a comment]",
+ " [comment -->]");
+
+ MT("hamlAfterRubyTag",
+ "[attribute .block]",
+ " [tag %strong=] [variable now]",
+ " [attribute .test]",
+ " [operator =][variable now]",
+ " [attribute .right]");
+
+ MT("stretchedRuby",
+ "[operator =] [variable puts] [string \"Hello\"],",
+ " [string \"World\"]");
+
+ MT("interpolationInHashAttribute",
+ //"[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test");
+ "[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test");
+
+ MT("interpolationInHTMLAttribute",
+ "[tag %div]([variable title][operator =][string \"#{][variable test][string }_#{][variable ting]()[string }\"]) Test");
+})();
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haskell/haskell.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/haskell/haskell.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/haskell/haskell.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haskell/haskell.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,246 @@
+CodeMirror.defineMode("haskell", function() {
+
+ function switchState(source, setState, f) {
+ setState(f);
+ return f(source, setState);
+ }
+
+ // These should all be Unicode extended, as per the Haskell 2010 report
+ var smallRE = /[a-z_]/;
+ var largeRE = /[A-Z]/;
+ var digitRE = /[0-9]/;
+ var hexitRE = /[0-9A-Fa-f]/;
+ var octitRE = /[0-7]/;
+ var idRE = /[a-z_A-Z0-9']/;
+ var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
+ var specialRE = /[(),;[\]`{}]/;
+ var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
+
+ function normal(source, setState) {
+ if (source.eatWhile(whiteCharRE)) {
+ return null;
+ }
+
+ var ch = source.next();
+ if (specialRE.test(ch)) {
+ if (ch == '{' && source.eat('-')) {
+ var t = "comment";
+ if (source.eat('#')) {
+ t = "meta";
+ }
+ return switchState(source, setState, ncomment(t, 1));
+ }
+ return null;
+ }
+
+ if (ch == '\'') {
+ if (source.eat('\\')) {
+ source.next(); // should handle other escapes here
+ }
+ else {
+ source.next();
+ }
+ if (source.eat('\'')) {
+ return "string";
+ }
+ return "error";
+ }
+
+ if (ch == '"') {
+ return switchState(source, setState, stringLiteral);
+ }
+
+ if (largeRE.test(ch)) {
+ source.eatWhile(idRE);
+ if (source.eat('.')) {
+ return "qualifier";
+ }
+ return "variable-2";
+ }
+
+ if (smallRE.test(ch)) {
+ source.eatWhile(idRE);
+ return "variable";
+ }
+
+ if (digitRE.test(ch)) {
+ if (ch == '0') {
+ if (source.eat(/[xX]/)) {
+ source.eatWhile(hexitRE); // should require at least 1
+ return "integer";
+ }
+ if (source.eat(/[oO]/)) {
+ source.eatWhile(octitRE); // should require at least 1
+ return "number";
+ }
+ }
+ source.eatWhile(digitRE);
+ var t = "number";
+ if (source.eat('.')) {
+ t = "number";
+ source.eatWhile(digitRE); // should require at least 1
+ }
+ if (source.eat(/[eE]/)) {
+ t = "number";
+ source.eat(/[-+]/);
+ source.eatWhile(digitRE); // should require at least 1
+ }
+ return t;
+ }
+
+ if (symbolRE.test(ch)) {
+ if (ch == '-' && source.eat(/-/)) {
+ source.eatWhile(/-/);
+ if (!source.eat(symbolRE)) {
+ source.skipToEnd();
+ return "comment";
+ }
+ }
+ var t = "variable";
+ if (ch == ':') {
+ t = "variable-2";
+ }
+ source.eatWhile(symbolRE);
+ return t;
+ }
+
+ return "error";
+ }
+
+ function ncomment(type, nest) {
+ if (nest == 0) {
+ return normal;
+ }
+ return function(source, setState) {
+ var currNest = nest;
+ while (!source.eol()) {
+ var ch = source.next();
+ if (ch == '{' && source.eat('-')) {
+ ++currNest;
+ }
+ else if (ch == '-' && source.eat('}')) {
+ --currNest;
+ if (currNest == 0) {
+ setState(normal);
+ return type;
+ }
+ }
+ }
+ setState(ncomment(type, currNest));
+ return type;
+ };
+ }
+
+ function stringLiteral(source, setState) {
+ while (!source.eol()) {
+ var ch = source.next();
+ if (ch == '"') {
+ setState(normal);
+ return "string";
+ }
+ if (ch == '\\') {
+ if (source.eol() || source.eat(whiteCharRE)) {
+ setState(stringGap);
+ return "string";
+ }
+ if (source.eat('&')) {
+ }
+ else {
+ source.next(); // should handle other escapes here
+ }
+ }
+ }
+ setState(normal);
+ return "error";
+ }
+
+ function stringGap(source, setState) {
+ if (source.eat('\\')) {
+ return switchState(source, setState, stringLiteral);
+ }
+ source.next();
+ setState(normal);
+ return "error";
+ }
+
+
+ var wellKnownWords = (function() {
+ var wkw = {};
+ function setType(t) {
+ return function () {
+ for (var i = 0; i < arguments.length; i++)
+ wkw[arguments[i]] = t;
+ };
+ }
+
+ setType("keyword")(
+ "case", "class", "data", "default", "deriving", "do", "else", "foreign",
+ "if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
+ "module", "newtype", "of", "then", "type", "where", "_");
+
+ setType("keyword")(
+ "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
+
+ setType("builtin")(
+ "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
+ "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
+
+ setType("builtin")(
+ "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
+ "False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
+ "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
+ "Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
+ "ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
+ "String", "True");
+
+ setType("builtin")(
+ "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
+ "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
+ "compare", "concat", "concatMap", "const", "cos", "cosh", "curry",
+ "cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",
+ "elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",
+ "enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",
+ "flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",
+ "foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",
+ "fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",
+ "getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",
+ "isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",
+ "lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
+ "mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
+ "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
+ "otherwise", "pi", "pred", "print", "product", "properFraction",
+ "putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
+ "readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
+ "realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
+ "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",
+ "sequence", "sequence_", "show", "showChar", "showList", "showParen",
+ "showString", "shows", "showsPrec", "significand", "signum", "sin",
+ "sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",
+ "tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",
+ "toRational", "truncate", "uncurry", "undefined", "unlines", "until",
+ "unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
+ "zip3", "zipWith", "zipWith3");
+
+ return wkw;
+ })();
+
+
+
+ return {
+ startState: function () { return { f: normal }; },
+ copyState: function (s) { return { f: s.f }; },
+
+ token: function(stream, state) {
+ var t = state.f(stream, function(s) { state.f = s; });
+ var w = stream.current();
+ return (w in wellKnownWords) ? wellKnownWords[w] : t;
+ },
+
+ blockCommentStart: "{-",
+ blockCommentEnd: "-}",
+ lineComment: "--"
+ };
+
+});
+
+CodeMirror.defineMIME("text/x-haskell", "haskell");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haskell/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/haskell/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/haskell/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/haskell/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,73 @@
+<!doctype html>
+
+<title>CodeMirror: Haskell mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/elegant.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="haskell.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="#">Haskell</a>
+ </ul>
+</div>
+
+<article>
+<h2>Haskell mode</h2>
+<form><textarea id="code" name="code">
+module UniquePerms (
+ uniquePerms
+ )
+where
+
+-- | Find all unique permutations of a list where there might be duplicates.
+uniquePerms :: (Eq a) => [a] -> [[a]]
+uniquePerms = permBag . makeBag
+
+-- | An unordered collection where duplicate values are allowed,
+-- but represented with a single value and a count.
+type Bag a = [(a, Int)]
+
+makeBag :: (Eq a) => [a] -> Bag a
+makeBag [] = []
+makeBag (a:as) = mix a $ makeBag as
+ where
+ mix a [] = [(a,1)]
+ mix a (bn@(b,n):bs) | a == b = (b,n+1):bs
+ | otherwise = bn : mix a bs
+
+permBag :: Bag a -> [[a]]
+permBag [] = [[]]
+permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
+ where
+ oneOfEach [] = []
+ oneOfEach (an@(a,n):bs) =
+ let bs' = if n == 1 then bs else (a,n-1):bs
+ in (a,bs') : mapSnd (an:) (oneOfEach bs)
+
+ apSnd f (a,b) = (a, f b)
+ mapSnd = map . apSnd
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ theme: "elegant"
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>
+ </article>