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 [23/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/scheme/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/scheme/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/scheme/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/scheme/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,77 @@
+<!doctype html>
+
+<title>CodeMirror: Scheme 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="scheme.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="#">Scheme</a>
+ </ul>
+</div>
+
+<article>
+<h2>Scheme mode</h2>
+<form><textarea id="code" name="code">
+; See if the input starts with a given symbol.
+(define (match-symbol input pattern)
+ (cond ((null? (remain input)) #f)
+ ((eqv? (car (remain input)) pattern) (r-cdr input))
+ (else #f)))
+
+; Allow the input to start with one of a list of patterns.
+(define (match-or input pattern)
+ (cond ((null? pattern) #f)
+ ((match-pattern input (car pattern)))
+ (else (match-or input (cdr pattern)))))
+
+; Allow a sequence of patterns.
+(define (match-seq input pattern)
+ (if (null? pattern)
+ input
+ (let ((match (match-pattern input (car pattern))))
+ (if match (match-seq match (cdr pattern)) #f))))
+
+; Match with the pattern but no problem if it does not match.
+(define (match-opt input pattern)
+ (let ((match (match-pattern input (car pattern))))
+ (if match match input)))
+
+; Match anything (other than '()), until pattern is found. The rather
+; clumsy form of requiring an ending pattern is needed to decide where
+; the end of the match is. If none is given, this will match the rest
+; of the sentence.
+(define (match-any input pattern)
+ (cond ((null? (remain input)) #f)
+ ((null? pattern) (f-cons (remain input) (clear-remain input)))
+ (else
+ (let ((accum-any (collector)))
+ (define (match-pattern-any input pattern)
+ (cond ((null? (remain input)) #f)
+ (else (accum-any (car (remain input)))
+ (cond ((match-pattern (r-cdr input) pattern))
+ (else (match-pattern-any (r-cdr input) pattern))))))
+ (let ((retval (match-pattern-any input (car pattern))))
+ (if retval
+ (f-cons (accum-any) retval)
+ #f))))))
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-scheme</code>.</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/scheme/scheme.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/scheme/scheme.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/scheme/scheme.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/scheme/scheme.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,232 @@
+/**
+ * Author: Koh Zi Han, based on implementation by Koh Zi Chun
+ */
+CodeMirror.defineMode("scheme", function () {
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
+ ATOM = "atom", NUMBER = "number", BRACKET = "bracket";
+ var INDENT_WORD_SKIP = 2;
+
+ function makeKeywords(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+
+ var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port c
urrent-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbo
l? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
+ var indentKeys = makeKeywords("define let letrec let* lambda");
+
+ function stateStack(indent, type, prev) { // represents a state stack object
+ this.indent = indent;
+ this.type = type;
+ this.prev = prev;
+ }
+
+ function pushStack(state, indent, type) {
+ state.indentStack = new stateStack(indent, type, state.indentStack);
+ }
+
+ function popStack(state) {
+ state.indentStack = state.indentStack.prev;
+ }
+
+ var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i);
+ var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i);
+ var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i);
+ var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i);
+
+ function isBinaryNumber (stream) {
+ return stream.match(binaryMatcher);
+ }
+
+ function isOctalNumber (stream) {
+ return stream.match(octalMatcher);
+ }
+
+ function isDecimalNumber (stream, backup) {
+ if (backup === true) {
+ stream.backUp(1);
+ }
+ return stream.match(decimalMatcher);
+ }
+
+ function isHexNumber (stream) {
+ return stream.match(hexMatcher);
+ }
+
+ return {
+ startState: function () {
+ return {
+ indentStack: null,
+ indentation: 0,
+ mode: false,
+ sExprComment: false
+ };
+ },
+
+ token: function (stream, state) {
+ if (state.indentStack == null && stream.sol()) {
+ // update indentation, but only if indentStack is empty
+ state.indentation = stream.indentation();
+ }
+
+ // skip spaces
+ if (stream.eatSpace()) {
+ return null;
+ }
+ var returnType = null;
+
+ switch(state.mode){
+ case "string": // multi-line string parsing mode
+ var next, escaped = false;
+ while ((next = stream.next()) != null) {
+ if (next == "\"" && !escaped) {
+
+ state.mode = false;
+ break;
+ }
+ escaped = !escaped && next == "\\";
+ }
+ returnType = STRING; // continue on in scheme-string mode
+ break;
+ case "comment": // comment parsing mode
+ var next, maybeEnd = false;
+ while ((next = stream.next()) != null) {
+ if (next == "#" && maybeEnd) {
+
+ state.mode = false;
+ break;
+ }
+ maybeEnd = (next == "|");
+ }
+ returnType = COMMENT;
+ break;
+ case "s-expr-comment": // s-expr commenting mode
+ state.mode = false;
+ if(stream.peek() == "(" || stream.peek() == "["){
+ // actually start scheme s-expr commenting mode
+ state.sExprComment = 0;
+ }else{
+ // if not we just comment the entire of the next token
+ stream.eatWhile(/[^/s]/); // eat non spaces
+ returnType = COMMENT;
+ break;
+ }
+ default: // default parsing mode
+ var ch = stream.next();
+
+ if (ch == "\"") {
+ state.mode = "string";
+ returnType = STRING;
+
+ } else if (ch == "'") {
+ returnType = ATOM;
+ } else if (ch == '#') {
+ if (stream.eat("|")) { // Multi-line comment
+ state.mode = "comment"; // toggle to comment mode
+ returnType = COMMENT;
+ } else if (stream.eat(/[tf]/i)) { // #t/#f (atom)
+ returnType = ATOM;
+ } else if (stream.eat(';')) { // S-Expr comment
+ state.mode = "s-expr-comment";
+ returnType = COMMENT;
+ } else {
+ var numTest = null, hasExactness = false, hasRadix = true;
+ if (stream.eat(/[ei]/i)) {
+ hasExactness = true;
+ } else {
+ stream.backUp(1); // must be radix specifier
+ }
+ if (stream.match(/^#b/i)) {
+ numTest = isBinaryNumber;
+ } else if (stream.match(/^#o/i)) {
+ numTest = isOctalNumber;
+ } else if (stream.match(/^#x/i)) {
+ numTest = isHexNumber;
+ } else if (stream.match(/^#d/i)) {
+ numTest = isDecimalNumber;
+ } else if (stream.match(/^[-+0-9.]/, false)) {
+ hasRadix = false;
+ numTest = isDecimalNumber;
+ // re-consume the intial # if all matches failed
+ } else if (!hasExactness) {
+ stream.eat('#');
+ }
+ if (numTest != null) {
+ if (hasRadix && !hasExactness) {
+ // consume optional exactness after radix
+ stream.match(/^#[ei]/i);
+ }
+ if (numTest(stream))
+ returnType = NUMBER;
+ }
+ }
+ } else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal
+ returnType = NUMBER;
+ } else if (ch == ";") { // comment
+ stream.skipToEnd(); // rest of the line is a comment
+ returnType = COMMENT;
+ } else if (ch == "(" || ch == "[") {
+ var keyWord = ''; var indentTemp = stream.column(), letter;
+ /**
+ Either
+ (indent-word ..
+ (non-indent-word ..
+ (;something else, bracket, etc.
+ */
+
+ while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
+ keyWord += letter;
+ }
+
+ if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
+
+ pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
+ } else { // non-indent word
+ // we continue eating the spaces
+ stream.eatSpace();
+ if (stream.eol() || stream.peek() == ";") {
+ // nothing significant after
+ // we restart indentation 1 space after
+ pushStack(state, indentTemp + 1, ch);
+ } else {
+ pushStack(state, indentTemp + stream.current().length, ch); // else we match
+ }
+ }
+ stream.backUp(stream.current().length - 1); // undo all the eating
+
+ if(typeof state.sExprComment == "number") state.sExprComment++;
+
+ returnType = BRACKET;
+ } else if (ch == ")" || ch == "]") {
+ returnType = BRACKET;
+ if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
+ popStack(state);
+
+ if(typeof state.sExprComment == "number"){
+ if(--state.sExprComment == 0){
+ returnType = COMMENT; // final closing bracket
+ state.sExprComment = false; // turn off s-expr commenting mode
+ }
+ }
+ }
+ } else {
+ stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/);
+
+ if (keywords && keywords.propertyIsEnumerable(stream.current())) {
+ returnType = BUILTIN;
+ } else returnType = "variable";
+ }
+ }
+ return (typeof state.sExprComment == "number") ? COMMENT : returnType;
+ },
+
+ indent: function (state) {
+ if (state.indentStack == null) return state.indentation;
+ return state.indentStack.indent;
+ },
+
+ lineComment: ";;"
+ };
+});
+
+CodeMirror.defineMIME("text/x-scheme", "scheme");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/shell/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/shell/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/shell/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/shell/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,66 @@
+<!doctype html>
+
+<title>CodeMirror: Shell 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=shell.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="#">Shell</a>
+ </ul>
+</div>
+
+<article>
+<h2>Shell mode</h2>
+
+
+<textarea id=code>
+#!/bin/bash
+
+# clone the repository
+git clone http://github.com/garden/tree
+
+# generate HTTPS credentials
+cd tree
+openssl genrsa -aes256 -out https.key 1024
+openssl req -new -nodes -key https.key -out https.csr
+openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt
+cp https.key{,.orig}
+openssl rsa -in https.key.orig -out https.key
+
+# start the server in HTTPS mode
+cd web
+sudo node ../server.js 443 'yes' >> ../node.log &
+
+# here is how to stop the server
+for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do
+ sudo kill -9 $pid 2> /dev/null
+done
+
+exit 0</textarea>
+
+<script>
+ var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+ mode: 'shell',
+ lineNumbers: true,
+ matchBrackets: true
+ });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-sh</code>.</p>
+</article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/shell/shell.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/shell/shell.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/shell/shell.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/shell/shell.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,118 @@
+CodeMirror.defineMode('shell', function() {
+
+ var words = {};
+ function define(style, string) {
+ var split = string.split(' ');
+ for(var i = 0; i < split.length; i++) {
+ words[split[i]] = style;
+ }
+ };
+
+ // Atoms
+ define('atom', 'true false');
+
+ // Keywords
+ define('keyword', 'if then do else elif while until for in esac fi fin ' +
+ 'fil done exit set unset export function');
+
+ // Commands
+ define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' +
+ 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' +
+ 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' +
+ 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' +
+ 'touch vi vim wall wc wget who write yes zsh');
+
+ function tokenBase(stream, state) {
+
+ var sol = stream.sol();
+ var ch = stream.next();
+
+ if (ch === '\'' || ch === '"' || ch === '`') {
+ state.tokens.unshift(tokenString(ch));
+ return tokenize(stream, state);
+ }
+ if (ch === '#') {
+ if (sol && stream.eat('!')) {
+ stream.skipToEnd();
+ return 'meta'; // 'comment'?
+ }
+ stream.skipToEnd();
+ return 'comment';
+ }
+ if (ch === '$') {
+ state.tokens.unshift(tokenDollar);
+ return tokenize(stream, state);
+ }
+ if (ch === '+' || ch === '=') {
+ return 'operator';
+ }
+ if (ch === '-') {
+ stream.eat('-');
+ stream.eatWhile(/\w/);
+ return 'attribute';
+ }
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/\d/);
+ if(!/\w/.test(stream.peek())) {
+ return 'number';
+ }
+ }
+ stream.eatWhile(/[\w-]/);
+ var cur = stream.current();
+ if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
+ return words.hasOwnProperty(cur) ? words[cur] : null;
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ var next, end = false, escaped = false;
+ while ((next = stream.next()) != null) {
+ if (next === quote && !escaped) {
+ end = true;
+ break;
+ }
+ if (next === '$' && !escaped && quote !== '\'') {
+ escaped = true;
+ stream.backUp(1);
+ state.tokens.unshift(tokenDollar);
+ break;
+ }
+ escaped = !escaped && next === '\\';
+ }
+ if (end || !escaped) {
+ state.tokens.shift();
+ }
+ return (quote === '`' || quote === ')' ? 'quote' : 'string');
+ };
+ };
+
+ var tokenDollar = function(stream, state) {
+ if (state.tokens.length > 1) stream.eat('$');
+ var ch = stream.next(), hungry = /\w/;
+ if (ch === '{') hungry = /[^}]/;
+ if (ch === '(') {
+ state.tokens[0] = tokenString(')');
+ return tokenize(stream, state);
+ }
+ if (!/\d/.test(ch)) {
+ stream.eatWhile(hungry);
+ stream.eat('}');
+ }
+ state.tokens.shift();
+ return 'def';
+ };
+
+ function tokenize(stream, state) {
+ return (state.tokens[0] || tokenBase) (stream, state);
+ };
+
+ return {
+ startState: function() {return {tokens:[]};},
+ token: function(stream, state) {
+ if (stream.eatSpace()) return null;
+ return tokenize(stream, state);
+ }
+ };
+});
+
+CodeMirror.defineMIME('text/x-sh', 'shell');
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sieve/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/sieve/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/sieve/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sieve/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,93 @@
+<!doctype html>
+
+<title>CodeMirror: Sieve (RFC5228) 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="sieve.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="#">Sieve (RFC5228)</a>
+ </ul>
+</div>
+
+<article>
+<h2>Sieve (RFC5228) mode</h2>
+<form><textarea id="code" name="code">
+#
+# Example Sieve Filter
+# Declare any optional features or extension used by the script
+#
+
+require ["fileinto", "reject"];
+
+#
+# Reject any large messages (note that the four leading dots get
+# "stuffed" to three)
+#
+if size :over 1M
+{
+ reject text:
+Please do not send me large attachments.
+Put your file on a server and send me the URL.
+Thank you.
+.... Fred
+.
+;
+ stop;
+}
+
+#
+# Handle messages from known mailing lists
+# Move messages from IETF filter discussion list to filter folder
+#
+if header :is "Sender" "owner-ietf-mta-filters@imc.org"
+{
+ fileinto "filter"; # move to "filter" folder
+}
+#
+# Keep all messages to or from people in my company
+#
+elsif address :domain :is ["From", "To"] "example.com"
+{
+ keep; # keep in "In" folder
+}
+
+#
+# Try and catch unsolicited email. If a message is not to me,
+# or it contains a subject known to be spam, file it away.
+#
+elsif anyof (not address :all :contains
+ ["To", "Cc", "Bcc"] "me@example.com",
+ header :matches "subject"
+ ["*make*money*fast*", "*university*dipl*mas*"])
+{
+ # If message header does not contain my address,
+ # it's from a list.
+ fileinto "spam"; # move to "spam" folder
+}
+else
+{
+ # Move all other (non-company) mail to "personal"
+ # folder.
+ fileinto "personal";
+}
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>application/sieve</code>.</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sieve/sieve.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/sieve/sieve.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/sieve/sieve.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sieve/sieve.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,183 @@
+/*
+ * See LICENSE in this directory for the license under which this code
+ * is released.
+ */
+
+CodeMirror.defineMode("sieve", 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("if elsif else stop require");
+ var atoms = words("true false not");
+ var indentUnit = config.indentUnit;
+
+ function tokenBase(stream, state) {
+
+ var ch = stream.next();
+ if (ch == "/" && stream.eat("*")) {
+ state.tokenize = tokenCComment;
+ return tokenCComment(stream, state);
+ }
+
+ if (ch === '#') {
+ stream.skipToEnd();
+ return "comment";
+ }
+
+ if (ch == "\"") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ }
+
+ if (ch == "(") {
+ state._indent.push("(");
+ // add virtual angel wings so that editor behaves...
+ // ...more sane incase of broken brackets
+ state._indent.push("{");
+ return null;
+ }
+
+ if (ch === "{") {
+ state._indent.push("{");
+ return null;
+ }
+
+ if (ch == ")") {
+ state._indent.pop();
+ state._indent.pop();
+ }
+
+ if (ch === "}") {
+ state._indent.pop();
+ return null;
+ }
+
+ if (ch == ",")
+ return null;
+
+ if (ch == ";")
+ return null;
+
+
+ if (/[{}\(\),;]/.test(ch))
+ return null;
+
+ // 1*DIGIT "K" / "M" / "G"
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/[\d]/);
+ stream.eat(/[KkMmGg]/);
+ return "number";
+ }
+
+ // ":" (ALPHA / "_") *(ALPHA / DIGIT / "_")
+ if (ch == ":") {
+ stream.eatWhile(/[a-zA-Z_]/);
+ stream.eatWhile(/[a-zA-Z0-9_]/);
+
+ return "operator";
+ }
+
+ stream.eatWhile(/\w/);
+ var cur = stream.current();
+
+ // "text:" *(SP / HTAB) (hash-comment / CRLF)
+ // *(multiline-literal / multiline-dotstart)
+ // "." CRLF
+ if ((cur == "text") && stream.eat(":"))
+ {
+ state.tokenize = tokenMultiLineString;
+ return "string";
+ }
+
+ if (keywords.propertyIsEnumerable(cur))
+ return "keyword";
+
+ if (atoms.propertyIsEnumerable(cur))
+ return "atom";
+
+ return null;
+ }
+
+ function tokenMultiLineString(stream, state)
+ {
+ state._multiLineString = true;
+ // the first line is special it may contain a comment
+ if (!stream.sol()) {
+ stream.eatSpace();
+
+ if (stream.peek() == "#") {
+ stream.skipToEnd();
+ return "comment";
+ }
+
+ stream.skipToEnd();
+ return "string";
+ }
+
+ if ((stream.next() == ".") && (stream.eol()))
+ {
+ state._multiLineString = false;
+ state.tokenize = tokenBase;
+ }
+
+ return "string";
+ }
+
+ function tokenCComment(stream, state) {
+ var maybeEnd = false, ch;
+ while ((ch = stream.next()) != null) {
+ if (maybeEnd && ch == "/") {
+ state.tokenize = tokenBase;
+ break;
+ }
+ maybeEnd = (ch == "*");
+ }
+ return "comment";
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ var escaped = false, ch;
+ while ((ch = stream.next()) != null) {
+ if (ch == quote && !escaped)
+ break;
+ escaped = !escaped && ch == "\\";
+ }
+ if (!escaped) state.tokenize = tokenBase;
+ return "string";
+ };
+ }
+
+ return {
+ startState: function(base) {
+ return {tokenize: tokenBase,
+ baseIndent: base || 0,
+ _indent: []};
+ },
+
+ token: function(stream, state) {
+ if (stream.eatSpace())
+ return null;
+
+ return (state.tokenize || tokenBase)(stream, state);;
+ },
+
+ indent: function(state, _textAfter) {
+ var length = state._indent.length;
+ if (_textAfter && (_textAfter[0] == "}"))
+ length--;
+
+ if (length <0)
+ length = 0;
+
+ return length * indentUnit;
+ },
+
+ electricChars: "}"
+ };
+});
+
+CodeMirror.defineMIME("application/sieve", "sieve");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smalltalk/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/smalltalk/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/smalltalk/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smalltalk/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,68 @@
+<!doctype html>
+
+<title>CodeMirror: Smalltalk 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="smalltalk.js"></script>
+<style>
+ .CodeMirror {border: 2px solid #dee; border-right-width: 10px;}
+ .CodeMirror-gutter {border: none; background: #dee;}
+ .CodeMirror-gutter pre {color: white; font-weight: bold;}
+ </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="#">Smalltalk</a>
+ </ul>
+</div>
+
+<article>
+<h2>Smalltalk mode</h2>
+<form><textarea id="code" name="code">
+"
+ This is a test of the Smalltalk code
+"
+Seaside.WAComponent subclass: #MyCounter [
+ | count |
+ MyCounter class >> canBeRoot [ ^true ]
+
+ initialize [
+ super initialize.
+ count := 0.
+ ]
+ states [ ^{ self } ]
+ renderContentOn: html [
+ html heading: count.
+ html anchor callback: [ count := count + 1 ]; with: '++'.
+ html space.
+ html anchor callback: [ count := count - 1 ]; with: '--'.
+ ]
+]
+
+MyCounter registerAsApplication: 'mycounter'
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/x-stsrc",
+ indentUnit: 4
+ });
+ </script>
+
+ <p>Simple Smalltalk mode.</p>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smalltalk/smalltalk.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/smalltalk/smalltalk.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/smalltalk/smalltalk.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smalltalk/smalltalk.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,151 @@
+CodeMirror.defineMode('smalltalk', function(config) {
+
+ var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/;
+ var keywords = /true|false|nil|self|super|thisContext/;
+
+ var Context = function(tokenizer, parent) {
+ this.next = tokenizer;
+ this.parent = parent;
+ };
+
+ var Token = function(name, context, eos) {
+ this.name = name;
+ this.context = context;
+ this.eos = eos;
+ };
+
+ var State = function() {
+ this.context = new Context(next, null);
+ this.expectVariable = true;
+ this.indentation = 0;
+ this.userIndentationDelta = 0;
+ };
+
+ State.prototype.userIndent = function(indentation) {
+ this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
+ };
+
+ var next = function(stream, context, state) {
+ var token = new Token(null, context, false);
+ var aChar = stream.next();
+
+ if (aChar === '"') {
+ token = nextComment(stream, new Context(nextComment, context));
+
+ } else if (aChar === '\'') {
+ token = nextString(stream, new Context(nextString, context));
+
+ } else if (aChar === '#') {
+ if (stream.peek() === '\'') {
+ stream.next();
+ token = nextSymbol(stream, new Context(nextSymbol, context));
+ } else {
+ stream.eatWhile(/[^ .\[\]()]/);
+ token.name = 'string-2';
+ }
+
+ } else if (aChar === '$') {
+ if (stream.next() === '<') {
+ stream.eatWhile(/[^ >]/);
+ stream.next();
+ }
+ token.name = 'string-2';
+
+ } else if (aChar === '|' && state.expectVariable) {
+ token.context = new Context(nextTemporaries, context);
+
+ } else if (/[\[\]{}()]/.test(aChar)) {
+ token.name = 'bracket';
+ token.eos = /[\[{(]/.test(aChar);
+
+ if (aChar === '[') {
+ state.indentation++;
+ } else if (aChar === ']') {
+ state.indentation = Math.max(0, state.indentation - 1);
+ }
+
+ } else if (specialChars.test(aChar)) {
+ stream.eatWhile(specialChars);
+ token.name = 'operator';
+ token.eos = aChar !== ';'; // ; cascaded message expression
+
+ } else if (/\d/.test(aChar)) {
+ stream.eatWhile(/[\w\d]/);
+ token.name = 'number';
+
+ } else if (/[\w_]/.test(aChar)) {
+ stream.eatWhile(/[\w\d_]/);
+ token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
+
+ } else {
+ token.eos = state.expectVariable;
+ }
+
+ return token;
+ };
+
+ var nextComment = function(stream, context) {
+ stream.eatWhile(/[^"]/);
+ return new Token('comment', stream.eat('"') ? context.parent : context, true);
+ };
+
+ var nextString = function(stream, context) {
+ stream.eatWhile(/[^']/);
+ return new Token('string', stream.eat('\'') ? context.parent : context, false);
+ };
+
+ var nextSymbol = function(stream, context) {
+ stream.eatWhile(/[^']/);
+ return new Token('string-2', stream.eat('\'') ? context.parent : context, false);
+ };
+
+ var nextTemporaries = function(stream, context) {
+ var token = new Token(null, context, false);
+ var aChar = stream.next();
+
+ if (aChar === '|') {
+ token.context = context.parent;
+ token.eos = true;
+
+ } else {
+ stream.eatWhile(/[^|]/);
+ token.name = 'variable';
+ }
+
+ return token;
+ };
+
+ return {
+ startState: function() {
+ return new State;
+ },
+
+ token: function(stream, state) {
+ state.userIndent(stream.indentation());
+
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ var token = state.context.next(stream, state.context, state);
+ state.context = token.context;
+ state.expectVariable = token.eos;
+
+ return token.name;
+ },
+
+ blankLine: function(state) {
+ state.userIndent(0);
+ },
+
+ indent: function(state, textAfter) {
+ var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
+ return (state.indentation + i) * config.indentUnit;
+ },
+
+ electricChars: ']'
+ };
+
+});
+
+CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smarty/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/smarty/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/smarty/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smarty/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,136 @@
+<!doctype html>
+
+<title>CodeMirror: Smarty 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="smarty.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="#">Smarty</a>
+ </ul>
+</div>
+
+<article>
+<h2>Smarty mode</h2>
+<form><textarea id="code" name="code">
+{extends file="parent.tpl"}
+{include file="template.tpl"}
+
+{* some example Smarty content *}
+{if isset($name) && $name == 'Blog'}
+ This is a {$var}.
+ {$integer = 451}, {$array[] = "a"}, {$stringvar = "string"}
+ {assign var='bob' value=$var.prop}
+{elseif $name == $foo}
+ {function name=menu level=0}
+ {foreach $data as $entry}
+ {if is_array($entry)}
+ - {$entry@key}
+ {menu data=$entry level=$level+1}
+ {else}
+ {$entry}
+ {/if}
+ {/foreach}
+ {/function}
+{/if}</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ mode: "smarty"
+ });
+ </script>
+
+ <br />
+
+ <h3>Smarty 2, custom delimiters</h3>
+ <form><textarea id="code2" name="code2">
+{--extends file="parent.tpl"--}
+{--include file="template.tpl"--}
+
+{--* some example Smarty content *--}
+{--if isset($name) && $name == 'Blog'--}
+ This is a {--$var--}.
+ {--$integer = 451--}, {--$array[] = "a"--}, {--$stringvar = "string"--}
+ {--assign var='bob' value=$var.prop--}
+{--elseif $name == $foo--}
+ {--function name=menu level=0--}
+ {--foreach $data as $entry--}
+ {--if is_array($entry)--}
+ - {--$entry@key--}
+ {--menu data=$entry level=$level+1--}
+ {--else--}
+ {--$entry--}
+ {--/if--}
+ {--/foreach--}
+ {--/function--}
+{--/if--}</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {
+ lineNumbers: true,
+ mode: {
+ name: "smarty",
+ leftDelimiter: "{--",
+ rightDelimiter: "--}"
+ }
+ });
+ </script>
+
+ <br />
+
+ <h3>Smarty 3</h3>
+
+ <textarea id="code3" name="code3">
+Nested tags {$foo={counter one=1 two={inception}}+3} are now valid in Smarty 3.
+
+<script>
+function test() {
+ console.log("Smarty 3 permits single curly braces followed by whitespace to NOT slip into Smarty mode.");
+}
+</script>
+
+{assign var=foo value=[1,2,3]}
+{assign var=foo value=['y'=>'yellow','b'=>'blue']}
+{assign var=foo value=[1,[9,8],3]}
+
+{$foo=$bar+2} {* a comment *}
+{$foo.bar=1} {* another comment *}
+{$foo = myfunct(($x+$y)*3)}
+{$foo = strlen($bar)}
+{$foo.bar.baz=1}, {$foo[]=1}
+
+Smarty "dot" syntax (note: embedded {} are used to address ambiguities):
+
+{$foo.a.b.c} => $foo['a']['b']['c']
+{$foo.a.$b.c} => $foo['a'][$b]['c']
+{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c']
+{$foo.a.{$b.c}} => $foo['a'][$b['c']]
+
+{$object->method1($x)->method2($y)}</textarea>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code3"), {
+ lineNumbers: true,
+ mode: "smarty",
+ smartyVersion: 3
+ });
+ </script>
+
+
+ <p>A plain text/Smarty version 2 or 3 mode, which allows for custom delimiter tags.</p>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-smarty</code></p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smarty/smarty.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/smarty/smarty.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/smarty/smarty.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smarty/smarty.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,205 @@
+/**
+ * Smarty 2 and 3 mode.
+ */
+CodeMirror.defineMode("smarty", function(config) {
+ "use strict";
+
+ // our default settings; check to see if they're overridden
+ var settings = {
+ rightDelimiter: '}',
+ leftDelimiter: '{',
+ smartyVersion: 2 // for backward compatibility
+ };
+ if (config.hasOwnProperty("leftDelimiter")) {
+ settings.leftDelimiter = config.leftDelimiter;
+ }
+ if (config.hasOwnProperty("rightDelimiter")) {
+ settings.rightDelimiter = config.rightDelimiter;
+ }
+ if (config.hasOwnProperty("smartyVersion") && config.smartyVersion === 3) {
+ settings.smartyVersion = 3;
+ }
+
+ var keyFunctions = ["debug", "extends", "function", "include", "literal"];
+ var last;
+ var regs = {
+ operatorChars: /[+\-*&%=<>!?]/,
+ validIdentifier: /[a-zA-Z0-9_]/,
+ stringChar: /['"]/
+ };
+
+ var helpers = {
+ cont: function(style, lastType) {
+ last = lastType;
+ return style;
+ },
+ chain: function(stream, state, parser) {
+ state.tokenize = parser;
+ return parser(stream, state);
+ }
+ };
+
+
+ // our various parsers
+ var parsers = {
+
+ // the main tokenizer
+ tokenizer: function(stream, state) {
+ if (stream.match(settings.leftDelimiter, true)) {
+ if (stream.eat("*")) {
+ return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter));
+ } else {
+ // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode
+ state.depth++;
+ var isEol = stream.eol();
+ var isFollowedByWhitespace = /\s/.test(stream.peek());
+ if (settings.smartyVersion === 3 && settings.leftDelimiter === "{" && (isEol || isFollowedByWhitespace)) {
+ state.depth--;
+ return null;
+ } else {
+ state.tokenize = parsers.smarty;
+ last = "startTag";
+ return "tag";
+ }
+ }
+ } else {
+ stream.next();
+ return null;
+ }
+ },
+
+ // parsing Smarty content
+ smarty: function(stream, state) {
+ if (stream.match(settings.rightDelimiter, true)) {
+ if (settings.smartyVersion === 3) {
+ state.depth--;
+ if (state.depth <= 0) {
+ state.tokenize = parsers.tokenizer;
+ }
+ } else {
+ state.tokenize = parsers.tokenizer;
+ }
+ return helpers.cont("tag", null);
+ }
+
+ if (stream.match(settings.leftDelimiter, true)) {
+ state.depth++;
+ return helpers.cont("tag", "startTag");
+ }
+
+ var ch = stream.next();
+ if (ch == "$") {
+ stream.eatWhile(regs.validIdentifier);
+ return helpers.cont("variable-2", "variable");
+ } else if (ch == "|") {
+ return helpers.cont("operator", "pipe");
+ } else if (ch == ".") {
+ return helpers.cont("operator", "property");
+ } else if (regs.stringChar.test(ch)) {
+ state.tokenize = parsers.inAttribute(ch);
+ return helpers.cont("string", "string");
+ } else if (regs.operatorChars.test(ch)) {
+ stream.eatWhile(regs.operatorChars);
+ return helpers.cont("operator", "operator");
+ } else if (ch == "[" || ch == "]") {
+ return helpers.cont("bracket", "bracket");
+ } else if (ch == "(" || ch == ")") {
+ return helpers.cont("bracket", "operator");
+ } else if (/\d/.test(ch)) {
+ stream.eatWhile(/\d/);
+ return helpers.cont("number", "number");
+ } else {
+
+ if (state.last == "variable") {
+ if (ch == "@") {
+ stream.eatWhile(regs.validIdentifier);
+ return helpers.cont("property", "property");
+ } else if (ch == "|") {
+ stream.eatWhile(regs.validIdentifier);
+ return helpers.cont("qualifier", "modifier");
+ }
+ } else if (state.last == "pipe") {
+ stream.eatWhile(regs.validIdentifier);
+ return helpers.cont("qualifier", "modifier");
+ } else if (state.last == "whitespace") {
+ stream.eatWhile(regs.validIdentifier);
+ return helpers.cont("attribute", "modifier");
+ } if (state.last == "property") {
+ stream.eatWhile(regs.validIdentifier);
+ return helpers.cont("property", null);
+ } else if (/\s/.test(ch)) {
+ last = "whitespace";
+ return null;
+ }
+
+ var str = "";
+ if (ch != "/") {
+ str += ch;
+ }
+ var c = null;
+ while (c = stream.eat(regs.validIdentifier)) {
+ str += c;
+ }
+ for (var i=0, j=keyFunctions.length; i<j; i++) {
+ if (keyFunctions[i] == str) {
+ return helpers.cont("keyword", "keyword");
+ }
+ }
+ if (/\s/.test(ch)) {
+ return null;
+ }
+ return helpers.cont("tag", "tag");
+ }
+ },
+
+ inAttribute: function(quote) {
+ return function(stream, state) {
+ var prevChar = null;
+ var currChar = null;
+ while (!stream.eol()) {
+ currChar = stream.peek();
+ if (stream.next() == quote && prevChar !== '\\') {
+ state.tokenize = parsers.smarty;
+ break;
+ }
+ prevChar = currChar;
+ }
+ return "string";
+ };
+ },
+
+ inBlock: function(style, terminator) {
+ return function(stream, state) {
+ while (!stream.eol()) {
+ if (stream.match(terminator)) {
+ state.tokenize = parsers.tokenizer;
+ break;
+ }
+ stream.next();
+ }
+ return style;
+ };
+ }
+ };
+
+
+ // the public API for CodeMirror
+ return {
+ startState: function() {
+ return {
+ tokenize: parsers.tokenizer,
+ mode: "smarty",
+ last: null,
+ depth: 0
+ };
+ },
+ token: function(stream, state) {
+ var style = state.tokenize(stream, state);
+ state.last = last;
+ return style;
+ },
+ electricChars: ""
+ };
+});
+
+CodeMirror.defineMIME("text/x-smarty", "smarty");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smartymixed/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/smartymixed/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/smartymixed/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smartymixed/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,114 @@
+<!doctype html>
+
+<title>CodeMirror: Smarty 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="../../mode/xml/xml.js"></script>
+<script src="../../mode/javascript/javascript.js"></script>
+<script src="../../mode/css/css.js"></script>
+<script src="../../mode/htmlmixed/htmlmixed.js"></script>
+<script src="../../mode/smarty/smarty.js"></script>
+<script src="../../mode/smartymixed/smartymixed.js"></script>
+<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="#">Smarty mixed</a>
+ </ul>
+</div>
+
+<article>
+<h2>Smarty mixed mode</h2>
+<form><textarea id="code" name="code">
+{**
+* @brief Smarty mixed mode
+* @author Ruslan Osmanov
+* @date 29.06.2013
+*}
+<html>
+<head>
+ <title>{$title|htmlspecialchars|truncate:30}</title>
+</head>
+<body>
+ {* Multiline smarty
+ * comment, no {$variables} here
+ *}
+ {literal}
+ {literal} is just an HTML text.
+ <script type="text/javascript">//<![CDATA[
+ var a = {$just_a_normal_js_object : "value"};
+ var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode : "smartymixed",
+ tabSize : 2,
+ indentUnit : 2,
+ indentWithTabs : false,
+ lineNumbers : true,
+ smartyVersion : 3
+ });
+ // ]]>
+ </script>
+ <style>
+ /* CSS content
+ {$no_smarty} */
+ .some-class { font-weight: bolder; color: "orange"; }
+ </style>
+ {/literal}
+
+ {extends file="parent.tpl"}
+ {include file="template.tpl"}
+
+ {* some example Smarty content *}
+ {if isset($name) && $name == 'Blog'}
+ This is a {$var}.
+ {$integer = 4511}, {$array[] = "a"}, {$stringvar = "string"}
+ {$integer = 4512} {$array[] = "a"} {$stringvar = "string"}
+ {assign var='bob' value=$var.prop}
+ {elseif $name == $foo}
+ {function name=menu level=0}
+ {foreach $data as $entry}
+ {if is_array($entry)}
+ - {$entry@key}
+ {menu data=$entry level=$level+1}
+ {else}
+ {$entry}
+ {* One
+ * Two
+ * Three
+ *}
+ {/if}
+ {/foreach}
+ {/function}
+ {/if}
+ </body>
+ <!-- R.O. -->
+</html>
+</textarea></form>
+
+ <script type="text/javascript">
+ var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode : "smartymixed",
+ tabSize : 2,
+ indentUnit : 2,
+ indentWithTabs : false,
+ lineNumbers : true,
+ smartyVersion : 3,
+ matchBrackets : true,
+ });
+ </script>
+
+ <p>The Smarty mixed mode depends on the Smarty and HTML mixed modes. HTML
+ mixed mode itself depends on XML, JavaScript, and CSS modes.</p>
+
+ <p>It takes the same options, as Smarty and HTML mixed modes.</p>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-smarty</code>.</p>
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smartymixed/smartymixed.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/smartymixed/smartymixed.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/smartymixed/smartymixed.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/smartymixed/smartymixed.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,170 @@
+/**
+* @file smartymixed.js
+* @brief Smarty Mixed Codemirror mode (Smarty + Mixed HTML)
+* @author Ruslan Osmanov <rrosmanov at gmail dot com>
+* @version 3.0
+* @date 05.07.2013
+*/
+CodeMirror.defineMode("smartymixed", function(config) {
+ var settings, regs, helpers, parsers,
+ htmlMixedMode = CodeMirror.getMode(config, "htmlmixed"),
+ smartyMode = CodeMirror.getMode(config, "smarty"),
+
+ settings = {
+ rightDelimiter: '}',
+ leftDelimiter: '{'
+ };
+
+ if (config.hasOwnProperty("leftDelimiter")) {
+ settings.leftDelimiter = config.leftDelimiter;
+ }
+ if (config.hasOwnProperty("rightDelimiter")) {
+ settings.rightDelimiter = config.rightDelimiter;
+ }
+
+ regs = {
+ smartyComment: new RegExp("^" + settings.leftDelimiter + "\\*"),
+ literalOpen: new RegExp(settings.leftDelimiter + "literal" + settings.rightDelimiter),
+ literalClose: new RegExp(settings.leftDelimiter + "\/literal" + settings.rightDelimiter),
+ hasLeftDelimeter: new RegExp(".*" + settings.leftDelimiter),
+ htmlHasLeftDelimeter: new RegExp("[^<>]*" + settings.leftDelimiter)
+ };
+
+ helpers = {
+ chain: function(stream, state, parser) {
+ state.tokenize = parser;
+ return parser(stream, state);
+ },
+
+ cleanChain: function(stream, state, parser) {
+ state.tokenize = null;
+ state.localState = null;
+ state.localMode = null;
+ return (typeof parser == "string") ? (parser ? parser : null) : parser(stream, state);
+ },
+
+ maybeBackup: function(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;
+ }
+ };
+
+ parsers = {
+ html: function(stream, state) {
+ if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false)) {
+ state.tokenize = parsers.smarty;
+ state.localMode = smartyMode;
+ state.localState = smartyMode.startState(htmlMixedMode.indent(state.htmlMixedState, ""));
+ return helpers.maybeBackup(stream, settings.leftDelimiter, smartyMode.token(stream, state.localState));
+ }
+ return htmlMixedMode.token(stream, state.htmlMixedState);
+ },
+
+ smarty: function(stream, state) {
+ if (stream.match(settings.leftDelimiter, false)) {
+ if (stream.match(regs.smartyComment, false)) {
+ return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter));
+ }
+ } else if (stream.match(settings.rightDelimiter, false)) {
+ stream.eat(settings.rightDelimiter);
+ state.tokenize = parsers.html;
+ state.localMode = htmlMixedMode;
+ state.localState = state.htmlMixedState;
+ return "tag";
+ }
+
+ return helpers.maybeBackup(stream, settings.rightDelimiter, smartyMode.token(stream, state.localState));
+ },
+
+ inBlock: function(style, terminator) {
+ return function(stream, state) {
+ while (!stream.eol()) {
+ if (stream.match(terminator)) {
+ helpers.cleanChain(stream, state, "");
+ break;
+ }
+ stream.next();
+ }
+ return style;
+ };
+ }
+ };
+
+ return {
+ startState: function() {
+ var state = htmlMixedMode.startState();
+ return {
+ token: parsers.html,
+ localMode: null,
+ localState: null,
+ htmlMixedState: state,
+ tokenize: null,
+ inLiteral: false
+ };
+ },
+
+ copyState: function(state) {
+ var local = null, tok = (state.tokenize || state.token);
+ if (state.localState) {
+ local = CodeMirror.copyState((tok != parsers.html ? smartyMode : htmlMixedMode), state.localState);
+ }
+ return {
+ token: state.token,
+ tokenize: state.tokenize,
+ localMode: state.localMode,
+ localState: local,
+ htmlMixedState: CodeMirror.copyState(htmlMixedMode, state.htmlMixedState),
+ inLiteral: state.inLiteral
+ };
+ },
+
+ token: function(stream, state) {
+ if (stream.match(settings.leftDelimiter, false)) {
+ if (!state.inLiteral && stream.match(regs.literalOpen, true)) {
+ state.inLiteral = true;
+ return "keyword";
+ } else if (state.inLiteral && stream.match(regs.literalClose, true)) {
+ state.inLiteral = false;
+ return "keyword";
+ }
+ }
+ if (state.inLiteral && state.localState != state.htmlMixedState) {
+ state.tokenize = parsers.html;
+ state.localMode = htmlMixedMode;
+ state.localState = state.htmlMixedState;
+ }
+
+ var style = (state.tokenize || state.token)(stream, state);
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ if (state.localMode == smartyMode
+ || (state.inLiteral && !state.localMode)
+ || regs.hasLeftDelimeter.test(textAfter)) {
+ return CodeMirror.Pass;
+ }
+ return htmlMixedMode.indent(state.htmlMixedState, textAfter);
+ },
+
+ electricChars: "/{}:",
+
+ innerMode: function(state) {
+ return {
+ state: state.localState || state.htmlMixedState,
+ mode: state.localMode || htmlMixedMode
+ };
+ }
+ };
+},
+"htmlmixed");
+
+CodeMirror.defineMIME("text/x-smarty", "smartymixed");
+// vim: et ts=2 sts=2 sw=2
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sparql/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/sparql/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/sparql/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sparql/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,54 @@
+<!doctype html>
+
+<title>CodeMirror: SPARQL 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="sparql.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="#">SPARQL</a>
+ </ul>
+</div>
+
+<article>
+<h2>SPARQL mode</h2>
+<form><textarea id="code" name="code">
+PREFIX a: <http://www.w3.org/2000/10/annotation-ns#>
+PREFIX dc: <http://purl.org/dc/elements/1.1/>
+PREFIX foaf: <http://xmlns.com/foaf/0.1/>
+
+# Comment!
+
+SELECT ?given ?family
+WHERE {
+ ?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> .
+ ?annot dc:creator ?c .
+ OPTIONAL {?c foaf:given ?given ;
+ foaf:family ?family } .
+ FILTER isBlank(?c)
+}
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode: "application/x-sparql-query",
+ tabMode: "indent",
+ matchBrackets: true
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>application/x-sparql-query</code>.</p>
+
+ </article>
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sparql/sparql.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/sparql/sparql.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/sparql/sparql.js (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sparql/sparql.js Fri Sep 20 02:29:16 2013
@@ -0,0 +1,145 @@
+CodeMirror.defineMode("sparql", function(config) {
+ var indentUnit = config.indentUnit;
+ var curPunc;
+
+ function wordRegexp(words) {
+ return new RegExp("^(?:" + words.join("|") + ")$", "i");
+ }
+ var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
+ "isblank", "isliteral", "a"]);
+ var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
+ "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
+ "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group",
+ "minus", "in", "not", "service", "silent", "using", "insert", "delete", "union",
+ "data", "copy", "to", "move", "add", "create", "drop", "clear", "load"]);
+ var operatorChars = /[*+\-<>=&|]/;
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ curPunc = null;
+ if (ch == "$" || ch == "?") {
+ stream.match(/^[\w\d]*/);
+ return "variable-2";
+ }
+ else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
+ stream.match(/^[^\s\u00a0>]*>?/);
+ return "atom";
+ }
+ else if (ch == "\"" || ch == "'") {
+ state.tokenize = tokenLiteral(ch);
+ return state.tokenize(stream, state);
+ }
+ else if (/[{}\(\),\.;\[\]]/.test(ch)) {
+ curPunc = ch;
+ return null;
+ }
+ else if (ch == "#") {
+ stream.skipToEnd();
+ return "comment";
+ }
+ else if (operatorChars.test(ch)) {
+ stream.eatWhile(operatorChars);
+ return null;
+ }
+ else if (ch == ":") {
+ stream.eatWhile(/[\w\d\._\-]/);
+ return "atom";
+ }
+ else {
+ stream.eatWhile(/[_\w\d]/);
+ if (stream.eat(":")) {
+ stream.eatWhile(/[\w\d_\-]/);
+ return "atom";
+ }
+ var word = stream.current();
+ if (ops.test(word))
+ return null;
+ else if (keywords.test(word))
+ return "keyword";
+ else
+ return "variable";
+ }
+ }
+
+ function tokenLiteral(quote) {
+ return function(stream, state) {
+ var escaped = false, ch;
+ while ((ch = stream.next()) != null) {
+ if (ch == quote && !escaped) {
+ state.tokenize = tokenBase;
+ break;
+ }
+ escaped = !escaped && ch == "\\";
+ }
+ return "string";
+ };
+ }
+
+ function pushContext(state, type, col) {
+ state.context = {prev: state.context, indent: state.indent, col: col, type: type};
+ }
+ function popContext(state) {
+ state.indent = state.context.indent;
+ state.context = state.context.prev;
+ }
+
+ return {
+ startState: function() {
+ return {tokenize: tokenBase,
+ context: null,
+ indent: 0,
+ col: 0};
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ if (state.context && state.context.align == null) state.context.align = false;
+ state.indent = stream.indentation();
+ }
+ if (stream.eatSpace()) return null;
+ var style = state.tokenize(stream, state);
+
+ if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
+ state.context.align = true;
+ }
+
+ if (curPunc == "(") pushContext(state, ")", stream.column());
+ else if (curPunc == "[") pushContext(state, "]", stream.column());
+ else if (curPunc == "{") pushContext(state, "}", stream.column());
+ else if (/[\]\}\)]/.test(curPunc)) {
+ while (state.context && state.context.type == "pattern") popContext(state);
+ if (state.context && curPunc == state.context.type) popContext(state);
+ }
+ else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
+ else if (/atom|string|variable/.test(style) && state.context) {
+ if (/[\}\]]/.test(state.context.type))
+ pushContext(state, "pattern", stream.column());
+ else if (state.context.type == "pattern" && !state.context.align) {
+ state.context.align = true;
+ state.context.col = stream.column();
+ }
+ }
+
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ var firstChar = textAfter && textAfter.charAt(0);
+ var context = state.context;
+ if (/[\]\}]/.test(firstChar))
+ while (context && context.type == "pattern") context = context.prev;
+
+ var closing = context && firstChar == context.type;
+ if (!context)
+ return 0;
+ else if (context.type == "pattern")
+ return context.col;
+ else if (context.align)
+ return context.col + (closing ? 0 : 1);
+ else
+ return context.indent + (closing ? 0 : indentUnit);
+ }
+ };
+});
+
+CodeMirror.defineMIME("application/x-sparql-query", "sparql");
Added: tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sql/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/sql/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/sql/index.html (added)
+++ tomee/tomee/trunk/tomee/tomee-webaccess/webaccess-gui-libs/codemirror/src/main/resources/META-INF/resources/app/lib/codemirror/mode/sql/index.html Fri Sep 20 02:29:16 2013
@@ -0,0 +1,74 @@
+<!doctype html>
+
+<title>CodeMirror: SQL Mode for CodeMirror</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="sql.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="#">SQL Mode for CodeMirror</a>
+ </ul>
+</div>
+
+<article>
+<h2>SQL Mode for CodeMirror</h2>
+<form>
+ <textarea id="code" name="code">-- SQL Mode for CodeMirror
+SELECT SQL_NO_CACHE DISTINCT
+ @var1 AS `val1`, @'val2', @global.'sql_mode',
+ 1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`,
+ 0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`,
+ DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`,
+ 'my string', _utf8'your string', N'her string',
+ TRUE, FALSE, UNKNOWN
+ FROM DUAL
+ -- space needed after '--'
+ # 1 line comment
+ /* multiline
+ comment! */
+ LIMIT 1 OFFSET 0;
+</textarea>
+ </form>
+ <p><strong>MIME types defined:</strong>
+ <code><a href="?mime=text/x-sql">text/x-sql</a></code>,
+ <code><a href="?mime=text/x-mysql">text/x-mysql</a></code>,
+ <code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>,
+ <code><a href="?mime=text/x-cassandra">text/x-cassandra</a></code>,
+ <code><a href="?mime=text/x-plsql">text/x-plsql</a></code>.
+ </p>
+<script>
+window.onload = function() {
+ var mime = 'text/x-mariadb';
+ // get mime type
+ if (window.location.href.indexOf('mime=') > -1) {
+ mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
+ }
+ window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+ mode: mime,
+ indentWithTabs: true,
+ smartIndent: true,
+ lineNumbers: true,
+ matchBrackets : true,
+ autofocus: true
+ });
+};
+</script>
+
+</article>