From 6b96cd12296d3d0cfc8282f4cdbb061e839ae496 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 31 Aug 2012 00:08:01 +0400 Subject: [PATCH 1/8] add tests for all highlighters --- lib/ace/mode/_test/package.json | 8 + lib/ace/mode/_test/test_highlight_rules.js | 102 ++ lib/ace/mode/_test/text_javascript.txt | 47 + lib/ace/mode/_test/tokens_c9search.json | 273 +++ lib/ace/mode/_test/tokens_c_cpp.json | 207 +++ lib/ace/mode/_test/tokens_clojure.json | 437 +++++ lib/ace/mode/_test/tokens_coffee.json | 308 ++++ lib/ace/mode/_test/tokens_coldfusion.json | 65 + lib/ace/mode/_test/tokens_csharp.json | 70 + lib/ace/mode/_test/tokens_css.json | 376 ++++ lib/ace/mode/_test/tokens_diff.json | 1051 +++++++++++ lib/ace/mode/_test/tokens_glsl.json | 308 ++++ lib/ace/mode/_test/tokens_golang.json | 617 +++++++ lib/ace/mode/_test/tokens_groovy.json | 933 ++++++++++ lib/ace/mode/_test/tokens_haxe.json | 337 ++++ lib/ace/mode/_test/tokens_html.json | 250 +++ lib/ace/mode/_test/tokens_java.json | 231 +++ lib/ace/mode/_test/tokens_javascript.json | 766 ++++++++ lib/ace/mode/_test/tokens_json.json | 1022 +++++++++++ lib/ace/mode/_test/tokens_jsx.json | 129 ++ lib/ace/mode/_test/tokens_latex.json | 324 ++++ lib/ace/mode/_test/tokens_less.json | 495 ++++++ lib/ace/mode/_test/tokens_liquid.json | 1163 ++++++++++++ lib/ace/mode/_test/tokens_lua.json | 789 +++++++++ lib/ace/mode/_test/tokens_luapage.json | 1430 +++++++++++++++ lib/ace/mode/_test/tokens_markdown.json | 1844 ++++++++++++++++++++ lib/ace/mode/_test/tokens_ocaml.json | 464 +++++ lib/ace/mode/_test/tokens_perl.json | 521 ++++++ lib/ace/mode/_test/tokens_pgsql.json | 1735 ++++++++++++++++++ lib/ace/mode/_test/tokens_php.json | 417 +++++ lib/ace/mode/_test/tokens_powershell.json | 433 +++++ lib/ace/mode/_test/tokens_python.json | 351 ++++ lib/ace/mode/_test/tokens_ruby.json | 170 ++ lib/ace/mode/_test/tokens_scad.json | 469 +++++ lib/ace/mode/_test/tokens_scala.json | 1287 ++++++++++++++ lib/ace/mode/_test/tokens_scss.json | 300 ++++ lib/ace/mode/_test/tokens_sh.json | 749 ++++++++ lib/ace/mode/_test/tokens_sql.json | 126 ++ lib/ace/mode/_test/tokens_svg.json | 1611 +++++++++++++++++ lib/ace/mode/_test/tokens_tcl.json | 950 ++++++++++ lib/ace/mode/_test/tokens_text.json | 81 + lib/ace/mode/_test/tokens_textile.json | 301 ++++ lib/ace/mode/_test/tokens_xml.json | 1243 +++++++++++++ lib/ace/mode/_test/tokens_xquery.json | 105 ++ lib/ace/mode/_test/tokens_yaml.json | 410 +++++ lib/ace/mode/pgsql.js | 11 +- lib/ace/mode/pgsql_highlight_rules.js | 4 +- 47 files changed, 25312 insertions(+), 8 deletions(-) create mode 100644 lib/ace/mode/_test/package.json create mode 100644 lib/ace/mode/_test/test_highlight_rules.js create mode 100644 lib/ace/mode/_test/text_javascript.txt create mode 100644 lib/ace/mode/_test/tokens_c9search.json create mode 100644 lib/ace/mode/_test/tokens_c_cpp.json create mode 100644 lib/ace/mode/_test/tokens_clojure.json create mode 100644 lib/ace/mode/_test/tokens_coffee.json create mode 100644 lib/ace/mode/_test/tokens_coldfusion.json create mode 100644 lib/ace/mode/_test/tokens_csharp.json create mode 100644 lib/ace/mode/_test/tokens_css.json create mode 100644 lib/ace/mode/_test/tokens_diff.json create mode 100644 lib/ace/mode/_test/tokens_glsl.json create mode 100644 lib/ace/mode/_test/tokens_golang.json create mode 100644 lib/ace/mode/_test/tokens_groovy.json create mode 100644 lib/ace/mode/_test/tokens_haxe.json create mode 100644 lib/ace/mode/_test/tokens_html.json create mode 100644 lib/ace/mode/_test/tokens_java.json create mode 100644 lib/ace/mode/_test/tokens_javascript.json create mode 100644 lib/ace/mode/_test/tokens_json.json create mode 100644 lib/ace/mode/_test/tokens_jsx.json create mode 100644 lib/ace/mode/_test/tokens_latex.json create mode 100644 lib/ace/mode/_test/tokens_less.json create mode 100644 lib/ace/mode/_test/tokens_liquid.json create mode 100644 lib/ace/mode/_test/tokens_lua.json create mode 100644 lib/ace/mode/_test/tokens_luapage.json create mode 100644 lib/ace/mode/_test/tokens_markdown.json create mode 100644 lib/ace/mode/_test/tokens_ocaml.json create mode 100644 lib/ace/mode/_test/tokens_perl.json create mode 100644 lib/ace/mode/_test/tokens_pgsql.json create mode 100644 lib/ace/mode/_test/tokens_php.json create mode 100644 lib/ace/mode/_test/tokens_powershell.json create mode 100644 lib/ace/mode/_test/tokens_python.json create mode 100644 lib/ace/mode/_test/tokens_ruby.json create mode 100644 lib/ace/mode/_test/tokens_scad.json create mode 100644 lib/ace/mode/_test/tokens_scala.json create mode 100644 lib/ace/mode/_test/tokens_scss.json create mode 100644 lib/ace/mode/_test/tokens_sh.json create mode 100644 lib/ace/mode/_test/tokens_sql.json create mode 100644 lib/ace/mode/_test/tokens_svg.json create mode 100644 lib/ace/mode/_test/tokens_tcl.json create mode 100644 lib/ace/mode/_test/tokens_text.json create mode 100644 lib/ace/mode/_test/tokens_textile.json create mode 100644 lib/ace/mode/_test/tokens_xml.json create mode 100644 lib/ace/mode/_test/tokens_xquery.json create mode 100644 lib/ace/mode/_test/tokens_yaml.json diff --git a/lib/ace/mode/_test/package.json b/lib/ace/mode/_test/package.json new file mode 100644 index 00000000..3fdc706d --- /dev/null +++ b/lib/ace/mode/_test/package.json @@ -0,0 +1,8 @@ +{ + "name": "ace-mode-creator", + "version": "0.1.0", + "dependencies": { + "connect": "", + "socket.io": "" + } +} \ No newline at end of file diff --git a/lib/ace/mode/_test/test_highlight_rules.js b/lib/ace/mode/_test/test_highlight_rules.js new file mode 100644 index 00000000..544438e6 --- /dev/null +++ b/lib/ace/mode/_test/test_highlight_rules.js @@ -0,0 +1,102 @@ +var fs = require("fs"); +var path = require("path"); +if (!fs.existsSync) + fs.existsSync = path.existsSync; + +require("amd-loader"); + +function generateTestData() { + var root = Array(5).join("../") + "/demo/kitchen-sink/docs" + var docs = fs.readdirSync(root) + var specialDocs = fs.readdirSync(".") + var modes = fs.readdirSync("../").filter(function(x){ + return /(\w+)_highlight_rules.js$/.test(x) + }).map(function(x) { + return x.replace(/_highlight_rules.js$/, "") + }); + + console.log(docs) + console.log(modes) + + docs.forEach(function(docName){ + var p = docName.toLowerCase().split("."), modeName + if (modes.indexOf(p[0]) != -1) { + modeName = p[0] + } else if (modes.indexOf(p[1]) != -1) { + modeName = p[1] + } else { + modeName = {"txt": "text", cpp: "c_cpp"}[p[1]] + } + + if (!modeName) { + return console.error(p) + } + + var filePath = "text_" + modeName + ".txt" + if (specialDocs.indexOf(filePath) == -1) { + filePath = root + "/" + docName + } + + var text = fs.readFileSync(filePath, "utf8") + var Mode = require("../" + modeName).Mode; + var tokenizer = new Mode().getTokenizer(); + + var state = "start" + var data = text.split(/\n|\r|\r\n]/).map(function(line) { + var tokens = tokenizer.getLineTokens(line, state) + state = tokens.state + tokens = tokens.tokens + return { + state: state, + values: tokens.map(function(x) {return x.value}), + types: tokens.map(function(x) {return x.type}) + } + }) + + fs.writeFileSync("tokens_" + modeName + ".json", JSON.stringify(data, null, 1), "utf8") + }) +} + +function test() { + var docs = fs.readdirSync(".").filter(function(x){ + return /^tokens_\w+.json/.test(x) + }); + docs.forEach(function(x, i){ + var modeName = x.match(/tokens_(.*).json/)[1] + + console.log((" " + (i+1)).slice(-3) + ") testing: \u001b[33m" + modeName + "\u001b[0m") + + var text = fs.readFileSync("./" + x, "utf8") + var data = JSON.parse(text) + var Mode = require("../" + modeName).Mode; + var tokenizer = new Mode().getTokenizer(); + + var state = "start" + data.forEach(function(lineData) { + var line = lineData.values.join("") + + var tokens = tokenizer.getLineTokens(line, state) + var values = tokens.tokens.map(function(x) {return x.value}) + var types = tokens.tokens.map(function(x) {return x.type}) + + testEqual(lineData.state, tokens.state) + testEqual(lineData.types, types) + testEqual(lineData.values, values) + + state = lineData.state + }) + }) + + console.log("\u001b[32m" + "all ok" + "\u001b[0m") + + function testEqual(a, b) { + if (a + "" !== b + "") + throw a + "!=" + b + } +} + +if (process.argv[2] == "gen") { + generateTestData(process.argv.splice(3)) +} else { + test() +} diff --git a/lib/ace/mode/_test/text_javascript.txt b/lib/ace/mode/_test/text_javascript.txt new file mode 100644 index 00000000..1e8d3676 --- /dev/null +++ b/lib/ace/mode/_test/text_javascript.txt @@ -0,0 +1,47 @@ +function foo(items, nada) { + for (var i=0; i" + ], + "types": [ + "keyword", + "text", + "constant" + ] + }, + { + "state": "start", + "values": [ + "using", + " ", + "namespace", + " ", + "std", + ";" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "int", + " ", + "main", + " ", + "(", + ")" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "{" + ], + "types": [ + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "int", + " ", + "a", + ",", + " ", + "b", + "=", + "3", + ";", + " ", + "/*", + " foobar */" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "punctuation.operator", + "text", + "identifier", + "keyword.operator", + "constant.numeric", + "punctuation.operator", + "text", + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "a", + " ", + "=", + " ", + "b", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "a", + "+", + "=", + "2", + ";", + " ", + "// equivalent to a=a+2" + ], + "types": [ + "text", + "identifier", + "keyword.operator", + "keyword.operator", + "constant.numeric", + "punctuation.operator", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "cout", + " ", + "<", + "<", + " ", + "a", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "return", + " ", + "0", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "constant.numeric", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_clojure.json b/lib/ace/mode/_test/tokens_clojure.json new file mode 100644 index 00000000..20831bf5 --- /dev/null +++ b/lib/ace/mode/_test/tokens_clojure.json @@ -0,0 +1,437 @@ +[ + { + "state": "start", + "values": [ + "(", + "defn", + " ", + "parting" + ], + "types": [ + "keyword", + "support.function", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"returns a String parting in a given language", + "\"" + ], + "types": [ + "text", + "string", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "(", + "[", + "]", + " ", + "(", + "parting", + " ", + "\"World", + "\"", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "keyword", + "keyword", + "text", + "keyword", + "identifier", + "text", + "string", + "string", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "(", + "[", + "name", + "]", + " ", + "(", + "parting", + " ", + "name", + " ", + "\"en", + "\"", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "keyword", + "support.function", + "keyword", + "text", + "keyword", + "identifier", + "text", + "support.function", + "text", + "string", + "string", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "(", + "[", + "name", + " ", + "language", + "]" + ], + "types": [ + "text", + "keyword", + "keyword", + "support.function", + "text", + "identifier", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "; condp is similar to a case statement in other languages." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "; It is described in more detail later." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "; It is used here to take different actions based on whether the" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "; parameter \"language\" is set to \"en\", \"es\" or something else." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "(", + "condp", + " ", + "=", + " ", + "language" + ], + "types": [ + "text", + "keyword", + "support.function", + "text", + "constant.language", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"en", + "\"", + " ", + "(", + "str", + " ", + "\"Goodbye, ", + "\"", + " ", + "name", + ")" + ], + "types": [ + "text", + "string", + "string", + "text", + "keyword", + "support.function", + "text", + "string", + "string", + "text", + "support.function", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"es", + "\"", + " ", + "(", + "str", + " ", + "\"Adios, ", + "\"", + " ", + "name", + ")" + ], + "types": [ + "text", + "string", + "string", + "text", + "keyword", + "support.function", + "text", + "string", + "string", + "text", + "support.function", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "(", + "throw", + " ", + "(", + "IllegalArgumentException", + "." + ], + "types": [ + "text", + "keyword", + "keyword", + "text", + "keyword", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "(", + "str", + " ", + "\"unsupported language ", + "\"", + " ", + "language", + ")", + ")", + ")", + ")", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "support.function", + "text", + "string", + "string", + "text", + "identifier", + "keyword", + "keyword", + "keyword", + "keyword", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "(", + "println", + " ", + "(", + "parting", + ")", + ")", + " ", + "; -> Goodbye, World" + ], + "types": [ + "keyword", + "support.function", + "text", + "keyword", + "identifier", + "keyword", + "keyword", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "(", + "println", + " ", + "(", + "parting", + " ", + "\"Mark", + "\"", + ")", + ")", + " ", + "; -> Goodbye, Mark" + ], + "types": [ + "keyword", + "support.function", + "text", + "keyword", + "identifier", + "text", + "string", + "string", + "keyword", + "keyword", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "(", + "println", + " ", + "(", + "parting", + " ", + "\"Mark", + "\"", + " ", + "\"es", + "\"", + ")", + ")", + " ", + "; -> Adios, Mark" + ], + "types": [ + "keyword", + "support.function", + "text", + "keyword", + "identifier", + "text", + "string", + "string", + "text", + "string", + "string", + "keyword", + "keyword", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "(", + "println", + " ", + "(", + "parting", + " ", + "\"Mark", + "\"", + ", ", + "\"xy", + "\"", + ")", + ")", + " ", + "; -> java.lang.IllegalArgumentException: unsupported language xy" + ], + "types": [ + "keyword", + "support.function", + "text", + "keyword", + "identifier", + "text", + "string", + "string", + "text", + "string", + "string", + "keyword", + "keyword", + "text", + "comment" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_coffee.json b/lib/ace/mode/_test/tokens_coffee.json new file mode 100644 index 00000000..6d3aa160 --- /dev/null +++ b/lib/ace/mode/_test/tokens_coffee.json @@ -0,0 +1,308 @@ +[ + { + "state": "start", + "values": [ + "#!/usr/bin/env coffee" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "try" + ], + "types": [ + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "throw", + " ", + "URIError", + " ", + "decodeURI", + "(", + "0xC0ffee", + " ", + "*", + " ", + "123456.7e-8", + " ", + "/", + " ", + ".9", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "language.support.class", + "text", + "language.support.function", + "paren.lparen", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "catch", + " ", + "e" + ], + "types": [ + "keyword", + "text", + "identifier" + ] + }, + { + "state": "qdoc", + "values": [ + " ", + "console", + ".log", + " ", + "'qstring'", + " ", + "+", + " ", + "\"qqstring\"", + " ", + "+", + " ", + "'''" + ], + "types": [ + "text", + "identifier", + "identifier", + "text", + "string", + "text", + "keyword.operator", + "text", + "string", + "text", + "keyword.operator", + "text", + "string" + ] + }, + { + "state": "qdoc", + "values": [ + " qdoc" + ], + "types": [ + "string" + ] + }, + { + "state": "qqdoc", + "values": [ + " '''", + " ", + "+", + " ", + "\"\"\"" + ], + "types": [ + "string", + "text", + "keyword.operator", + "text", + "string" + ] + }, + { + "state": "qqdoc", + "values": [ + " qqdoc" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [ + " \"\"\"" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "do", + " ", + "->" + ], + "types": [ + "keyword", + "text", + "keyword.operator" + ] + }, + { + "state": "comment", + "values": [ + " ", + "###" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "comment", + "values": [ + " herecomment" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + " ###" + ], + "types": [ + "comment" + ] + }, + { + "state": "heregex", + "values": [ + " ", + "re", + " ", + "=", + " ", + "/regex/imgy", + ".test", + " ", + "///" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "string.regex", + "identifier", + "text", + "string.regex" + ] + }, + { + "state": "heregex", + "values": [ + " ", + "heregex", + " # comment" + ], + "types": [ + "comment.regex", + "string.regex", + "comment.regex" + ] + }, + { + "state": "start", + "values": [ + " ///imgy" + ], + "types": [ + "string.regex" + ] + }, + { + "state": "start", + "values": [ + " ", + "this", + " ", + "isnt", + ":", + " ", + "`just JavaScript`" + ], + "types": [ + "text", + "keyword", + "text", + "keyword", + "punctuation.operator", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "undefined" + ], + "types": [ + "text", + "constant.language" + ] + }, + { + "state": "start", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "sentence", + " ", + "=", + " ", + "\"#{ 22 / 7 } is a decent approximation of π\"" + ], + "types": [ + "identifier", + "text", + "keyword.operator", + "text", + "string" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_coldfusion.json b/lib/ace/mode/_test/tokens_coldfusion.json new file mode 100644 index 00000000..7e443910 --- /dev/null +++ b/lib/ace/mode/_test/tokens_coldfusion.json @@ -0,0 +1,65 @@ +[ + { + "state": "start", + "values": [ + "" + ], + "types": [ + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "cfset", + " ", + "welcome", + "=", + "\"Hello World!\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "cfoutput", + ">", + "#welcome#", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_csharp.json b/lib/ace/mode/_test/tokens_csharp.json new file mode 100644 index 00000000..6c23838d --- /dev/null +++ b/lib/ace/mode/_test/tokens_csharp.json @@ -0,0 +1,70 @@ +[ + { + "state": "start", + "values": [ + "public", + " ", + "void", + " ", + "HelloWorld", + "(", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "//Say Hello!" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "Console", + ".", + "WriteLine", + "(", + "\"Hello World\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "identifier", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_css.json b/lib/ace/mode/_test/tokens_css.json new file mode 100644 index 00000000..c872bad4 --- /dev/null +++ b/lib/ace/mode/_test/tokens_css.json @@ -0,0 +1,376 @@ +[ + { + "state": "ruleset", + "values": [ + ".text-layer", + " ", + "{" + ], + "types": [ + "variable", + "text", + "paren.lparen" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "font-family", + ": Monaco, ", + "\"Courier New\"", + ", ", + "monospace", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "string", + "text", + "support.constant.fonts", + "text" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "font-size", + ": ", + "12", + "px", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "keyword", + "text" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "cursor", + ": ", + "text", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "ruleset", + "values": [ + ".blinker", + " ", + "{" + ], + "types": [ + "variable", + "text", + "paren.lparen" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "animation-duration", + ": ", + "1", + "s", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "keyword", + "text" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "animation-name", + ": blink;" + ], + "types": [ + "text", + "support.type", + "text" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "animation-iteration-count", + ": infinite;" + ], + "types": [ + "text", + "support.type", + "text" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "animation-direction", + ": alternate;" + ], + "types": [ + "text", + "support.type", + "text" + ] + }, + { + "state": "ruleset", + "values": [ + " ", + "animation-timing-function", + ": ", + "linear", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "media", + "values": [ + "@keyframes blink {" + ], + "types": [ + "string" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "0", + "% ", + "{" + ], + "types": [ + "text", + "constant", + "text", + "paren.lparen" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "opacity", + ": ", + "0", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "media", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "40", + "% ", + "{" + ], + "types": [ + "text", + "constant", + "text", + "paren.lparen" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "opacity", + ": ", + "0", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "media", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "40", + ".5", + "% ", + "{" + ], + "types": [ + "text", + "constant", + "variable", + "text", + "paren.lparen" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "opacity", + ": ", + "1" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric" + ] + }, + { + "state": "media", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "100", + "% ", + "{" + ], + "types": [ + "text", + "constant", + "text", + "paren.lparen" + ] + }, + { + "state": "media_ruleset", + "values": [ + " ", + "opacity", + ": ", + "1" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric" + ] + }, + { + "state": "media", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "string" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_diff.json b/lib/ace/mode/_test/tokens_diff.json new file mode 100644 index 00000000..5ec5f694 --- /dev/null +++ b/lib/ace/mode/_test/tokens_diff.json @@ -0,0 +1,1051 @@ +[ + { + "state": "start", + "values": [ + "diff", + " --git", + " a/lib/ace/edit_session.js", + " b/lib/ace/edit_session.js" + ], + "types": [ + "variable", + "variable", + "keyword", + "variable" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "index 23fc3fc..ed3b273 100644" + ], + "types": [ + "variable" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "---", + " a/lib/ace/edit_session.js" + ], + "types": [ + "constant.numeric", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+++", + " b/lib/ace/edit_session.js" + ], + "types": [ + "constant.numeric", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "@@", + " -51,6 +51,7 ", + "@@", + " var TextMode = require(\"./mode/text\").Mode;" + ], + "types": [ + "constant", + "constant.numeric", + "constant", + "comment.doc.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " var Range = require(\"./range\").Range;" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " var Document = require(\"./document\").Document;" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + "var SearchHighlight = require(\"./search_highlight\").SearchHighlight;" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " /**" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " * class EditSession" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "@@", + " -307,6 +308,13 ", + "@@", + " var EditSession = function(text, mode) {" + ], + "types": [ + "constant", + "constant.numeric", + "constant", + "comment.doc.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " return token;" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " };" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " this.highlight = function(re) {" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " if (!this.$searchHighlight) {" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " var highlight = new SearchHighlight(null, \"ace_selected_word\", \"text\");" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " this.$searchHighlight = this.addDynamicMarker(highlight);" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " }" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " this.$searchHighlight.setRegexp(re);" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " }" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " /**" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " * EditSession.setUndoManager(undoManager)" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " * - undoManager (UndoManager): The new undo manager" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "@@", + " -556,7 +564,8 ", + "@@", + " var EditSession = function(text, mode) {" + ], + "types": [ + "constant", + "constant.numeric", + "constant", + "comment.doc.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " type : type || \"line\"," + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " renderer: typeof type == \"function\" ? type : null," + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " clazz : clazz," + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " inFront: !!inFront" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " inFront: !!inFront," + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " id: id" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " }" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " if (inFront) {" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "diff", + " --git", + " a/lib/ace/editor.js", + " b/lib/ace/editor.js" + ], + "types": [ + "variable", + "variable", + "keyword", + "variable" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "index 834e603..b27ec73 100644" + ], + "types": [ + "variable" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "---", + " a/lib/ace/editor.js" + ], + "types": [ + "constant.numeric", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+++", + " b/lib/ace/editor.js" + ], + "types": [ + "constant.numeric", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "@@", + " -494,7 +494,7 ", + "@@", + " var Editor = function(renderer, session) {" + ], + "types": [ + "constant", + "constant.numeric", + "constant", + "comment.doc.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " * Emitted when a selection has changed." + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " **/" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " this.onSelectionChange = function(e) {" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " var session = this.getSession();" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " var session = this.session;" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " if (session.$selectionMarker) {" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " session.removeMarker(session.$selectionMarker);" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "@@", + " -509,12 +509,40 ", + "@@", + " var Editor = function(renderer, session) {" + ], + "types": [ + "constant", + "constant.numeric", + "constant", + "comment.doc.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " this.$updateHighlightActiveLine();" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " }" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " var self = this;" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " if (this.$highlightSelectedWord && !this.$wordHighlightTimer)" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " this.$wordHighlightTimer = setTimeout(function() {" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " self.session.$mode.highlightSelection(self);" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " self.$wordHighlightTimer = null;" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-", + " }, 30, this);" + ], + "types": [ + "support.function", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + " var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " };" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "diff", + " --git", + " a/lib/ace/search_highlight.js", + " b/lib/ace/search_highlight.js" + ], + "types": [ + "variable", + "variable", + "keyword", + "variable" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "new file mode 100644" + ], + "types": [ + "invisible" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "index 0000000..b2df779" + ], + "types": [ + "variable" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "---", + " /dev/null" + ], + "types": [ + "constant.numeric", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+++", + " b/lib/ace/search_highlight.js" + ], + "types": [ + "constant.numeric", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "@@", + " -0,0 +1,3 ", + "@@" + ], + "types": [ + "constant", + "constant.numeric", + "constant" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + "new" + ], + "types": [ + "support.constant", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "+", + "empty file" + ], + "types": [ + "support.constant", + "text" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_glsl.json b/lib/ace/mode/_test/tokens_glsl.json new file mode 100644 index 00000000..d0f06dea --- /dev/null +++ b/lib/ace/mode/_test/tokens_glsl.json @@ -0,0 +1,308 @@ +[ + { + "state": "start", + "values": [ + "uniform", + " ", + "float", + " ", + "amplitude", + ";" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "attribute", + " ", + "float", + " ", + "displacement", + ";" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "varying", + " ", + "vec3", + " ", + "vNormal", + ";" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "void", + " ", + "main", + "(", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "vNormal", + " ", + "=", + " ", + "normal", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "// multiply our displacement by the" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "// amplitude. The amp will get animated" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "// so we'll have animated displacement" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "vec3", + " ", + "newPosition", + " ", + "=", + " ", + "position", + " ", + "+", + " " + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "normal", + " ", + "*", + " " + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "vec3", + "(", + "displacement", + " ", + "*" + ], + "types": [ + "text", + "keyword", + "paren.lparen", + "identifier", + "text", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "amplitude", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "gl_Position", + " ", + "=", + " ", + "projectionMatrix", + " ", + "*" + ], + "types": [ + "text", + "constant.language", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "modelViewMatrix", + " ", + "*" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "vec4", + "(", + "newPosition", + ",", + "1.0", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "paren.lparen", + "identifier", + "punctuation.operator", + "constant.numeric", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_golang.json b/lib/ace/mode/_test/tokens_golang.json new file mode 100644 index 00000000..4ac7fc96 --- /dev/null +++ b/lib/ace/mode/_test/tokens_golang.json @@ -0,0 +1,617 @@ +[ + { + "state": "start", + "values": [ + "// Concurrent computation of pi." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "// See http://goo.gl/ZuTZM." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "//" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "// This demonstrates Go's ability to handle" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "// large numbers of concurrent processes." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "// It is an unreasonable way to calculate pi." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "package", + " ", + "main" + ], + "types": [ + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "import", + " ", + "(" + ], + "types": [ + "keyword", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"fmt\"" + ], + "types": [ + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"math\"" + ], + "types": [ + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + ")" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "func", + " ", + "main", + "(", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "fmt", + ".", + "Println", + "(", + "pi", + "(", + "5000", + ")", + ")" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "identifier", + "paren.lparen", + "identifier", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "// pi launches n goroutines to compute an" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "// approximation of pi." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "func", + " ", + "pi", + "(", + "n", + " ", + "int", + ")", + " ", + "float64", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "text", + "identifier", + "paren.rparen", + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "ch", + " ", + ":", + "=", + " ", + "make", + "(", + "chan", + " ", + "float64", + ")" + ], + "types": [ + "text", + "identifier", + "text", + "punctuation.operator", + "keyword.operator", + "text", + "identifier", + "paren.lparen", + "keyword", + "text", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "for", + " ", + "k", + " ", + ":", + "=", + " ", + "0", + ";", + " ", + "k", + " ", + "<=", + " ", + "n", + ";", + " ", + "k", + "++", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "punctuation.operator", + "keyword.operator", + "text", + "constant.numeric", + "punctuation.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator", + "text", + "identifier", + "keyword.operator", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "go", + " ", + "term", + "(", + "ch", + ",", + " ", + "float64", + "(", + "k", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "punctuation.operator", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "f", + " ", + ":", + "=", + " ", + "0.0" + ], + "types": [ + "text", + "identifier", + "text", + "punctuation.operator", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "for", + " ", + "k", + " ", + ":", + "=", + " ", + "0", + ";", + " ", + "k", + " ", + "<=", + " ", + "n", + ";", + " ", + "k", + "++", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "punctuation.operator", + "keyword.operator", + "text", + "constant.numeric", + "punctuation.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator", + "text", + "identifier", + "keyword.operator", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "f", + " ", + "+", + "=", + " ", + "<", + "-", + "ch" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "keyword.operator", + "keyword.operator", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "return", + " ", + "f" + ], + "types": [ + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "func", + " ", + "term", + "(", + "ch", + " ", + "chan", + " ", + "float64", + ",", + " ", + "k", + " ", + "float64", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "text", + "keyword", + "text", + "identifier", + "punctuation.operator", + "text", + "identifier", + "text", + "identifier", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "ch", + " ", + "<", + "-", + " ", + "4", + " ", + "*", + " ", + "math", + ".", + "Pow", + "(", + "-1", + ",", + " ", + "k", + ")", + " / ", + "(", + "2", + "*", + "k", + " ", + "+", + " ", + "1", + ")" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator", + "identifier", + "paren.lparen", + "constant.numeric", + "punctuation.operator", + "text", + "identifier", + "paren.rparen", + "text", + "paren.lparen", + "constant.numeric", + "keyword.operator", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_groovy.json b/lib/ace/mode/_test/tokens_groovy.json new file mode 100644 index 00000000..8df0b304 --- /dev/null +++ b/lib/ace/mode/_test/tokens_groovy.json @@ -0,0 +1,933 @@ +[ + { + "state": "start", + "values": [ + "//http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "class", + " ", + "Employee", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "def", + " ", + "name", + ", ", + "salary" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "boolean", + " ", + "manager" + ], + "types": [ + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "String", + " ", + "toString", + "(", + ")", + " ", + "{", + " ", + "return", + " ", + "name", + " ", + "}" + ], + "types": [ + "text", + "support.function", + "text", + "identifier", + "lparen", + "rparen", + "text", + "lparen", + "text", + "keyword", + "text", + "identifier", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "def", + " ", + "emps", + " ", + "=", + " ", + "[", + "new", + " ", + "Employee", + "(", + "name", + ":", + "'Guillaume'", + ", ", + "manager", + ":", + "true", + ", ", + "salary", + ":", + "200", + ")", + "," + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "lparen", + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "text", + "string", + "text", + "identifier", + "text", + "constant.language.boolean", + "text", + "identifier", + "text", + "constant.numeric", + "rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "new", + " ", + "Employee", + "(", + "name", + ":", + "'Graeme'", + ", ", + "manager", + ":", + "true", + ", ", + "salary", + ":", + "200", + ")", + "," + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "text", + "string", + "text", + "identifier", + "text", + "constant.language.boolean", + "text", + "identifier", + "text", + "constant.numeric", + "rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "new", + " ", + "Employee", + "(", + "name", + ":", + "'Dierk'", + ", ", + "manager", + ":", + "false", + ", ", + "salary", + ":", + "151", + ")", + "," + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "text", + "string", + "text", + "identifier", + "text", + "constant.language.boolean", + "text", + "identifier", + "text", + "constant.numeric", + "rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "new", + " ", + "Employee", + "(", + "name", + ":", + "'Bernd'", + ", ", + "manager", + ":", + "false", + ", ", + "salary", + ":", + "50", + ")", + "]" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "text", + "string", + "text", + "identifier", + "text", + "constant.language.boolean", + "text", + "identifier", + "text", + "constant.numeric", + "rparen", + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "def", + " ", + "managers", + "(", + "emps", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "emps", + ".", + "findAll", + " ", + "{", + " ", + "e", + " ", + "-", + ">", + " ", + "e", + ".", + "isManager", + "(", + ")", + " ", + "}" + ], + "types": [ + "text", + "identifier", + "text", + "identifier", + "text", + "lparen", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier", + "text", + "identifier", + "lparen", + "rparen", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "assert", + " ", + "emps", + "[", + "0", + "..", + "1", + "]", + " ", + "==", + " ", + "managers", + "(", + "emps", + ")", + " ", + "// [Guillaume, Graeme]" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "constant.numeric", + "text", + "constant.numeric", + "rparen", + "text", + "keyword.operator", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "def", + " ", + "highPaid", + "(", + "emps", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "threshold", + " ", + "=", + " ", + "150" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "emps", + ".", + "findAll", + " ", + "{", + " ", + "e", + " ", + "-", + ">", + " ", + "e", + ".", + "salary", + " ", + ">", + " ", + "threshold", + " ", + "}" + ], + "types": [ + "text", + "identifier", + "text", + "identifier", + "text", + "lparen", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "assert", + " ", + "emps", + "[", + "0", + "..", + "2", + "]", + " ", + "==", + " ", + "highPaid", + "(", + "emps", + ")", + " ", + "// [Guillaume, Graeme, Dierk]" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "constant.numeric", + "text", + "constant.numeric", + "rparen", + "text", + "keyword.operator", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "def", + " ", + "paidMore", + "(", + "amount", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "{", + " ", + "e", + " ", + "-", + ">", + " ", + "e", + ".", + "salary", + " ", + ">", + " ", + "amount", + "}" + ], + "types": [ + "text", + "lparen", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [ + "def", + " ", + "highPaid", + " ", + "=", + " ", + "paidMore", + "(", + "150", + ")" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "lparen", + "constant.numeric", + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "assert", + " ", + "highPaid", + "(", + "emps", + "[", + "0", + "]", + ")", + " ", + "// true" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "lparen", + "constant.numeric", + "rparen", + "rparen", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "assert", + " ", + "emps", + "[", + "0", + "..", + "2", + "]", + " ", + "==", + " ", + "emps", + ".", + "findAll", + "(", + "highPaid", + ")" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "constant.numeric", + "text", + "constant.numeric", + "rparen", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "identifier", + "lparen", + "identifier", + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "def", + " ", + "filename", + " ", + "=", + " ", + "'test.txt'" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + "new", + " ", + "File", + "(", + "filename", + ")", + ".", + "withReader", + "{", + " ", + "reader", + " ", + "-", + ">", + " ", + "doSomethingWith", + "(", + "reader", + ")", + " ", + "}" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "identifier", + "lparen", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "def", + " ", + "readersText" + ], + "types": [ + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "def", + " ", + "doSomethingWith", + "(", + "reader", + ")", + " ", + "{", + " ", + "readersText", + " ", + "=", + " ", + "reader", + ".", + "text", + " ", + "}" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "lparen", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "identifier", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "assert", + " ", + "new", + " ", + "File", + "(", + "filename", + ")", + ".", + "text", + " ", + "==", + " ", + "readersText" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_haxe.json b/lib/ace/mode/_test/tokens_haxe.json new file mode 100644 index 00000000..0b5b0b69 --- /dev/null +++ b/lib/ace/mode/_test/tokens_haxe.json @@ -0,0 +1,337 @@ +[ + { + "state": "start", + "values": [ + "class", + " ", + "Haxe", + " " + ], + "types": [ + "keyword", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + "{" + ], + "types": [ + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "public", + " ", + "static", + " ", + "function", + " ", + "main", + "(", + ")", + " " + ], + "types": [ + "text", + "keyword", + "text", + "keyword", + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "// Say Hello!" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "var", + " ", + "greeting", + ":", + "String", + " ", + "=", + " ", + "\"Hello World\"", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "punctuation.operator", + "keyword", + "text", + "keyword.operator", + "text", + "string", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "trace", + "(", + "greeting", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "paren.lparen", + "identifier", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "var", + " ", + "targets", + ":", + "Array", + "<", + "String", + ">", + " ", + "=", + " ", + "[", + "\"Flash\"", + ",", + "\"Javascript\"", + ",", + "\"PHP\"", + ",", + "\"Neko\"", + ",", + "\"C++\"", + ",", + "\"iOS\"", + ",", + "\"Android\"", + ",", + "\"webOS\"", + "]", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "punctuation.operator", + "keyword", + "keyword.operator", + "keyword", + "keyword.operator", + "text", + "keyword.operator", + "text", + "paren.lparen", + "string", + "punctuation.operator", + "string", + "punctuation.operator", + "string", + "punctuation.operator", + "string", + "punctuation.operator", + "string", + "punctuation.operator", + "string", + "punctuation.operator", + "string", + "punctuation.operator", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "trace", + "(", + "\"Haxe is a great language that can target:\"", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "for", + " ", + "(", + "target", + " ", + "in", + " ", + "targets", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword", + "text", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "trace", + " ", + "(", + "\" - \"", + " ", + "+", + " ", + "target", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "string", + "text", + "keyword.operator", + "text", + "identifier", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "trace", + "(", + "\"And many more!\"", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_html.json b/lib/ace/mode/_test/tokens_html.json new file mode 100644 index 00000000..3acbb7f2 --- /dev/null +++ b/lib/ace/mode/_test/tokens_html.json @@ -0,0 +1,250 @@ +[ + { + "state": "start", + "values": [ + "<", + "html", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "head", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "css-start", + "values": [ + " ", + "<", + "style", + " ", + "type", + "=", + "\"text/css\"", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.style", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + ".text-layer", + " ", + "{" + ], + "types": [ + "text", + "variable", + "text", + "paren.lparen" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + "font-family", + ": Monaco, ", + "\"Courier New\"", + ", ", + "monospace", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "string", + "text", + "support.constant.fonts", + "text" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + "font-size", + ": ", + "12", + "px", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "keyword", + "text" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + "cursor", + ": ", + "text", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.constant", + "text" + ] + }, + { + "state": "css-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.style", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "body", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "h1", + " ", + "style", + "=", + "\"color:red\"", + ">", + "Juhu Kinners", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_java.json b/lib/ace/mode/_test/tokens_java.json new file mode 100644 index 00000000..56ad4fc1 --- /dev/null +++ b/lib/ace/mode/_test/tokens_java.json @@ -0,0 +1,231 @@ +[ + { + "state": "start", + "values": [ + "public", + " ", + "class", + " ", + "InfiniteLoop", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "comment", + "values": [ + " ", + "/*" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "comment", + "values": [ + " * This will cause the program to hang..." + ], + "types": [ + "comment" + ] + }, + { + "state": "comment", + "values": [ + " *" + ], + "types": [ + "comment" + ] + }, + { + "state": "comment", + "values": [ + " * Taken from:" + ], + "types": [ + "comment" + ] + }, + { + "state": "comment", + "values": [ + " * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + " */" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "public", + " ", + "static", + " ", + "void", + " ", + "main", + "(", + "String", + "[", + "]", + " ", + "args", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "keyword", + "text", + "keyword", + "text", + "identifier", + "lparen", + "support.function", + "lparen", + "rparen", + "text", + "identifier", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "double", + " ", + "d", + " ", + "=", + " ", + "Double", + ".", + "parseDouble", + "(", + "\"2.2250738585072012e-308\"", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "support.function", + "text", + "identifier", + "lparen", + "string", + "rparen", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "// unreachable code" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "System", + ".", + "out", + ".", + "println", + "(", + "\"Value: \"", + " ", + "+", + " ", + "d", + ")", + ";" + ], + "types": [ + "text", + "support.function", + "text", + "identifier", + "text", + "identifier", + "lparen", + "string", + "text", + "keyword.operator", + "text", + "identifier", + "rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_javascript.json b/lib/ace/mode/_test/tokens_javascript.json new file mode 100644 index 00000000..fc012829 --- /dev/null +++ b/lib/ace/mode/_test/tokens_javascript.json @@ -0,0 +1,766 @@ +[ + { + "state": "regex_allowed", + "values": [ + "function", + " ", + "foo", + "(", + "items", + ", ", + "nada", + ")", + " ", + "{" + ], + "types": [ + "storage.type", + "text", + "entity.name.function", + "paren.lparen", + "variable.parameter", + "punctuation.operator", + "variable.parameter", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "regex_allowed", + "values": [ + " ", + "for", + " ", + "(", + "var", + " ", + "i", + "=", + "0", + ";", + " ", + "i", + "<", + "items", + ".", + "length", + ";", + " ", + "i", + "++", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "storage.type", + "text", + "identifier", + "keyword.operator", + "constant.numeric", + "punctuation.operator", + "text", + "identifier", + "keyword.operator", + "identifier", + "punctuation.operator", + "support.constant", + "punctuation.operator", + "text", + "identifier", + "keyword.operator", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "regex_allowed", + "values": [ + " ", + "alert", + "(", + "items", + "[", + "i", + "]", + " ", + "+", + " ", + "\"juhu", + "\\n", + "\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "keyword.operator", + "text", + "string", + "constant.language.escape", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "}", + "\t", + "// Real Tab." + ], + "types": [ + "text", + "paren.rparen", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "/************************************/" + ], + "types": [ + "text", + "comment.doc" + ] + }, + { + "state": "start", + "values": [ + "/** total mess, tricky to highlight**/" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "regex_allowed", + "values": [ + "function", + " ", + "(", + ")", + " ", + "{" + ], + "types": [ + "storage.type", + "text", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "doc-start", + "values": [ + "\t", + "/**" + ], + "types": [ + "text", + "comment.doc" + ] + }, + { + "state": "doc-start", + "values": [ + "\t * docComment" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "start", + "values": [ + "\t **/" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "start", + "values": [ + "\t", + "r", + " ", + "=", + " ", + "/u", + "\\t", + "*/" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "string.regexp", + "regexp.keyword.operator", + "string.regexp" + ] + }, + { + "state": "start", + "values": [ + "\t", + "g", + " ", + "=", + " ", + "1.", + "00", + "E", + "^", + "1", + ",", + " ", + "y", + " ", + "=", + " ", + "1.2", + " ", + "+", + " ", + ".", + "2", + " ", + "+", + " ", + "052", + " ", + "+", + " ", + "0x25" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "identifier", + "text", + "constant.numeric", + "punctuation.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "text", + "punctuation.operator", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + "\t", + "t", + " ", + "=", + " ", + "[", + "'d'", + ",", + " ", + "''", + "]" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "string", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "regex_allowed", + "values": [ + "function", + " ", + "(", + ")", + " ", + "{" + ], + "types": [ + "storage.type", + "text", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "regex_allowed", + "values": [ + "\t", + "/* eee */" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "qqstring", + "values": [ + "\"s\\" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [ + "s", + "\\u7824", + "sss", + "\\u", + "1\"" + ], + "types": [ + "string", + "constant.language.escape", + "string", + "constant.language.escape", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "qstring", + "values": [ + "'\\" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [ + "string'" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "'" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "string", + "'" + ], + "types": [ + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "\"trailing space", + "\\ ", + " " + ], + "types": [ + "string", + "constant.language.escape", + "string" + ] + }, + { + "state": "start", + "values": [ + "\" \"", + " ", + "/", + "not", + " ", + "a", + " ", + "regexp", + "/", + "g" + ], + "types": [ + "string", + "text", + "keyword.operator", + "identifier", + "text", + "identifier", + "text", + "identifier", + "keyword.operator", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "doc-start", + "values": [ + "/**" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "doc-start", + "values": [ + " *doc" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "start", + "values": [ + " */" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "regex_allowed", + "values": [ + "a", + " ", + "=", + " ", + "{" + ], + "types": [ + "identifier", + "text", + "keyword.operator", + "text", + "paren.lparen" + ] + }, + { + "state": "regex_allowed", + "values": [ + "\t", + "'a'", + ":", + " ", + "b", + "," + ], + "types": [ + "text", + "string", + "punctuation.operator", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "\t", + "'g'", + ": ", + "function", + "(", + "t", + ")" + ], + "types": [ + "text", + "string", + "text", + "storage.type", + "paren.lparen", + "variable.parameter", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "gta", + ":", + "function", + "(", + "a", + ",", + "b", + ")" + ], + "types": [ + "text", + "entity.name.function", + "punctuation.operator", + "storage.type", + "paren.lparen", + "variable.parameter", + "punctuation.operator", + "variable.parameter", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "function_arguments", + "values": [ + "foo", + ".", + "protoype", + ".", + "d", + " ", + "=", + " ", + "function", + "(", + "a", + ", ", + "b", + "," + ], + "types": [ + "identifier", + "punctuation.operator", + "storage.type", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator", + "text", + "storage.type", + "paren.lparen", + "variable.parameter", + "punctuation.operator", + "variable.parameter", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "c", + ", ", + "d", + ")" + ], + "types": [ + "punctuation.operator", + "variable.parameter", + "punctuation.operator", + "variable.parameter", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "foo", + ".", + "d", + " ", + "=", + "function", + "(", + "a", + ", ", + "b", + ")" + ], + "types": [ + "storage.type", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator", + "storage.type", + "paren.lparen", + "variable.parameter", + "punctuation.operator", + "variable.parameter", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "foo", + ".", + "d", + " ", + "=", + "function", + "(", + "a", + ", ", + "/*****/", + " ", + "d", + "\"string\"", + " " + ], + "types": [ + "storage.type", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator", + "storage.type", + "paren.lparen", + "variable.parameter", + "punctuation.operator", + "comment.doc", + "text", + "identifier", + "string", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_json.json b/lib/ace/mode/_test/tokens_json.json new file mode 100644 index 00000000..f90f0870 --- /dev/null +++ b/lib/ace/mode/_test/tokens_json.json @@ -0,0 +1,1022 @@ +[ + { + "state": "start", + "values": [ + "{" + ], + "types": [ + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"query\"", + ": ", + "{" + ], + "types": [ + "text", + "variable", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"count\"", + ": ", + "10", + "," + ], + "types": [ + "text", + "variable", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"created\"", + ": ", + "\"2011-06-21T08:10:46Z\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"lang\"", + ": ", + "\"en-US\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"results\"", + ": ", + "{" + ], + "types": [ + "text", + "variable", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"photo\"", + ": ", + "[" + ], + "types": [ + "text", + "variable", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"farm\"", + ": ", + "\"6\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"id\"", + ": ", + "\"5855620975\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfamily\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfriend\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"ispublic\"", + ": ", + "\"1\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"owner\"", + ": ", + "\"32021554@N04\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"secret\"", + ": ", + "\"f1f5e8515d\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"server\"", + ": ", + "\"5110\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"title\"", + ": ", + "\"7087 bandit cat\"" + ], + "types": [ + "text", + "variable", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "}", + "," + ], + "types": [ + "text", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"farm\"", + ": ", + "\"4\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"id\"", + ": ", + "\"5856170534\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfamily\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfriend\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"ispublic\"", + ": ", + "\"1\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"owner\"", + ": ", + "\"32021554@N04\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"secret\"", + ": ", + "\"ff1efb2a6f\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"server\"", + ": ", + "\"3217\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"title\"", + ": ", + "\"6975 rusty cat\"" + ], + "types": [ + "text", + "variable", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "}", + "," + ], + "types": [ + "text", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"farm\"", + ": ", + "\"6\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"id\"", + ": ", + "\"5856172972\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfamily\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfriend\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"ispublic\"", + ": ", + "\"1\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"owner\"", + ": ", + "\"51249875@N03\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"secret\"", + ": ", + "\"6c6887347c\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"server\"", + ": ", + "\"5192\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"title\"", + ": ", + "\"watermarked-cats\"" + ], + "types": [ + "text", + "variable", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "}", + "," + ], + "types": [ + "text", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"farm\"", + ": ", + "\"6\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"id\"", + ": ", + "\"5856168328\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfamily\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfriend\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"ispublic\"", + ": ", + "\"1\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"owner\"", + ": ", + "\"32021554@N04\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"secret\"", + ": ", + "\"0c1cfdf64c\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"server\"", + ": ", + "\"5078\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"title\"", + ": ", + "\"7020 mandy cat\"" + ], + "types": [ + "text", + "variable", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "}", + "," + ], + "types": [ + "text", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"farm\"", + ": ", + "\"3\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"id\"", + ": ", + "\"5856171774\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfamily\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"isfriend\"", + ": ", + "\"0\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"ispublic\"", + ": ", + "\"1\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"owner\"", + ": ", + "\"32021554@N04\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"secret\"", + ": ", + "\"7f5a3180ab\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"server\"", + ": ", + "\"2696\"", + "," + ], + "types": [ + "text", + "variable", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"title\"", + ": ", + "\"7448 bobby cat\"" + ], + "types": [ + "text", + "variable", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "]" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_jsx.json b/lib/ace/mode/_test/tokens_jsx.json new file mode 100644 index 00000000..30d5945a --- /dev/null +++ b/lib/ace/mode/_test/tokens_jsx.json @@ -0,0 +1,129 @@ +[ + { + "state": "comment", + "values": [ + "/*EXPECTED" + ], + "types": [ + "comment" + ] + }, + { + "state": "comment", + "values": [ + "hello world!" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "*/" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "class", + " ", + "Test", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "language.support.class", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "static", + " ", + "function", + " ", + "run", + "(", + ")", + " ", + ":", + " ", + "void", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "storage.type", + "text", + "entity.name.function", + "paren.lparen", + "paren.rparen", + "text", + "punctuation.operator", + "text", + "keyword", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "// console.log(\"hello world!\");" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "log", + " ", + "\"hello world!\"", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "string", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_latex.json b/lib/ace/mode/_test/tokens_latex.json new file mode 100644 index 00000000..5ee56b23 --- /dev/null +++ b/lib/ace/mode/_test/tokens_latex.json @@ -0,0 +1,324 @@ +[ + { + "state": "start", + "values": [ + "\\usepackage", + "{", + "amsmath", + "}" + ], + "types": [ + "keyword", + "lparen", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "\\title", + "{", + "\\LaTeX", + "}" + ], + "types": [ + "keyword", + "lparen", + "keyword", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "\\date", + "{", + "}" + ], + "types": [ + "keyword", + "lparen", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "\\begin", + "{", + "document", + "}" + ], + "types": [ + "keyword", + "lparen", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\\maketitle" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "\\LaTeX", + "{", + "}", + " is a document preparation system for the ", + "\\TeX", + "{", + "}" + ], + "types": [ + "text", + "keyword", + "lparen", + "rparen", + "text", + "keyword", + "lparen", + "rparen" + ] + }, + { + "state": "start", + "values": [ + " typesetting program. It offers programmable desktop publishing" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " features and extensive facilities for automating most aspects of" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " typesetting and desktop publishing, including numbering and" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " cross-referencing, tables and figures, page layout, bibliographies," + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " and much more. ", + "\\LaTeX", + "{", + "}", + " was originally written in 1984 by Leslie" + ], + "types": [ + "text", + "keyword", + "lparen", + "rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " Lamport and has become the dominant method for using ", + "\\TeX", + "; few" + ], + "types": [ + "text", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + " people write in plain ", + "\\TeX", + "{", + "}", + " anymore. The current version is" + ], + "types": [ + "text", + "keyword", + "lparen", + "rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "\\LaTeXe", + "." + ], + "types": [ + "text", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "% This is a comment; it will not be shown in the final output." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "% The following shows a little of the typesetting power of LaTeX:" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "\\begin", + "{", + "align", + "}" + ], + "types": [ + "text", + "keyword", + "lparen", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + " E &= mc^2 ", + "\\\\" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " m &= ", + "\\frac", + "{", + "m_0", + "}", + "{", + "\\sqrt", + "{", + "1-", + "\\frac", + "{", + "v^2", + "}", + "{", + "c^2", + "}", + "}", + "}" + ], + "types": [ + "text", + "keyword", + "lparen", + "text", + "rparen", + "lparen", + "keyword", + "lparen", + "text", + "keyword", + "lparen", + "text", + "rparen", + "lparen", + "text", + "rparen", + "rparen", + "rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "\\end", + "{", + "align", + "}" + ], + "types": [ + "text", + "keyword", + "lparen", + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "\\end", + "{", + "document", + "}" + ], + "types": [ + "keyword", + "lparen", + "text", + "rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_less.json b/lib/ace/mode/_test/tokens_less.json new file mode 100644 index 00000000..9bfae5a5 --- /dev/null +++ b/lib/ace/mode/_test/tokens_less.json @@ -0,0 +1,495 @@ +[ + { + "state": "start", + "values": [ + "/*", + " styles.less */" + ], + "types": [ + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "@base", + ": ", + "#f938ab", + ";" + ], + "types": [ + "variable", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + ".box-shadow", + "(", + "@style", + ", ", + "@c", + ")", + " ", + "when", + " ", + "(", + "iscolor", + "(", + "@c", + ")", + ")", + " ", + "{" + ], + "types": [ + "variable.language", + "paren.lparen", + "variable", + "text", + "variable", + "paren.rparen", + "text", + "keyword", + "text", + "paren.lparen", + "support.function", + "paren.lparen", + "variable", + "paren.rparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " box-shadow: ", + "@style", + " ", + "@c", + ";" + ], + "types": [ + "text", + "variable", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + " -webkit-box-shadow: ", + "@style", + " ", + "@c", + ";" + ], + "types": [ + "text", + "variable", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + " -moz-box-shadow: ", + "@style", + " ", + "@c", + ";" + ], + "types": [ + "text", + "variable", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + ".box-shadow", + "(", + "@style", + ", ", + "@alpha", + ": ", + "50%", + ")", + " ", + "when", + " ", + "(", + "isnumber", + "(", + "@alpha", + ")", + ")", + " ", + "{" + ], + "types": [ + "variable.language", + "paren.lparen", + "variable", + "text", + "variable", + "text", + "constant.numeric", + "paren.rparen", + "text", + "keyword", + "text", + "paren.lparen", + "support.function", + "paren.lparen", + "variable", + "paren.rparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + ".box-shadow", + "(", + "@style", + ", ", + "rgba", + "(", + "0", + ", ", + "0", + ", ", + "0", + ", ", + "@alpha", + ")", + ")", + ";" + ], + "types": [ + "text", + "variable.language", + "paren.lparen", + "variable", + "text", + "support.function", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "text", + "variable", + "paren.rparen", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "// Box styles" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + ".box", + " ", + "{", + " " + ], + "types": [ + "variable.language", + "text", + "paren.lparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "color", + ": ", + "saturate", + "(", + "@base", + ", ", + "5%", + ")", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.function", + "paren.lparen", + "variable", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "border-color", + ": ", + "lighten", + "(", + "@base", + ", ", + "30%", + ")", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.function", + "paren.lparen", + "variable", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "div", + " ", + "{", + " ", + ".box-shadow", + "(", + "0", + " ", + "0", + " ", + "5px", + ", ", + "30%", + ")", + " ", + "}" + ], + "types": [ + "text", + "variable.language", + "text", + "paren.lparen", + "text", + "variable.language", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "a", + " ", + "{" + ], + "types": [ + "text", + "variable.language", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "color", + ": ", + "@base", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " &", + ":hover", + " ", + "{" + ], + "types": [ + "text", + "variable.language", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "color", + ": ", + "lighten", + "(", + "@base", + ", ", + "50%", + ")", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.function", + "paren.lparen", + "variable", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_liquid.json b/lib/ace/mode/_test/tokens_liquid.json new file mode 100644 index 00000000..36a09bc2 --- /dev/null +++ b/lib/ace/mode/_test/tokens_liquid.json @@ -0,0 +1,1163 @@ +[ + { + "state": "start", + "values": [ + "The following examples can be found in full at http://liquidmarkup.org/" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Liquid is an extraction from the e-commerce system Shopify." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "Shopify powers many thousands of e-commerce stores which all call for unique designs." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "For this we developed Liquid which allows our customers complete design freedom while" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "maintaining the integrity of our servers." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Liquid has been in production use since June 2006 and is now used by many other" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "hosted web applications." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "It was developed for usage in Ruby on Rails web applications and integrates seamlessly" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "as a plugin but it also works excellently as a stand alone library." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Here's what it looks like:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "<", + "ul", + " ", + "id", + "=", + "\"products\"", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "for", + " ", + "product", + " ", + "in", + " ", + "products", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "li", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "h2", + ">", + "{{", + " ", + "product", + ".", + "title", + " ", + "}}", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "variable", + "text", + "identifier", + "text", + "identifier", + "text", + "variable", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " Only {{ product.price | format_as_money }}" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "<", + "p", + ">", + "{{", + " ", + "product", + ".", + "description", + " | ", + "prettyprint", + " | ", + "truncate", + ": ", + "200", + " ", + "}}", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "variable", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "support.function", + "text", + "constant.numeric", + "text", + "variable", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "endfor", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Some more features include:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "h2", + ">", + "Filters", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">", + " The word \"tobi\" in uppercase: {{ 'tobi' | upcase }} ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">", + "The word \"tobi\" has {{ 'tobi' | size }} letters! ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">", + "Change \"Hello world\" to \"Hi world\": {{ 'Hello world' | replace: 'Hello', 'Hi' }} ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">", + "The date today is {{ 'now' | date: \"%Y %b %d\" }} ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "h2", + ">", + "If", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "if", + " ", + "user", + ".", + "name", + " ", + "=", + "=", + " ", + "'tobi'", + " ", + "or", + " ", + "user", + ".", + "name", + " ", + "=", + "=", + " ", + "'marc'", + " ", + "%}", + " " + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "string", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "string", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + " hi marc or tobi" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "endif", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "h2", + ">", + "Case", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "case", + " ", + "template", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "identifier", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "when", + " ", + "'index'", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "string", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " Welcome" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "when", + " ", + "'product'", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "string", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "{{", + " ", + "product", + ".", + "vendor", + " | ", + "link_to_vendor", + " ", + "}}", + " / {{ product.title }}" + ], + "types": [ + "text", + "variable", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "else", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "{{", + " ", + "page_title", + " ", + "}}" + ], + "types": [ + "text", + "variable", + "text", + "identifier", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "endcase", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "h2", + ">", + "For Loops", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "for", + " ", + "item", + " ", + "in", + " ", + "array", + " ", + "%}", + " " + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{{", + " ", + "item", + " ", + "}}" + ], + "types": [ + "text", + "variable", + "text", + "identifier", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "endfor", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "h2", + ">", + "Tables", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "p", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "tablerow", + " ", + "item", + " ", + "in", + " ", + "items", + " ", + "cols", + ": ", + "3", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "constant.numeric", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "if", + " ", + "tablerowloop", + ".", + "col_first", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " First column: {{ item.variable }}" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "else", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " Different column: {{ item.variable }}" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "endif", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + " ", + "{%", + " ", + "endtablerow", + " ", + "%}" + ], + "types": [ + "text", + "variable", + "text", + "keyword", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_lua.json b/lib/ace/mode/_test/tokens_lua.json new file mode 100644 index 00000000..5a832a0f --- /dev/null +++ b/lib/ace/mode/_test/tokens_lua.json @@ -0,0 +1,789 @@ +[ + { + "state": "qcomment", + "values": [ + "--[[--" + ], + "types": [ + "comment" + ] + }, + { + "state": "qcomment", + "values": [ + "num_args takes in 5.1 byte code and extracts the number of arguments" + ], + "types": [ + "comment" + ] + }, + { + "state": "qcomment", + "values": [ + "from its function header." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "--]]", + "--" + ], + "types": [ + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "function", + " ", + "int", + "(", + "t", + ")" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "return", + " ", + "t", + ":", + "byte", + "(", + "1", + ")", + "+", + "t", + ":", + "byte", + "(", + "2", + ")", + "*", + "0x100", + "+", + "t", + ":", + "byte", + "(", + "3", + ")", + "*", + "0x10000", + "+", + "t", + ":", + "byte", + "(", + "4", + ")", + "*", + "0x1000000" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "keyword.operator", + "support.function", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "identifier", + "keyword.operator", + "support.function", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "constant.numeric", + "keyword.operator", + "identifier", + "keyword.operator", + "support.function", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "constant.numeric", + "keyword.operator", + "identifier", + "keyword.operator", + "support.function", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + "end" + ], + "types": [ + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "function", + " ", + "num_args", + "(", + "func", + ")" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "local", + " ", + "dump", + " ", + "=", + " ", + "string", + ".", + "dump", + "(", + "func", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "support.function", + "text", + "keyword.operator", + "text", + "constant.library", + "text", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "local", + " ", + "offset", + ", ", + "cursor", + " ", + "=", + " ", + "int", + "(", + "dump", + ":", + "sub", + "(", + "13", + ")", + ")", + ", ", + "offset", + " ", + "+", + " ", + "26" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "paren.lparen", + "support.function", + "keyword.operator", + "support.function", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "paren.rparen", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + "\t", + "--Get the params and var flag (whether there's a ... in the param)" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "\t", + "return", + " ", + "dump", + ":", + "sub", + "(", + "cursor", + ")", + ":", + "byte", + "(", + ")", + ", ", + "dump", + ":", + "sub", + "(", + "cursor", + "+", + "1", + ")", + ":", + "byte", + "(", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "support.function", + "keyword.operator", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "keyword.operator", + "support.function", + "paren.lparen", + "paren.rparen", + "text", + "support.function", + "keyword.operator", + "support.function", + "paren.lparen", + "identifier", + "keyword.operator", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "support.function", + "paren.lparen", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "end" + ], + "types": [ + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-- Usage:" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "num_args", + "(", + "function", + "(", + "a", + ",", + "b", + ",", + "c", + ",", + "d", + ", ", + "...", + ")", + " ", + "end", + ")", + " ", + "-- return 4, 7" + ], + "types": [ + "identifier", + "paren.lparen", + "keyword", + "paren.lparen", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "paren.rparen", + "text", + "keyword", + "paren.rparen", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-- Python styled string format operator" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "local", + " ", + "gm", + " ", + "=", + " ", + "debug", + ".", + "getmetatable", + "(", + "\"\"", + ")" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.library", + "text", + "support.function", + "paren.lparen", + "string", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "gm", + ".", + "__mod", + "=", + "function", + "(", + "self", + ", ", + "other", + ")" + ], + "types": [ + "identifier", + "text", + "support.function", + "keyword.operator", + "keyword", + "paren.lparen", + "identifier", + "text", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "type", + "(", + "other", + ")", + " ", + "~", + "=", + " ", + "\"table\"", + " ", + "then", + " ", + "other", + " ", + "=", + " ", + "{", + "other", + "}", + " ", + "end" + ], + "types": [ + "text", + "keyword", + "text", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "keyword.operator", + "keyword.operator", + "text", + "string", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "for", + " ", + "i", + ",", + "v", + " ", + "in", + " ", + "ipairs", + "(", + "other", + ")", + " ", + "do", + " ", + "other", + "[", + "i", + "]", + " ", + "=", + " ", + "tostring", + "(", + "v", + ")", + " ", + "end" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword", + "text", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "keyword.operator", + "text", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "return", + " ", + "self", + ":", + "format", + "(", + "unpack", + "(", + "other", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "keyword.operator", + "support.function", + "paren.lparen", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "end" + ], + "types": [ + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "qstring3", + "values": [ + "print", + "(", + "[===[" + ], + "types": [ + "support.function", + "paren.lparen", + "string" + ] + }, + { + "state": "qstring3", + "values": [ + " blah blah %s, (%d %d)" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [ + "]===]", + "%", + "{", + "\"blah\"", + ", ", + "num_args", + "(", + "int", + ")", + "}", + ")" + ], + "types": [ + "string", + "keyword.operator", + "paren.lparen", + "string", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen", + "paren.rparen", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "qcomment1", + "values": [ + "--[=[--" + ], + "types": [ + "comment" + ] + }, + { + "state": "qcomment1", + "values": [ + "table.maxn is deprecated, use # instead." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "--]=]", + "--" + ], + "types": [ + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [ + "print", + "(", + "table", + ".", + "maxn", + "{", + "1", + ",", + "2", + ",", + "[", + "4", + "]", + "=", + "4", + ",", + "[", + "8", + "]", + "=", + "8", + ")", + " ", + "-- outputs 8 instead of 2" + ], + "types": [ + "support.function", + "paren.lparen", + "constant.library", + "text", + "invalid.deprecated", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "constant.numeric", + "text", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "constant.numeric", + "paren.rparen", + "text", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_luapage.json b/lib/ace/mode/_test/tokens_luapage.json new file mode 100644 index 00000000..f36e728f --- /dev/null +++ b/lib/ace/mode/_test/tokens_luapage.json @@ -0,0 +1,1430 @@ +[ + { + "state": "tag_embed_attribute_list", + "values": [ + "", + "<", + "!", + "DOCTYPE", + " ", + "html", + " ", + "PUBLIC", + " ", + "\"-//W3C//DTD XHTML 1.0 Strict//EN\"" + ], + "types": [ + "text", + "meta.tag", + "text", + "entity.other.attribute-name", + "text", + "entity.other.attribute-name", + "text", + "entity.other.attribute-name", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"", + ">" + ], + "types": [ + "text", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "html", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "lua-qcomment", + "values": [ + "<%", + " ", + "--[[--" + ], + "types": [ + "keyword", + "text", + "comment" + ] + }, + { + "state": "lua-qcomment", + "values": [ + " index.lp from the Kepler Project's LuaDoc HTML doclet." + ], + "types": [ + "comment" + ] + }, + { + "state": "lua-qcomment", + "values": [ + " http://keplerproject.github.com/luadoc/" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "--]]", + " ", + "%>" + ], + "types": [ + "comment", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "<", + "head", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "title", + ">", + "Reference", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "link", + " ", + "rel", + "=", + "\"stylesheet\"", + " ", + "href", + "=", + "\"<%=luadoc.doclet.html.link(\"", + "luadoc", + ".", + "css", + "\")%>\"", + " ", + "type", + "=", + "\"text/css\"", + " ", + "/>" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "entity.other.attribute-name", + "text", + "entity.other.attribute-name", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t", + "" + ], + "types": [ + "text", + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "body", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "div", + " ", + "id", + "=", + "\"container\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "div", + " ", + "id", + "=", + "\"product\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t", + "<", + "div", + " ", + "id", + "=", + "\"product_logo\"", + ">", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t", + "<", + "div", + " ", + "id", + "=", + "\"product_name\"", + ">", + "<", + "big", + ">", + "<", + "b", + ">", + "", + "", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t", + "<", + "div", + " ", + "id", + "=", + "\"product_description\"", + ">", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "", + " ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "div", + " ", + "id", + "=", + "\"main\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "div", + " ", + "id", + "=", + "\"navigation\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<%=", + "luadoc", + ".", + "doclet", + ".", + "html", + ".", + "include", + "(", + "\"menu.lp\"", + ", ", + "{", + " ", + "doc", + "=", + "doc", + " ", + "}", + ")", + "%>" + ], + "types": [ + "keyword", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "paren.lparen", + "string", + "text", + "paren.lparen", + "text", + "identifier", + "keyword.operator", + "identifier", + "text", + "paren.rparen", + "paren.rparen", + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "", + " ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "div", + " ", + "id", + "=", + "\"content\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<%", + "if", + " ", + "not", + " ", + "options", + ".", + "nomodules", + " ", + "and", + " ", + "#", + "doc", + ".", + "modules", + " ", + ">", + " ", + "0", + " ", + "then", + "%>" + ], + "types": [ + "keyword", + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword", + "text", + "keyword.operator", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "<", + "h2", + ">", + "Modules", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "table", + " ", + "class", + "=", + "\"module_list\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name.table", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [ + "<%", + "for", + " ", + "_", + ", ", + "modulename", + " ", + "in", + " ", + "ipairs", + "(", + "doc", + ".", + "modules", + ")", + " ", + "do", + "%>" + ], + "types": [ + "keyword", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword", + "text", + "support.function", + "paren.lparen", + "identifier", + "text", + "identifier", + "paren.rparen", + "text", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "\t", + "<", + "tr", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "<", + "td", + " ", + "class", + "=", + "\"name\"", + ">", + "<", + "a", + " ", + "href", + "=", + "\"<%=luadoc.doclet.html.module_link(modulename, doc)%>\"", + ">", + "<%=", + "modulename", + "%>", + "", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.anchor", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "keyword", + "identifier", + "keyword", + "meta.tag", + "meta.tag.tag-name.anchor", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "<", + "td", + " ", + "class", + "=", + "\"summary\"", + ">", + "<%=", + "doc", + ".", + "modules", + "[", + "modulename", + "]", + ".", + "summary", + "%>", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "keyword", + "identifier", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "identifier", + "keyword", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<%", + "end", + "%>" + ], + "types": [ + "keyword", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<%", + "end", + "%>" + ], + "types": [ + "keyword", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<%", + "if", + " ", + "not", + " ", + "options", + ".", + "nofiles", + " ", + "and", + " ", + "#", + "doc", + ".", + "files", + " ", + ">", + " ", + "0", + " ", + "then", + "%>" + ], + "types": [ + "keyword", + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword", + "text", + "keyword.operator", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "<", + "h2", + ">", + "Files", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<", + "table", + " ", + "class", + "=", + "\"file_list\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name.table", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [ + "<%", + "for", + " ", + "_", + ", ", + "filepath", + " ", + "in", + " ", + "ipairs", + "(", + "doc", + ".", + "files", + ")", + " ", + "do", + "%>" + ], + "types": [ + "keyword", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword", + "text", + "support.function", + "paren.lparen", + "identifier", + "text", + "identifier", + "paren.rparen", + "text", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "\t", + "<", + "tr", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "<", + "td", + " ", + "class", + "=", + "\"name\"", + ">", + "<", + "a", + " ", + "href", + "=", + "\"<%=luadoc.doclet.html.file_link(filepath)%>\"", + ">", + "<%=", + "filepath", + "%>", + "", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.anchor", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "keyword", + "identifier", + "keyword", + "meta.tag", + "meta.tag.tag-name.anchor", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "<", + "td", + " ", + "class", + "=", + "\"summary\"", + ">", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<%", + "end", + "%>" + ], + "types": [ + "keyword", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name.table", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "<%", + "end", + "%>" + ], + "types": [ + "keyword", + "keyword", + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "", + " ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "", + " ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "<", + "div", + " ", + "id", + "=", + "\"about\"", + ">" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "\t", + "<", + "p", + ">", + "<", + "a", + " ", + "href", + "=", + "\"http://validator.w3.org/check?uri=referer\"", + ">", + "<", + "img", + " ", + "src", + "=", + "\"http://www.w3.org/Icons/valid-xhtml10\"", + " ", + "alt", + "=", + "\"Valid XHTML 1.0!\"", + " ", + "height", + "=", + "\"31\"", + " ", + "width", + "=", + "\"88\"", + " ", + "/>", + "", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.anchor", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.image", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.anchor", + "meta.tag", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "", + " ", + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "", + " ", + "", + "\t" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "comment", + "comment", + "text" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_markdown.json b/lib/ace/mode/_test/tokens_markdown.json new file mode 100644 index 00000000..4c306d12 --- /dev/null +++ b/lib/ace/mode/_test/tokens_markdown.json @@ -0,0 +1,1844 @@ +[ + { + "state": "start", + "values": [ + "Ace (Ajax.org Cloud9 Editor)" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "============================" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [", + "Cloud9 IDE", + "](", + "http://www.cloud9ide.com/", + ") and the successor of the Mozilla Skywriter (Bespin) Project." + ], + "types": [ + "text", + "string", + "text", + "markup.underline", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Features" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "--------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "listblock", + "values": [ + "* ", + "Syntax highlighting" + ], + "types": [ + "markup.list", + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Automatic indent and outdent" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* An optional command line" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Handles huge documents (100,000 lines and more are no problem)" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Fully customizable key bindings including VI and Emacs modes" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Themes (TextMate themes can be imported)" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Search and replace with regular expressions" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Highlight matching parentheses" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Toggle between soft tabs and real tabs" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Displays hidden characters" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Drag and drop text using the mouse" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Line wrapping" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Unstructured / user code folding" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "* Live syntax checker (currently JavaScript/CoffeeScript)" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Take Ace for a spin!" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "--------------------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Check out the Ace live [", + "demo", + "](", + "http://ajaxorg.github.com/ace/", + ") or get a [", + "Cloud9 IDE account", + "](", + "http://run.cloud9ide.com", + ") to experience Ace while editing one of your own GitHub projects." + ], + "types": [ + "text", + "string", + "text", + "markup.underline", + "text", + "string", + "text", + "markup.underline", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "If you want, you can use Ace as a textarea replacement thanks to the [", + "Ace Bookmarklet", + "](", + "http://ajaxorg.github.com/ace/build/textarea/editor.html", + ")." + ], + "types": [ + "text", + "string", + "text", + "markup.underline", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "History" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "-------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Getting the code" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "----------------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " git clone git://github.com/ajaxorg/ace.git" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " cd ace" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " git submodule update --init --recursive" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Embedding Ace" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "-------------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the ", + "`", + "build", + "`", + " directory. The same packaged files are also available as a separate [", + "download", + "](", + "https://github.com/ajaxorg/ace/downloads", + "). Simply copy the contents of the ", + "`", + "src", + "`", + " subdirectory somewhere into your project and take a look at the included demos of how to use Ace." + ], + "types": [ + "text", + "support.function", + "support.function", + "support.function", + "text", + "string", + "text", + "markup.underline", + "text", + "support.function", + "support.function", + "support.function", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "The easiest version is simply:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "html-start", + "values": [ + "```html" + ], + "types": [ + "support.function" + ] + }, + { + "state": "html-start", + "values": [ + " ", + "<", + "div", + " ", + "id", + "=", + "\"editor\"", + ">", + "some text", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "html-start", + "values": [ + " ", + "<", + "script", + " ", + "src", + "=", + "\"src/ace.js\"", + " ", + "type", + "=", + "\"text/javascript\"", + " ", + "charset", + "=", + "\"utf-8\"", + ">", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.script", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.script", + "meta.tag" + ] + }, + { + "state": "html-js-start", + "values": [ + " ", + "<", + "script", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.script", + "meta.tag" + ] + }, + { + "state": "html-js-regex_allowed", + "values": [ + " ", + "window", + ".", + "onload", + " ", + "=", + " ", + "function", + "(", + ")", + " ", + "{" + ], + "types": [ + "text", + "storage.type", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator", + "text", + "storage.type", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "html-js-regex_allowed", + "values": [ + " ", + "var", + " ", + "editor", + " ", + "=", + " ", + "ace", + ".", + "edit", + "(", + "\"editor\"", + ")", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator", + "identifier", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "html-js-regex_allowed", + "values": [ + " ", + "}", + ";" + ], + "types": [ + "text", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "html-start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.script", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "With \"editor\" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned ", + "`", + "absolute", + "`", + " or ", + "`", + "relative", + "`", + " for Ace to work. e.g." + ], + "types": [ + "text", + "support.function", + "support.function", + "support.function", + "text", + "support.function", + "support.function", + "support.function", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "css-start", + "values": [ + "```css" + ], + "types": [ + "support.function" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + "#editor", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + "position", + ": ", + "absolute", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.constant", + "text" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + "width", + ": ", + "500", + "px", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "keyword", + "text" + ] + }, + { + "state": "css-ruleset", + "values": [ + " ", + "height", + ": ", + "400", + "px", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "keyword", + "text" + ] + }, + { + "state": "css-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "To change the theme simply include the Theme's JavaScript file" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "html-start", + "values": [ + "```html" + ], + "types": [ + "support.function" + ] + }, + { + "state": "html-start", + "values": [ + " ", + "<", + "script", + " ", + "src", + "=", + "\"src/theme-twilight.js\"", + " ", + "type", + "=", + "\"text/javascript\"", + " ", + "charset", + "=", + "\"utf-8\"", + ">", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.script", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.script", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "and configure the editor to use the theme:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "js-start", + "values": [ + "```javascript" + ], + "types": [ + "support.function" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "editor", + ".", + "setTheme", + "(", + "\"ace/theme/twilight\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "identifier", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "html-start", + "values": [ + "```html" + ], + "types": [ + "support.function" + ] + }, + { + "state": "html-start", + "values": [ + " ", + "<", + "script", + " ", + "src", + "=", + "\"src/mode-javascript.js\"", + " ", + "type", + "=", + "\"text/javascript\"", + " ", + "charset", + "=", + "\"utf-8\"", + ">", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name.script", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "meta.tag", + "meta.tag.tag-name.script", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Then the mode can be used like this:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "js-start", + "values": [ + "```javascript" + ], + "types": [ + "support.function" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "JavaScriptMode", + " ", + "=", + " ", + "require", + "(", + "\"ace/mode/javascript\"", + ")", + ".", + "Mode", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "editor", + ".", + "getSession", + "(", + ")", + ".", + "setMode", + "(", + "new", + " ", + "JavaScriptMode", + "(", + ")", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "identifier", + "paren.lparen", + "paren.rparen", + "punctuation.operator", + "identifier", + "paren.lparen", + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Documentation" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "-------------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "You find a lot more sample code in the [", + "demo app", + "](", + "https://github.com/ajaxorg/ace/blob/master/demo/demo.js", + ")." + ], + "types": [ + "text", + "string", + "text", + "markup.underline", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "There is also some documentation on the [", + "wiki page", + "](", + "https://github.com/ajaxorg/ace/wiki", + ")." + ], + "types": [ + "text", + "string", + "text", + "markup.underline", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "If you still need help, feel free to drop a mail on the [", + "ace mailing list", + "](", + "http://groups.google.com/group/ace-discuss", + ")." + ], + "types": [ + "text", + "string", + "text", + "markup.underline", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Running Ace" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "-----------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " ./static.py" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Or using Node.JS" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " ./static.js" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "The editor can then be opened at http://localhost:8888/index.html." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Package Ace" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "-----------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " git submodule update --init --recursive" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Afterwards Ace can be built by calling" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " ./Makefile.dryice.js normal" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "The packaged Ace will be put in the 'build' folder." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "To build the bookmarklet version execute" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " ./Makefile.dryice.js bm" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Running the Unit Tests" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "----------------------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " npm link ." + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "To run the tests call:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "githubblock", + "values": [ + "```bash" + ], + "types": [ + "support.function" + ] + }, + { + "state": "githubblock", + "values": [ + " node lib/ace/test/all.js" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [ + "```" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "You can also run the tests in your browser by serving:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " http://localhost:8888/lib/ace/test/tests.html" + ], + "types": [ + "support.function" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "This makes debugging failing tests way more easier." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Contributing" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "------------" + ], + "types": [ + "markup.heading.1" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "listblock", + "values": [ + "1. ", + "[The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting." + ], + "types": [ + "markup.list", + "markup.list" + ] + }, + { + "state": "listblock", + "values": [ + "2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects" + ], + "types": [ + "markup.list" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Email: fabian.jakobs@web.de" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Fax: +31 (0) 206388953" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Address: Ajax.org B.V." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " Keizersgracht 241" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " 1016 EA, Amsterdam" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " the Netherlands" + ], + "types": [ + "text" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_ocaml.json b/lib/ace/mode/_test/tokens_ocaml.json new file mode 100644 index 00000000..8b3b2fb1 --- /dev/null +++ b/lib/ace/mode/_test/tokens_ocaml.json @@ -0,0 +1,464 @@ +[ + { + "state": "comment", + "values": [ + "(*" + ], + "types": [ + "comment" + ] + }, + { + "state": "comment", + "values": [ + " * Example of early return implementation taken from" + ], + "types": [ + "comment" + ] + }, + { + "state": "comment", + "values": [ + " * http://ocaml.janestreet.com/?q=node/91" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + " *)" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "let", + " ", + "with_return", + " ", + "(", + "type", + " ", + "t", + ")", + " ", + "(", + "f", + " : ", + "_", + " ", + "-", + ">", + " ", + "t", + ")", + " ", + "=" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "paren.rparen", + "text", + "paren.lparen", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier", + "paren.rparen", + "text", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "let", + " ", + "module", + " ", + "M", + " ", + "=" + ], + "types": [ + "text", + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "struct", + " ", + "exception", + " ", + "Return", + " ", + "of", + " ", + "t", + " ", + "end" + ], + "types": [ + "text", + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "in" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "let", + " ", + "return", + " ", + "=", + " ", + "{", + " ", + "return", + " ", + "=", + " ", + "(", + "fun", + " ", + "x", + " ", + "-", + ">", + " ", + "raise", + " ", + "(", + "M", + ".", + "Return", + " ", + "x", + ")", + ")", + "; ", + "}", + " ", + "in" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "paren.lparen", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "support.function", + "text", + "paren.lparen", + "identifier", + "text", + "identifier", + "text", + "identifier", + "paren.rparen", + "paren.rparen", + "text", + "paren.rparen", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "try", + " ", + "f", + " ", + "return", + " ", + "with", + " ", + "M", + ".", + "Return", + " ", + "x", + " ", + "-", + ">", + " ", + "x" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "(* Function that uses the 'early return' functionality provided by `with_return` *)" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "let", + " ", + "sum_until_first_negative", + " ", + "list", + " ", + "=" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "support.function", + "text", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "with_return", + " ", + "(", + "fun", + " ", + "r", + " ", + "-", + ">" + ], + "types": [ + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "List", + ".", + "fold", + " ", + "list", + " ", + "~", + "init", + ":", + "0", + " ", + "~", + "f", + ":", + "(", + "fun", + " ", + "acc", + " ", + "x", + " ", + "-", + ">" + ], + "types": [ + "text", + "support.function", + "text", + "support.function", + "text", + "support.function", + "text", + "keyword.operator", + "support.function", + "text", + "constant.numeric", + "text", + "keyword.operator", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "x", + " ", + ">", + "=", + " ", + "0", + " ", + "then", + " ", + "acc", + " ", + "+", + " ", + "x", + " ", + "else", + " ", + "r", + ".", + "return", + " ", + "acc", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "paren.rparen", + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_perl.json b/lib/ace/mode/_test/tokens_perl.json new file mode 100644 index 00000000..4a847f4b --- /dev/null +++ b/lib/ace/mode/_test/tokens_perl.json @@ -0,0 +1,521 @@ +[ + { + "state": "start", + "values": [ + "#!/usr/bin/perl" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "use", + " ", + "strict", + ";" + ], + "types": [ + "keyword", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + "use", + " ", + "warnings", + ";" + ], + "types": [ + "keyword", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + "my", + " ", + "$num_primes", + " ", + "=", + " ", + "0", + ";" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [ + "my", + " @", + "primes", + ";" + ], + "types": [ + "keyword", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "# Put 2 as the first prime so we won't have an empty array" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "$primes", + "[", + "$num_primes", + "]", + " ", + "=", + " ", + "2", + ";" + ], + "types": [ + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [ + "$num_primes", + "++", + ";" + ], + "types": [ + "identifier", + "keyword.operator", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "MAIN_LOOP", + ":" + ], + "types": [ + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + "for", + " ", + "my", + " ", + "$number_to_check", + " ", + "(", + "3", + " ", + "..", + " ", + "200", + ")" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "lparen", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "{" + ], + "types": [ + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "for", + " ", + "my", + " ", + "$p", + " ", + "(", + "0", + " ", + "..", + " ", + "(", + "$num_primes", + "-1", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "lparen", + "constant.numeric", + "text", + "keyword.operator", + "text", + "lparen", + "identifier", + "constant.numeric", + "rparen", + "rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "(", + "$number_to_check", + " ", + "%", + " ", + "$primes", + "[", + "$p", + "]", + " ", + "==", + " ", + "0", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "lparen", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "keyword.operator", + "text", + "constant.numeric", + "rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "{" + ], + "types": [ + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "next", + " ", + "MAIN_LOOP", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "# If we reached this point it means $number_to_check is not" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "# divisable by any prime number that came before it." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + " ", + "$primes", + "[", + "$num_primes", + "]", + " ", + "=", + " ", + "$number_to_check", + ";" + ], + "types": [ + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "text", + "keyword.operator", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "$num_primes", + "++", + ";" + ], + "types": [ + "text", + "identifier", + "keyword.operator", + "text" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "for", + " ", + "my", + " ", + "$p", + " ", + "(", + "0", + " ", + "..", + " ", + "(", + "$num_primes", + "-1", + ")", + ")" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "lparen", + "constant.numeric", + "text", + "keyword.operator", + "text", + "lparen", + "identifier", + "constant.numeric", + "rparen", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "{" + ], + "types": [ + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "print", + " ", + "$primes", + "[", + "$p", + "]", + ",", + " ", + "\", \"", + ";" + ], + "types": [ + "text", + "support.function", + "text", + "identifier", + "lparen", + "identifier", + "rparen", + "keyword.operator", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [ + "print", + " ", + "\"\\n\"", + ";" + ], + "types": [ + "support.function", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_pgsql.json b/lib/ace/mode/_test/tokens_pgsql.json new file mode 100644 index 00000000..d20500f6 --- /dev/null +++ b/lib/ace/mode/_test/tokens_pgsql.json @@ -0,0 +1,1735 @@ +[ + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "BEGIN", + ";" + ], + "types": [ + "keyword.statementBegin", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "doc-start", + "values": [ + "/**" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "doc-start", + "values": [ + "* Samples from PostgreSQL src/tutorial/basics.source" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "start", + "values": [ + "*/" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "statement", + "values": [ + "CREATE", + " ", + "TABLE", + " ", + "weather", + " ", + "(" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "statement", + "values": [ + "\t", + "city", + "\t\t", + "varchar", + "(", + "80", + ")", + "," + ], + "types": [ + "text", + "identifier", + "text", + "keyword", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "statement", + "values": [ + "\t", + "temp_lo", + "\t\t", + "int", + ",\t\t", + "-- low temperature" + ], + "types": [ + "text", + "identifier", + "text", + "keyword", + "text", + "comment" + ] + }, + { + "state": "statement", + "values": [ + "\t", + "temp_hi", + "\t\t", + "int", + ",\t\t", + "-- high temperature" + ], + "types": [ + "text", + "identifier", + "text", + "keyword", + "text", + "comment" + ] + }, + { + "state": "statement", + "values": [ + "\t", + "prcp", + "\t\t", + "real", + ",\t\t", + "-- precipitation" + ], + "types": [ + "text", + "identifier", + "text", + "keyword", + "text", + "comment" + ] + }, + { + "state": "statement", + "values": [ + "\t", + "\"date\"", + "\t\t", + "date" + ], + "types": [ + "text", + "variable.language", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + ")", + ";" + ], + "types": [ + "paren.rparen", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "statement", + "values": [ + "CREATE", + " ", + "TABLE", + " ", + "cities", + " ", + "(" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "statement", + "values": [ + "\t", + "name", + "\t\t", + "varchar", + "(", + "80", + ")", + "," + ], + "types": [ + "text", + "keyword", + "text", + "keyword", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "statement", + "values": [ + "\t", + "location", + "\t", + "point" + ], + "types": [ + "text", + "keyword", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + ")", + ";" + ], + "types": [ + "paren.rparen", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "statement", + "values": [ + "INSERT", + " ", + "INTO", + " ", + "weather" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "VALUES", + " ", + "(", + "'San Francisco'", + ", ", + "46", + ", ", + "50", + ", ", + "0.25", + ", ", + "'1994-11-27'", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "string", + "text", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "text", + "string", + "paren.rparen", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "statement", + "values": [ + "INSERT", + " ", + "INTO", + " ", + "cities" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "VALUES", + " ", + "(", + "'San Francisco'", + ", ", + "'(-194.0, 53.0)'", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "string", + "text", + "string", + "paren.rparen", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "statement", + "values": [ + "INSERT", + " ", + "INTO", + " ", + "weather", + " ", + "(", + "city", + ", ", + "temp_lo", + ", ", + "temp_hi", + ", ", + "prcp", + ", ", + "\"date\"", + ")" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.language", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "VALUES", + " ", + "(", + "'San Francisco'", + ", ", + "43", + ", ", + "57", + ", ", + "0.0", + ", ", + "'1994-11-29'", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "string", + "text", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "text", + "string", + "paren.rparen", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "statement", + "values": [ + "INSERT", + " ", + "INTO", + " ", + "weather", + " ", + "(", + "date", + ", ", + "city", + ", ", + "temp_hi", + ", ", + "temp_lo", + ")" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "VALUES", + " ", + "(", + "'1994-11-29'", + ", ", + "'Hayward'", + ", ", + "54", + ", ", + "37", + ")", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "string", + "text", + "string", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "SELECT", + " ", + "city", + ", ", + "(", + "temp_hi", + "+", + "temp_lo", + ")", + "/", + "2", + " ", + "AS", + " ", + "temp_avg", + ", ", + "\"date\"", + " ", + "FROM", + " ", + "weather", + ";" + ], + "types": [ + "keyword.statementBegin", + "text", + "identifier", + "text", + "paren.lparen", + "identifier", + "keyword.operator", + "identifier", + "paren.rparen", + "keyword.operator", + "constant.numeric", + "text", + "keyword", + "text", + "identifier", + "text", + "variable.language", + "text", + "keyword", + "text", + "identifier", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "statement", + "values": [ + "SELECT", + " ", + "city", + ", ", + "temp_lo", + ", ", + "temp_hi", + ", ", + "prcp", + ", ", + "\"date\"", + ", ", + "location" + ], + "types": [ + "keyword.statementBegin", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.language", + "text", + "keyword" + ] + }, + { + "state": "statement", + "values": [ + " ", + "FROM", + " ", + "weather", + ", ", + "cities" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "WHERE", + " ", + "city", + " ", + "=", + " ", + "name", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "keyword", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "doc-start", + "values": [ + "/**" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "doc-start", + "values": [ + "* Dollar quotes starting at the end of the line are colored as SQL unless" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "doc-start", + "values": [ + "* a special language tag is used. Pearl and Python are currently implemented" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "doc-start", + "values": [ + "* but lots of others are possible." + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "start", + "values": [ + "*/" + ], + "types": [ + "comment.doc" + ] + }, + { + "state": "statement", + "values": [ + "create", + " ", + "or", + " ", + "replace", + " ", + "function", + " ", + "blob_content_chunked", + "(" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "keyword", + "text", + "keyword", + "text", + "identifier", + "paren.lparen" + ] + }, + { + "state": "statement", + "values": [ + " ", + "in", + " ", + "p_data", + " ", + "bytea", + ", " + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text" + ] + }, + { + "state": "statement", + "values": [ + " ", + "in", + " ", + "p_chunk", + " ", + "integer", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "paren.rparen" + ] + }, + { + "state": "dollarSql", + "values": [ + "returns", + " ", + "setof", + " ", + "bytea", + " ", + "as", + " ", + "$$" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "keyword", + "text", + "keyword", + "text", + "string" + ] + }, + { + "state": "dollarSql", + "values": [ + "-- Still SQL comments" + ], + "types": [ + "comment" + ] + }, + { + "state": "dollarSql", + "values": [ + "declare" + ], + "types": [ + "keyword" + ] + }, + { + "state": "dollarSql", + "values": [ + "\t", + "v_size", + " ", + "integer", + " ", + "=", + " ", + "octet_length", + "(", + "p_data", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword", + "text", + "keyword.operator", + "text", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "text" + ] + }, + { + "state": "dollarSql", + "values": [ + "begin" + ], + "types": [ + "keyword" + ] + }, + { + "state": "dollarSql", + "values": [ + "\t", + "for", + " ", + "i", + " ", + "in", + " ", + "1", + "..", + "v_size", + " ", + "by", + " ", + "p_chunk", + " ", + "loop" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "constant.numeric", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "dollarSql", + "values": [ + "\t\t", + "return", + " ", + "next", + " ", + "substring", + "(", + "p_data", + " ", + "from", + " ", + "i", + " ", + "for", + " ", + "p_chunk", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword", + "text", + "keyword", + "paren.lparen", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "paren.rparen", + "text" + ] + }, + { + "state": "dollarSql", + "values": [ + "\t", + "end", + " ", + "loop", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text" + ] + }, + { + "state": "dollarSql", + "values": [ + "end", + ";" + ], + "types": [ + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + "$$", + " ", + "language", + " ", + "plpgsql", + " ", + "stable", + ";" + ], + "types": [ + "string", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-- pl/perl" + ], + "types": [ + "comment" + ] + }, + { + "state": "perl-start", + "values": [ + "CREATE", + " ", + "FUNCTION", + " ", + "perl_max", + " ", + "(", + "integer", + ", ", + "integer", + ")", + " ", + "RETURNS", + " ", + "integer", + " ", + "AS", + " ", + "$perl$" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "keyword", + "paren.rparen", + "text", + "keyword", + "text", + "keyword", + "text", + "keyword", + "text", + "string" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "# perl comment..." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "my", + " ", + "(", + "$x", + ",", + "$y", + ")", + " ", + "=", + " @", + "_", + ";" + ], + "types": [ + "text", + "keyword", + "text", + "lparen", + "identifier", + "keyword.operator", + "identifier", + "rparen", + "text", + "keyword.operator", + "text", + "identifier", + "text" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "if", + " ", + "(", + "!", + " ", + "defined", + " ", + "$x", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "lparen", + "keyword.operator", + "text", + "support.function", + "text", + "identifier", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "if", + " ", + "(", + "!", + " ", + "defined", + " ", + "$y", + ")", + " ", + "{", + " ", + "return", + " ", + "undef", + "; ", + "}" + ], + "types": [ + "text", + "keyword", + "text", + "lparen", + "keyword.operator", + "text", + "support.function", + "text", + "identifier", + "rparen", + "text", + "lparen", + "text", + "support.function", + "text", + "support.function", + "text", + "rparen" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "return", + " ", + "$y", + ";" + ], + "types": [ + "text", + "support.function", + "text", + "identifier", + "text" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "rparen" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "if", + " ", + "(", + "!", + " ", + "defined", + " ", + "$y", + ")", + " ", + "{", + " ", + "return", + " ", + "$x", + "; ", + "}" + ], + "types": [ + "text", + "keyword", + "text", + "lparen", + "keyword.operator", + "text", + "support.function", + "text", + "identifier", + "rparen", + "text", + "lparen", + "text", + "support.function", + "text", + "identifier", + "text", + "rparen" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "if", + " ", + "(", + "$x", + " ", + ">", + " ", + "$y", + ")", + " ", + "{", + " ", + "return", + " ", + "$x", + "; ", + "}" + ], + "types": [ + "text", + "keyword", + "text", + "lparen", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "rparen", + "text", + "lparen", + "text", + "support.function", + "text", + "identifier", + "text", + "rparen" + ] + }, + { + "state": "perl-start", + "values": [ + " ", + "return", + " ", + "$y", + ";" + ], + "types": [ + "text", + "support.function", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + "$perl$", + " ", + "LANGUAGE", + " ", + "plperl", + ";" + ], + "types": [ + "string", + "text", + "keyword", + "text", + "identifier", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-- pl/python" + ], + "types": [ + "comment" + ] + }, + { + "state": "python-start", + "values": [ + "CREATE", + " ", + "FUNCTION", + " ", + "usesavedplan", + "(", + ")", + " ", + "RETURNS", + " ", + "trigger", + " ", + "AS", + " ", + "$python$" + ], + "types": [ + "keyword.statementBegin", + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "text", + "keyword", + "text", + "keyword", + "text", + "keyword", + "text", + "string" + ] + }, + { + "state": "python-start", + "values": [ + " ", + "# python comment..." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "python-start", + "values": [ + " ", + "if", + " ", + "SD", + ".", + "has_key", + "(", + "\"plan\"", + ")", + ":" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen", + "text" + ] + }, + { + "state": "python-start", + "values": [ + " ", + "plan", + " ", + "=", + " ", + "SD", + "[", + "\"plan\"", + "]" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen" + ] + }, + { + "state": "python-start", + "values": [ + " ", + "else", + ":" + ], + "types": [ + "text", + "keyword", + "text" + ] + }, + { + "state": "python-start", + "values": [ + " ", + "plan", + " ", + "=", + " ", + "plpy", + ".", + "prepare", + "(", + "\"SELECT 1\"", + ")" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen" + ] + }, + { + "state": "python-start", + "values": [ + " ", + "SD", + "[", + "\"plan\"", + "]", + " ", + "=", + " ", + "plan" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "$python$", + " ", + "LANGUAGE", + " ", + "plpythonu", + ";" + ], + "types": [ + "string", + "text", + "keyword", + "text", + "identifier", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-- psql commands" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "\\df cash*" + ], + "types": [ + "support.buildin" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "-- Some string samples." + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "select", + " ", + "'don'", + "'t do it now;'", + " ", + "|", + "|", + " ", + "'maybe later'", + ";" + ], + "types": [ + "keyword.statementBegin", + "text", + "string", + "string", + "text", + "keyword.operator", + "keyword.operator", + "text", + "string", + "statementEnd" + ] + }, + { + "state": "start", + "values": [ + "select", + " ", + "E", + "'dont\\'t do it'", + ";" + ], + "types": [ + "keyword.statementBegin", + "text", + "identifier", + "string", + "statementEnd" + ] + }, + { + "state": "start", + "values": [ + "select", + " ", + "length", + "(", + "'some other'", + "'s stuff'", + " ", + "|", + "|", + " ", + "$$", + "cat in hat's stuff $$", + ")", + ";" + ], + "types": [ + "keyword.statementBegin", + "text", + "support.function", + "paren.lparen", + "string", + "string", + "text", + "keyword.operator", + "keyword.operator", + "text", + "string", + "string", + "paren.rparen", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "dollarStatementString", + "values": [ + "select", + " ", + "$$ strings" + ], + "types": [ + "keyword.statementBegin", + "text", + "string" + ] + }, + { + "state": "dollarStatementString", + "values": [ + "over multiple " + ], + "types": [ + "string" + ] + }, + { + "state": "dollarStatementString", + "values": [ + "lines - use dollar quotes" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [ + "$$", + ";" + ], + "types": [ + "string", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "END", + ";" + ], + "types": [ + "keyword.statementBegin", + "statementEnd" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_php.json b/lib/ace/mode/_test/tokens_php.json new file mode 100644 index 00000000..13dfbea4 --- /dev/null +++ b/lib/ace/mode/_test/tokens_php.json @@ -0,0 +1,417 @@ +[ + { + "state": "start", + "values": [ + "" + ], + "types": [ + "support.php_tag" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_powershell.json b/lib/ace/mode/_test/tokens_powershell.json new file mode 100644 index 00000000..9be579a1 --- /dev/null +++ b/lib/ace/mode/_test/tokens_powershell.json @@ -0,0 +1,433 @@ +[ + { + "state": "start", + "values": [ + "# This is a simple comment" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "function", + " ", + "Hello", + "(", + "$name", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "variable.instance", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "Write-host", + " ", + "\"Hello $name\"" + ], + "types": [ + "text", + "identifier", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "function", + " ", + "add", + "(", + "$left", + ", ", + "$right", + "=", + "4", + ")", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "lparen", + "variable.instance", + "text", + "variable.instance", + "keyword.operator", + "constant.numeric", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "(", + "$right", + " ", + "-ne", + " ", + "4", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "lparen", + "variable.instance", + "text", + "keyword.operator", + "text", + "constant.numeric", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "return", + " ", + "$left" + ], + "types": [ + "text", + "keyword", + "text", + "variable.instance" + ] + }, + { + "state": "start", + "values": [ + " ", + "}", + " ", + "elseif", + " ", + "(", + "$left", + " ", + "-eq", + " ", + "$null", + " ", + "-and", + " ", + "$right", + " ", + "-eq", + " ", + "2", + ")", + " ", + "{" + ], + "types": [ + "text", + "rparen", + "text", + "keyword", + "text", + "lparen", + "variable.instance", + "text", + "keyword.operator", + "text", + "constant.language", + "text", + "keyword.operator", + "text", + "variable.instance", + "text", + "keyword.operator", + "text", + "constant.numeric", + "rparen", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "return", + " ", + "3" + ], + "types": [ + "text", + "keyword", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "}", + " ", + "else", + " ", + "{" + ], + "types": [ + "text", + "rparen", + "text", + "keyword", + "text", + "lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "return", + " ", + "2" + ], + "types": [ + "text", + "keyword", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "$number", + " ", + "=", + " ", + "1", + " ", + "+", + " ", + "2", + ";" + ], + "types": [ + "variable.instance", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [ + "$number", + " ", + "+", + "=", + " ", + "3" + ], + "types": [ + "variable.instance", + "text", + "keyword.operator", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Write-Host", + " ", + "Hello", + " ", + "-", + "name", + " ", + "\"World\"" + ], + "types": [ + "support.function", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "string" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "$an_array", + " ", + "=", + " @", + "(", + "1", + ", ", + "2", + ", ", + "3", + ")" + ], + "types": [ + "variable.instance", + "text", + "keyword.operator", + "text", + "lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "rparen" + ] + }, + { + "state": "start", + "values": [ + "$a_hash", + " ", + "=", + " @", + "{", + "\"something\"", + " ", + "=", + " ", + "\"something else\"", + "}" + ], + "types": [ + "variable.instance", + "text", + "keyword.operator", + "text", + "lparen", + "string", + "text", + "keyword.operator", + "text", + "string", + "rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "&", + " ", + "notepad", + " .\\", + "readme", + ".", + "md" + ], + "types": [ + "keyword.operator", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_python.json b/lib/ace/mode/_test/tokens_python.json new file mode 100644 index 00000000..f5416454 --- /dev/null +++ b/lib/ace/mode/_test/tokens_python.json @@ -0,0 +1,351 @@ +[ + { + "state": "start", + "values": [ + "#!/usr/local/bin/python" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "import", + " ", + "string", + ", ", + "sys" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "# If no arguments were given, print a helpful message" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "if", + " ", + "len", + "(", + "sys", + ".", + "argv", + ")", + "==", + "1", + ":" + ], + "types": [ + "keyword", + "text", + "support.function", + "paren.lparen", + "identifier", + "text", + "identifier", + "paren.rparen", + "keyword.operator", + "constant.numeric", + "text" + ] + }, + { + "state": "qstring", + "values": [ + " ", + "print", + " ", + "'''Usage:" + ], + "types": [ + "text", + "keyword", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + "celsius temp1 temp2 ...'''" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "sys", + ".", + "exit", + "(", + "0", + ")" + ], + "types": [ + "text", + "identifier", + "text", + "identifier", + "paren.lparen", + "constant.numeric", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "# Loop over the arguments" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "for", + " ", + "i", + " ", + "in", + " ", + "sys", + ".", + "argv", + "[", + "1", + ":", + "]", + ":" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "paren.lparen", + "constant.numeric", + "text", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "try", + ":" + ], + "types": [ + "text", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "fahrenheit", + "=", + "float", + "(", + "string", + ".", + "atoi", + "(", + "i", + ")", + ")" + ], + "types": [ + "text", + "identifier", + "keyword.operator", + "support.function", + "paren.lparen", + "identifier", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "except", + " ", + "string", + ".", + "atoi_error", + ":" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "print", + " ", + "repr", + "(", + "i", + ")", + ", ", + "\"not a numeric value\"" + ], + "types": [ + "text", + "keyword", + "text", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "else", + ":" + ], + "types": [ + "text", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "celsius", + "=", + "(", + "fahrenheit", + "-", + "32", + ")", + "*", + "5.0", + "/", + "9.0" + ], + "types": [ + "text", + "identifier", + "keyword.operator", + "paren.lparen", + "identifier", + "keyword.operator", + "constant.numeric", + "paren.rparen", + "keyword.operator", + "constant.numeric", + "keyword.operator", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "print", + " ", + "'%i\\260F = %i\\260C'", + " ", + "%", + " ", + "(", + "int", + "(", + "fahrenheit", + ")", + ", ", + "int", + "(", + "celsius", + "+", + ".5", + ")", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "string", + "text", + "keyword.operator", + "text", + "paren.lparen", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "support.function", + "paren.lparen", + "identifier", + "keyword.operator", + "constant.numeric", + "paren.rparen", + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_ruby.json b/lib/ace/mode/_test/tokens_ruby.json new file mode 100644 index 00000000..eeebc58e --- /dev/null +++ b/lib/ace/mode/_test/tokens_ruby.json @@ -0,0 +1,170 @@ +[ + { + "state": "start", + "values": [ + "#!/usr/bin/ruby" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "# Program to find the factorial of a number" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "def", + " ", + "fact", + "(", + "n", + ")" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "n", + " ", + "==", + " ", + "0" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "1" + ], + "types": [ + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "else" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "n", + " ", + "*", + " ", + "fact", + "(", + "n", + "-1", + ")" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "paren.lparen", + "identifier", + "constant.numeric", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "end" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "end" + ], + "types": [ + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "puts", + " ", + "fact", + "(", + "ARGV", + "[", + "0", + "]", + ".", + "to_i", + ")" + ], + "types": [ + "support.function", + "text", + "identifier", + "paren.lparen", + "variable.class", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "text", + "identifier", + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_scad.json b/lib/ace/mode/_test/tokens_scad.json new file mode 100644 index 00000000..2cc2a75b --- /dev/null +++ b/lib/ace/mode/_test/tokens_scad.json @@ -0,0 +1,469 @@ +[ + { + "state": "start", + "values": [ + "// ace can highlight scad!" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "module", + " ", + "Element", + "(", + "xpos", + ", ", + "ypos", + ", ", + "zpos", + ")", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "text", + "identifier", + "text", + "identifier", + "paren.rparen", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "translate", + "(", + "[", + "xpos", + ",", + "ypos", + ",", + "zpos", + "]", + ")", + "{" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "paren.lparen", + "identifier", + "text", + "identifier", + "text", + "identifier", + "paren.rparen", + "paren.rparen", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "union", + "(", + ")", + "{" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t\t\t", + "cube", + "(", + "[", + "10", + ",", + "10", + ",", + "4", + "]", + ",", + "true", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "text", + "identifier", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + "\t\t\t", + "cylinder", + "(", + "10", + ",", + "15", + ",", + "5", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + "\t\t\t", + "translate", + "(", + "[", + "0", + ",", + "0", + ",", + "10", + "]", + ")", + "sphere", + "(", + "5", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "paren.rparen", + "identifier", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "union", + "(", + ")", + "{" + ], + "types": [ + "identifier", + "paren.lparen", + "paren.rparen", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "for", + "(", + "i", + "=", + "[", + "0", + ":", + "30", + "]", + ")", + "{" + ], + "types": [ + "text", + "keyword", + "paren.lparen", + "identifier", + "keyword.operator", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "paren.rparen", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t\t# ", + "Element", + "(", + "0", + ",", + "0", + ",", + "0", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "Element", + "(", + "15", + "*", + "i", + ",", + "0", + ",", + "0", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "constant.numeric", + "keyword.operator", + "identifier", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + "\t", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "for", + " ", + "(", + "i", + " ", + "=", + " ", + "[", + "3", + ", ", + "5", + ", ", + "7", + ", ", + "11", + "]", + ")", + "{" + ], + "types": [ + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "paren.rparen", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "rotate", + "(", + "[", + "i", + "*", + "10", + ",", + "0", + ",", + "0", + "]", + ")", + "scale", + "(", + "[", + "1", + ",", + "1", + ",", + "i", + "]", + ")", + "cube", + "(", + "10", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "paren.lparen", + "identifier", + "keyword.operator", + "constant.numeric", + "text", + "constant.numeric", + "text", + "constant.numeric", + "paren.rparen", + "paren.rparen", + "identifier", + "paren.lparen", + "paren.lparen", + "constant.numeric", + "text", + "constant.numeric", + "text", + "identifier", + "paren.rparen", + "paren.rparen", + "identifier", + "paren.lparen", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_scala.json b/lib/ace/mode/_test/tokens_scala.json new file mode 100644 index 00000000..ace5ed7c --- /dev/null +++ b/lib/ace/mode/_test/tokens_scala.json @@ -0,0 +1,1287 @@ +[ + { + "state": "start", + "values": [ + "// http://www.scala-lang.org/node/54" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "package", + " ", + "examples", + ".", + "actors" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "import", + " ", + "scala", + ".", + "actors", + ".", + "Actor" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "import", + " ", + "scala", + ".", + "actors", + ".", + "Actor", + ".", + "_" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "abstract", + " ", + "class", + " ", + "PingMessage" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "case", + " ", + "object", + " ", + "Start", + " ", + "extends", + " ", + "PingMessage" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "case", + " ", + "object", + " ", + "SendPing", + " ", + "extends", + " ", + "PingMessage" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "case", + " ", + "object", + " ", + "Pong", + " ", + "extends", + " ", + "PingMessage" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "abstract", + " ", + "class", + " ", + "PongMessage" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "case", + " ", + "object", + " ", + "Ping", + " ", + "extends", + " ", + "PongMessage" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "case", + " ", + "object", + " ", + "Stop", + " ", + "extends", + " ", + "PongMessage" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "object", + " ", + "pingpong", + " ", + "extends", + " ", + "Application", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "val", + " ", + "pong", + " ", + "=", + " ", + "new", + " ", + "Pong" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "val", + " ", + "ping", + " ", + "=", + " ", + "new", + " ", + "Ping", + "(", + "100000", + ", ", + "pong", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "constant.numeric", + "text", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "ping", + ".", + "start" + ], + "types": [ + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "pong", + ".", + "start" + ], + "types": [ + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "ping", + " ", + "!", + " ", + "Start" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "class", + " ", + "Ping", + "(", + "count", + ": ", + "Int", + ", ", + "pong", + ": ", + "Actor", + ")", + " ", + "extends", + " ", + "Actor", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "paren.lparen", + "identifier", + "text", + "support.function", + "text", + "identifier", + "text", + "identifier", + "paren.rparen", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "def", + " ", + "act", + "(", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "println", + "(", + "\"Ping: Initializing with count \"", + "+", + "count", + "+", + "\": \"", + "+", + "pong", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "keyword.operator", + "identifier", + "keyword.operator", + "string", + "keyword.operator", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "var", + " ", + "pingsLeft", + " ", + "=", + " ", + "count" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "loop", + " ", + "{" + ], + "types": [ + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "react", + " ", + "{" + ], + "types": [ + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "case", + " ", + "Start", + " ", + "=", + ">" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "println", + "(", + "\"Ping: starting.\"", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "pong", + " ", + "!", + " ", + "Ping" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "pingsLeft", + " ", + "=", + " ", + "pingsLeft", + " ", + "-", + " ", + "1" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "case", + " ", + "SendPing", + " ", + "=", + ">" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "pong", + " ", + "!", + " ", + "Ping" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "pingsLeft", + " ", + "=", + " ", + "pingsLeft", + " ", + "-", + " ", + "1" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "case", + " ", + "Pong", + " ", + "=", + ">" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "(", + "pingsLeft", + " ", + "%", + " ", + "1000", + " ", + "==", + " ", + "0", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "println", + "(", + "\"Ping: pong from: \"", + "+", + "sender", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "keyword.operator", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "(", + "pingsLeft", + " ", + ">", + " ", + "0", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "self", + " ", + "!", + " ", + "SendPing" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "else", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "println", + "(", + "\"Ping: Stop.\"", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "pong", + " ", + "!", + " ", + "Stop" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "exit", + "(", + "'stop", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "symbol.constant", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "class", + " ", + "Pong", + " ", + "extends", + " ", + "Actor", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "def", + " ", + "act", + "(", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "var", + " ", + "pongCount", + " ", + "=", + " ", + "0" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "loop", + " ", + "{" + ], + "types": [ + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "react", + " ", + "{" + ], + "types": [ + "text", + "identifier", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "case", + " ", + "Ping", + " ", + "=", + ">" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "(", + "pongCount", + " ", + "%", + " ", + "1000", + " ", + "==", + " ", + "0", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "println", + "(", + "\"Pong: ping \"", + "+", + "pongCount", + "+", + "\" from \"", + "+", + "sender", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "keyword.operator", + "identifier", + "keyword.operator", + "string", + "keyword.operator", + "identifier", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "sender", + " ", + "!", + " ", + "Pong" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "pongCount", + " ", + "=", + " ", + "pongCount", + " ", + "+", + " ", + "1" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "case", + " ", + "Stop", + " ", + "=", + ">" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator" + ] + }, + { + "state": "start", + "values": [ + " ", + "println", + "(", + "\"Pong: Stop.\"", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "exit", + "(", + "'stop", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "symbol.constant", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_scss.json b/lib/ace/mode/_test/tokens_scss.json new file mode 100644 index 00000000..91197988 --- /dev/null +++ b/lib/ace/mode/_test/tokens_scss.json @@ -0,0 +1,300 @@ +[ + { + "state": "start", + "values": [ + "/*", + " style.scss */" + ], + "types": [ + "comment", + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "#navbar", + " ", + "{" + ], + "types": [ + "variable.language", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "$navbar-width", + ": ", + "800px", + ";" + ], + "types": [ + "text", + "variable", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "$items", + ": ", + "5", + ";" + ], + "types": [ + "text", + "variable", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "$navbar-color", + ": ", + "#ce4dd6", + ";" + ], + "types": [ + "text", + "variable", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "width", + ": ", + "$navbar-width", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "border-bottom", + ": ", + "2px", + " ", + "solid", + " ", + "$navbar-color", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "constant.numeric", + "text", + "constant.language", + "text", + "variable", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "li", + " ", + "{" + ], + "types": [ + "text", + "variable.language", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "float", + ": ", + "left", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.type", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "width", + ": ", + "$navbar-width", + "/", + "$items", + " ", + "-", + " ", + "10px", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "variable", + "text", + "variable", + "text", + "constant", + "text", + "constant.numeric", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "background-color", + ": ", + "lighten", + "(", + "$navbar-color", + ", ", + "20%", + ")", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.function", + "paren.lparen", + "variable", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " &", + ":hover", + " ", + "{" + ], + "types": [ + "text", + "variable.language", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "background-color", + ": ", + "lighten", + "(", + "$navbar-color", + ", ", + "10%", + ")", + ";" + ], + "types": [ + "text", + "support.type", + "text", + "support.function", + "paren.lparen", + "variable", + "text", + "constant.numeric", + "paren.rparen", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_sh.json b/lib/ace/mode/_test/tokens_sh.json new file mode 100644 index 00000000..639699ef --- /dev/null +++ b/lib/ace/mode/_test/tokens_sh.json @@ -0,0 +1,749 @@ +[ + { + "state": "start", + "values": [ + "#!/bin/sh" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "# Script to open a browser to current branch" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "# Repo formats:" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "# ssh git@github.com:richoH/gh_pr.git" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "# http https://richoH@github.com/richoH/gh_pr.git" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "# git git://github.com/richoH/gh_pr.git" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "username=", + "`", + "git", + " ", + "config", + " ", + "-", + "-", + "get", + " ", + "github", + ".", + "user", + "`" + ], + "types": [ + "variable", + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "keyword.operator", + "identifier", + "text", + "identifier", + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "get_repo()", + " ", + "{" + ], + "types": [ + "support.function", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "git", + " ", + "remote", + " ", + "-", + "v", + " | ", + "grep", + " $", + "{", + "@:", + "-", + "$username", + "}", + " | ", + "while", + " ", + "read", + " ", + "remote", + "; ", + "do" + ], + "types": [ + "text", + "identifier", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "identifier", + "text", + "paren.lparen", + "text", + "keyword.operator", + "variable", + "paren.rparen", + "text", + "keyword", + "text", + "keyword", + "text", + "identifier", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "repo=", + "`", + "echo", + " ", + "$remote", + " | ", + "grep", + " ", + "-", + "E", + " ", + "-", + "o", + " ", + "\"git@github.com:[^ ]*\"", + "`; ", + "then" + ], + "types": [ + "text", + "keyword", + "text", + "variable", + "text", + "constant.language", + "text", + "variable", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "string", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "echo", + " ", + "$repo", + " | ", + "sed", + " ", + "-", + "e", + " ", + "\"s/^git@github\\.com://\"", + " ", + "-", + "e", + " ", + "\"s/\\.git$//\"" + ], + "types": [ + "text", + "constant.language", + "text", + "variable", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "string", + "text", + "keyword.operator", + "identifier", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "exit", + " ", + "1" + ], + "types": [ + "text", + "constant.language", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "fi" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "repo=", + "`", + "echo", + " ", + "$remote", + " | ", + "grep", + " ", + "-", + "E", + " ", + "-", + "o", + " ", + "\"https?://([^@]*@)?github.com/[^ ]*\\.git\"", + "`; ", + "then" + ], + "types": [ + "text", + "keyword", + "text", + "variable", + "text", + "constant.language", + "text", + "variable", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "string", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "echo", + " ", + "$repo", + " | ", + "sed", + " ", + "-", + "e", + " ", + "\"s|^https?://||\"", + " ", + "-", + "e", + " ", + "\"s/^.*github\\.com\\///\"", + " ", + "-", + "e", + " ", + "\"s/\\.git$//\"" + ], + "types": [ + "text", + "constant.language", + "text", + "variable", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "string", + "text", + "keyword.operator", + "identifier", + "text", + "string", + "text", + "keyword.operator", + "identifier", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "exit", + " ", + "1" + ], + "types": [ + "text", + "constant.language", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "fi" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "repo=", + "`", + "echo", + " ", + "$remote", + " | ", + "grep", + " ", + "-", + "E", + " ", + "-", + "o", + " ", + "\"git://github.com/[^ ]*\\.git\"", + "`; ", + "then" + ], + "types": [ + "text", + "keyword", + "text", + "variable", + "text", + "constant.language", + "text", + "variable", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "string", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "echo", + " ", + "$repo", + " | ", + "sed", + " ", + "-", + "e", + " ", + "\"s|^git://github.com/||\"", + " ", + "-", + "e", + " ", + "\"s/\\.git$//\"" + ], + "types": [ + "text", + "constant.language", + "text", + "variable", + "text", + "identifier", + "text", + "keyword.operator", + "identifier", + "text", + "string", + "text", + "keyword.operator", + "identifier", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "exit", + " ", + "1" + ], + "types": [ + "text", + "constant.language", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "fi" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "done" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "if", + " ", + "[", + " ", + "$?", + " ", + "-", + "eq", + " ", + "0", + " ", + "]", + "; ", + "then" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "text", + "variable.language", + "text", + "keyword.operator", + "identifier", + "text", + "constant.numeric", + "text", + "paren.rparen", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "echo", + " ", + "\"Couldn't find a valid remote\"", + " ", + ">", + "&2" + ], + "types": [ + "text", + "constant.language", + "text", + "string", + "text", + "keyword.operator", + "support.function" + ] + }, + { + "state": "start", + "values": [ + " ", + "exit", + " ", + "1" + ], + "types": [ + "text", + "constant.language", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "fi" + ], + "types": [ + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + "}" + ], + "types": [ + "paren.rparen" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "if", + " ", + "repo=", + "`", + "get_repo", + " $@`; ", + "then" + ], + "types": [ + "keyword", + "text", + "variable", + "text", + "identifier", + "text", + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "branch=", + "`", + "git", + " ", + "symbolic", + "-", + "ref", + " ", + "HEAD", + " ", + "2", + ">", + "/", + "dev", + "/", + "null", + "`" + ], + "types": [ + "text", + "variable", + "text", + "identifier", + "text", + "identifier", + "keyword.operator", + "identifier", + "text", + "identifier", + "text", + "constant.numeric", + "keyword.operator", + "keyword.operator", + "identifier", + "keyword.operator", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "echo", + " ", + "\"http://github.com/$repo/pull/new/${branch##refs/heads/}\"" + ], + "types": [ + "text", + "constant.language", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + "else" + ], + "types": [ + "keyword" + ] + }, + { + "state": "start", + "values": [ + " ", + "exit", + " ", + "1" + ], + "types": [ + "text", + "constant.language", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + "fi" + ], + "types": [ + "keyword" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_sql.json b/lib/ace/mode/_test/tokens_sql.json new file mode 100644 index 00000000..ffb5bb78 --- /dev/null +++ b/lib/ace/mode/_test/tokens_sql.json @@ -0,0 +1,126 @@ +[ + { + "state": "start", + "values": [ + "SELECT", + " ", + "city", + ", ", + "COUNT", + "(", + "id", + ")", + " ", + "AS", + " ", + "users_count" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "support.function", + "paren.lparen", + "identifier", + "paren.rparen", + "text", + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "FROM", + " ", + "users" + ], + "types": [ + "keyword", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + "WHERE", + " ", + "group_name", + " ", + "=", + " ", + "'salesman'" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + "AND", + " ", + "created", + " ", + ">", + " ", + "'2011-05-21'" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + "GROUP", + " ", + "BY", + " ", + "1" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + "ORDER", + " ", + "BY", + " ", + "2", + " ", + "DESC" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "constant.numeric", + "text", + "keyword" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_svg.json b/lib/ace/mode/_test/tokens_svg.json new file mode 100644 index 00000000..72e412ab --- /dev/null +++ b/lib/ace/mode/_test/tokens_svg.json @@ -0,0 +1,1611 @@ +[ + { + "state": "tag_embed_attribute_list", + "values": [ + "<", + "svg" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "width", + "=", + "\"800\"", + " ", + "height", + "=", + "\"600\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "xmlns", + "=", + "\"http://www.w3.org/2000/svg\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "onload", + "=", + "\"StartAnimation(evt)\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " ", + "<", + "title", + ">", + "Test Tube Progress Bar", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "desc", + ">", + "Created for the Web Directions SVG competition", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "<", + "script", + " ", + "type", + "=", + "\"text/ecmascript\"", + ">", + "<", + "!", + "[", + "CDATA", + "[" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "keyword.operator", + "keyword.operator", + "paren.lparen", + "identifier", + "paren.lparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "timevalue", + " ", + "=", + " ", + "0", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "timer_increment", + " ", + "=", + " ", + "1", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "max_time", + " ", + "=", + " ", + "100", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "hickory", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "dickory", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "dock", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "var", + " ", + "i", + ";" + ], + "types": [ + "text", + "storage.type", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [], + "types": [] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "function", + " ", + "StartAnimation", + "(", + "evt", + ")", + " ", + "{" + ], + "types": [ + "text", + "storage.type", + "text", + "entity.name.function", + "paren.lparen", + "variable.parameter", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "hickory", + " ", + "=", + " ", + "evt", + ".", + "target", + ".", + "ownerDocument", + ".", + "getElementById", + "(", + "\"hickory\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator", + "identifier", + "punctuation.operator", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "dickory", + " ", + "=", + " ", + "evt", + ".", + "target", + ".", + "ownerDocument", + ".", + "getElementById", + "(", + "\"dickory\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator", + "identifier", + "punctuation.operator", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "dock", + " ", + "=", + " ", + "evt", + ".", + "target", + ".", + "ownerDocument", + ".", + "getElementById", + "(", + "\"dock\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator", + "identifier", + "punctuation.operator", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [], + "types": [] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "ShowAndGrowElement", + "(", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "function", + " ", + "ShowAndGrowElement", + "(", + ")", + " ", + "{" + ], + "types": [ + "text", + "storage.type", + "text", + "entity.name.function", + "paren.lparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "timevalue", + " ", + "=", + " ", + "timevalue", + " ", + "+", + " ", + "timer_increment", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "if", + " ", + "(", + "timevalue", + " ", + ">", + " ", + "max_time", + ")" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "identifier", + "paren.rparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "return", + ";" + ], + "types": [ + "text", + "keyword", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "// Scale the text string gradually until it is 20 times larger" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "scalefactor", + " ", + "=", + " ", + "(", + "timevalue", + " ", + "*", + " ", + "650", + ")", + " ", + "/", + " ", + "max_time", + ";" + ], + "types": [ + "text", + "identifier", + "text", + "keyword.operator", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen", + "text", + "keyword.operator", + "text", + "identifier", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [], + "types": [] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "if", + " ", + "(", + "timevalue", + " ", + "<", + " ", + "30", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "hickory", + ".", + "setAttribute", + "(", + "\"display\"", + ",", + " ", + "\"\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "hickory", + ".", + "setAttribute", + "(", + "\"transform\"", + ",", + " ", + "\"translate(\"", + " ", + "+", + " ", + "(", + "600", + "+", + "scalefactor", + "*", + "3", + "*", + "-1", + " ", + ")", + " ", + "+", + " ", + "\", -144 )\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "string", + "text", + "keyword.operator", + "text", + "paren.lparen", + "constant.numeric", + "keyword.operator", + "identifier", + "keyword.operator", + "constant.numeric", + "keyword.operator", + "constant.numeric", + "text", + "paren.rparen", + "text", + "keyword.operator", + "text", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "js-start", + "values": [], + "types": [] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "if", + " ", + "(", + "timevalue", + " ", + ">", + " ", + "30", + " ", + "&", + "&", + " ", + "timevalue", + " ", + "<", + " ", + "66", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "text", + "keyword.operator", + "keyword.operator", + "text", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "dickory", + ".", + "setAttribute", + "(", + "\"display\"", + ",", + " ", + "\"\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "dickory", + ".", + "setAttribute", + "(", + "\"transform\"", + ",", + " ", + "\"translate(\"", + " ", + "+", + " ", + "(", + "-795", + "+", + "scalefactor", + "*", + "2", + ")", + " ", + "+", + " ", + "\", 0 )\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "string", + "text", + "keyword.operator", + "text", + "paren.lparen", + "constant.numeric", + "keyword.operator", + "identifier", + "keyword.operator", + "constant.numeric", + "paren.rparen", + "text", + "keyword.operator", + "text", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "if", + " ", + "(", + "timevalue", + " ", + ">", + " ", + "66", + ")", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "identifier", + "text", + "keyword.operator", + "text", + "constant.numeric", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "dock", + ".", + "setAttribute", + "(", + "\"display\"", + ",", + " ", + "\"\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-regex_allowed", + "values": [ + " ", + "dock", + ".", + "setAttribute", + "(", + "\"transform\"", + ",", + " ", + "\"translate(\"", + " ", + "+", + " ", + "(", + "1450", + "+", + "scalefactor", + "*", + "2", + "*", + "-1", + ")", + " ", + "+", + " ", + "\", 144 )\"", + ")", + ";" + ], + "types": [ + "text", + "identifier", + "punctuation.operator", + "support.function.dom", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "string", + "text", + "keyword.operator", + "text", + "paren.lparen", + "constant.numeric", + "keyword.operator", + "identifier", + "keyword.operator", + "constant.numeric", + "keyword.operator", + "constant.numeric", + "paren.rparen", + "text", + "keyword.operator", + "text", + "string", + "paren.rparen", + "punctuation.operator" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "js-start", + "values": [], + "types": [] + }, + { + "state": "js-start", + "values": [ + " ", + "// Call ShowAndGrowElement again milliseconds later." + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "setTimeout", + "(", + "\"ShowAndGrowElement()\"", + ",", + " ", + "timer_increment", + ")" + ], + "types": [ + "text", + "identifier", + "paren.lparen", + "string", + "punctuation.operator", + "text", + "identifier", + "paren.rparen" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "}" + ], + "types": [ + "text", + "paren.rparen" + ] + }, + { + "state": "js-start", + "values": [ + " ", + "window", + ".", + "ShowAndGrowElement", + " ", + "=", + " ", + "ShowAndGrowElement" + ], + "types": [ + "text", + "variable.language", + "punctuation.operator", + "identifier", + "text", + "keyword.operator", + "text", + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "]", + "]", + "" + ], + "types": [ + "text", + "paren.rparen", + "paren.rparen", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "rect" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "fill", + "=", + "\"#2e3436\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "fill-rule", + "=", + "\"nonzero\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "stroke-width", + "=", + "\"3\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "y", + "=", + "\"0\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "x", + "=", + "\"0\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "height", + "=", + "\"600\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "width", + "=", + "\"800\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "id", + "=", + "\"rect3590\"", + "/>" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "text" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "style", + "=", + "\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "x", + "=", + "\"50\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "y", + "=", + "\"350\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "id", + "=", + "\"hickory\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "display", + "=", + "\"none\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " Hickory,", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "text" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "style", + "=", + "\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "x", + "=", + "\"50\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "y", + "=", + "\"350\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "id", + "=", + "\"dickory\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "display", + "=", + "\"none\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " dickory,", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "text" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "style", + "=", + "\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "x", + "=", + "\"50\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "y", + "=", + "\"350\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "id", + "=", + "\"dock\"" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "display", + "=", + "\"none\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " dock!", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_tcl.json b/lib/ace/mode/_test/tokens_tcl.json new file mode 100644 index 00000000..2b6abcf9 --- /dev/null +++ b/lib/ace/mode/_test/tokens_tcl.json @@ -0,0 +1,950 @@ +[ + { + "state": "commandItem", + "values": [], + "types": [] + }, + { + "state": "commandItem", + "values": [ + "proc", + " ", + "dijkstra", + " ", + "{", + "graph", + " ", + "origin", + "}", + " ", + "{" + ], + "types": [ + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "# Initialize" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "commandItem", + "values": [ + " ", + "dict", + " ", + "for", + " ", + "{", + "vertex", + " ", + "distmap", + "}", + " ", + "$", + "graph", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "paren.rparen", + "text", + "variable.instancce", + "variable.instancce", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "dict", + " ", + "set", + " ", + "dist", + " ", + "$", + "vertex", + " ", + "Inf" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "identifier" + ] + }, + { + "state": "commandItem", + "values": [ + "\t", + "dict", + " ", + "set", + " ", + "path", + " ", + "$", + "vertex", + " ", + "{", + "}" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "paren.lparen", + "text" + ] + }, + { + "state": "commandItem", + "values": [ + " }" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "dict", + " ", + "set", + " ", + "dist", + " ", + "$", + "origin", + " 0" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "dict", + " ", + "set", + " ", + "path", + " ", + "$", + "origin", + " ", + "[", + "list", + " ", + "$", + "origin", + "]" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "paren.lparen", + "keyword", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen" + ] + }, + { + "state": "commandItem", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "commandItem", + "values": [ + " ", + "while", + " ", + "{", + "[", + "dict", + " ", + "size", + " ", + "$", + "graph", + "]", + "}", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "text", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t", + "# Find unhandled node with least weight" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "\t", + "set", + " ", + "d", + " ", + "Inf" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier" + ] + }, + { + "state": "commandItem", + "values": [ + "\t", + "dict", + " ", + "for", + " ", + "{", + "uu", + " ", + "-", + "}", + " ", + "$", + "graph", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "support.function", + "paren.rparen", + "text", + "variable.instancce", + "variable.instancce", + "text", + "paren.lparen" + ] + }, + { + "state": "commandItem", + "values": [ + "\t ", + "if", + " ", + "{", + "$", + "d", + " ", + ">", + " ", + "[", + "set", + " ", + "dd", + " ", + "[", + "dict", + " ", + "get", + " ", + "$", + "dist", + " ", + "$", + "uu", + "]", + "]", + "}", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "variable.instancce", + "variable.instancce", + "text", + "support.function", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen", + "paren.rparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "set", + " ", + "u", + " ", + "$", + "uu" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "set", + " ", + "d", + " ", + "$", + "dd" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce" + ] + }, + { + "state": "commandItem", + "values": [ + "\t }" + ], + "types": [ + "text" + ] + }, + { + "state": "commandItem", + "values": [ + "\t}" + ], + "types": [ + "text" + ] + }, + { + "state": "commandItem", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "\t", + "# No such node; graph must be disconnected" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "\t", + "if", + " ", + "{", + "$", + "d", + " ", + "==", + " ", + "Inf", + "}", + " ", + "break" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "variable.instancce", + "variable.instancce", + "text", + "support.function", + "text", + "identifier", + "paren.rparen", + "text", + "identifier" + ] + }, + { + "state": "commandItem", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "commentfollow", + "values": [ + "\t", + "# Update the weights for nodes\\" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "\t lead to by the node we've picked" + ], + "types": [ + "comment" + ] + }, + { + "state": "commandItem", + "values": [ + "\t", + "dict", + " ", + "for", + " ", + "{", + "v", + " ", + "dd", + "}", + " ", + "[", + "dict", + " ", + "get", + " ", + "$", + "graph", + " ", + "$", + "u", + "]", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "paren.rparen", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "commandItem", + "values": [ + "\t ", + "if", + " ", + "{", + "[", + "dict", + " ", + "exists", + " ", + "$", + "graph", + " ", + "$", + "v", + "]", + "}", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "text", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t\t", + "set", + " ", + "alt", + " ", + "[", + "expr", + " ", + "{", + "$", + "d", + " ", + "+", + " ", + "$", + "dd", + "}", + "]" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "paren.lparen", + "keyword", + "text", + "paren.lparen", + "variable.instancce", + "variable.instancce", + "text", + "support.function", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen", + "paren.rparen" + ] + }, + { + "state": "commandItem", + "values": [ + "\t\t", + "if", + " ", + "{", + "$", + "alt", + " ", + "<", + " ", + "[", + "dict", + " ", + "get", + " ", + "$", + "dist", + " ", + "$", + "v", + "]", + "}", + " ", + "{" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "variable.instancce", + "variable.instancce", + "text", + "support.function", + "text", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen", + "paren.rparen", + "text", + "paren.lparen" + ] + }, + { + "state": "start", + "values": [ + "\t\t ", + "dict", + " ", + "set", + " ", + "dist", + " ", + "$", + "v", + " ", + "$", + "alt" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "variable.instancce", + "variable.instancce" + ] + }, + { + "state": "start", + "values": [ + "\t\t ", + "dict", + " ", + "set", + " ", + "path", + " ", + "$", + "v", + " ", + "[", + "list", + " ", + "{*}", + "[", + "dict", + " ", + "get", + " ", + "$", + "path", + " ", + "$", + "u", + "]", + " ", + "$", + "v", + "]" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "paren.lparen", + "keyword", + "text", + "support.function", + "paren.lparen", + "keyword", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen" + ] + }, + { + "state": "commandItem", + "values": [ + "\t\t}" + ], + "types": [ + "text" + ] + }, + { + "state": "commandItem", + "values": [ + "\t }" + ], + "types": [ + "text" + ] + }, + { + "state": "commandItem", + "values": [ + "\t}" + ], + "types": [ + "text" + ] + }, + { + "state": "commandItem", + "values": [ + " " + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "\t", + "# Remove chosen node from graph still to be handled" + ], + "types": [ + "text", + "comment" + ] + }, + { + "state": "start", + "values": [ + "\t", + "dict", + " ", + "unset", + " ", + "graph", + " ", + "$", + "u" + ], + "types": [ + "text", + "keyword", + "text", + "identifier", + "text", + "identifier", + "text", + "variable.instancce", + "variable.instancce" + ] + }, + { + "state": "commandItem", + "values": [ + " }" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "return", + " ", + "[", + "list", + " ", + "$", + "dist", + " ", + "$", + "path", + "]" + ], + "types": [ + "text", + "keyword", + "text", + "paren.lparen", + "keyword", + "text", + "variable.instancce", + "variable.instancce", + "text", + "variable.instancce", + "variable.instancce", + "paren.rparen" + ] + }, + { + "state": "commandItem", + "values": [ + "}" + ], + "types": [ + "text" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_text.json b/lib/ace/mode/_test/tokens_text.json new file mode 100644 index 00000000..04841ed6 --- /dev/null +++ b/lib/ace/mode/_test/tokens_text.json @@ -0,0 +1,81 @@ +[ + { + "state": "start", + "values": [ + "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis." + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur" + ], + "types": [ + "text" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_textile.json b/lib/ace/mode/_test/tokens_textile.json new file mode 100644 index 00000000..c610133a --- /dev/null +++ b/lib/ace/mode/_test/tokens_textile.json @@ -0,0 +1,301 @@ +[ + { + "state": "start", + "values": [ + "h1", + ". ", + "Textile document" + ], + "types": [ + "markup.heading.1", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "h2", + ". ", + "Heading Two" + ], + "types": [ + "markup.heading.2", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "h3", + ". ", + "A two-line" + ], + "types": [ + "markup.heading.3", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + " header" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "h2", + ". ", + "Another two-line" + ], + "types": [ + "markup.heading.2", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + "header" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "Paragraph:" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "one, two," + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + "thee lines!" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "p", + "(", + "classone", + " ", + "two", + " ", + "three", + ")", + ". ", + "This is a paragraph with classes" + ], + "types": [ + "markup.heading", + "keyword", + "string", + "text", + "string", + "text", + "string", + "keyword", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "p", + "(", + "#", + "id", + ")", + ". ", + "(one with an id)" + ], + "types": [ + "markup.heading", + "keyword", + "keyword", + "string", + "keyword", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "p", + "(", + "one", + " ", + "two", + " ", + "three", + "#", + "my_id", + ")", + ". ", + "..classes + id" + ], + "types": [ + "markup.heading", + "keyword", + "string", + "text", + "string", + "text", + "string", + "keyword", + "string", + "keyword", + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "*", + " Unordered list" + ], + "types": [ + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + "**", + " sublist" + ], + "types": [ + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + "*", + " back again!" + ], + "types": [ + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [ + "**", + " sublist again.." + ], + "types": [ + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "#", + " ordered" + ], + "types": [ + "keyword", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "bg. Blockquote!" + ], + "types": [ + "text" + ] + }, + { + "state": "start", + "values": [ + " This is a two-list blockquote..!" + ], + "types": [ + "text" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_xml.json b/lib/ace/mode/_test/tokens_xml.json new file mode 100644 index 00000000..e5047146 --- /dev/null +++ b/lib/ace/mode/_test/tokens_xml.json @@ -0,0 +1,1243 @@ +[ + { + "state": "start", + "values": [ + "" + ], + "types": [ + "xml_pe" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + "<", + "query", + " ", + "xmlns:yahoo", + "=", + "\"http://www.yahooapis.com/v1/base.rng\"" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "yahoo:count", + "=", + "\"7\"", + " ", + "yahoo:created", + "=", + "\"2011-10-11T08:40:23Z\"", + " ", + "yahoo:lang", + "=", + "\"en-US\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "diagnostics", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "publiclyCallable", + ">", + "true", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "url", + " ", + "execution-start-time", + "=", + "\"0\"", + " ", + "execution-stop-time", + "=", + "\"25\"", + " ", + "execution-time", + "=", + "\"25\"", + ">", + "", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "user-time", + ">", + "26", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "service-time", + ">", + "25", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "build-version", + ">", + "21978", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "", + " " + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "results", + ">" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "place", + " ", + "xmlns", + "=", + "\"http://where.yahooapis.com/v1/schema.rng\"" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "xml:lang", + "=", + "\"en-US\"", + " ", + "yahoo:uri", + "=", + "\"http://where.yahooapis.com/v1/place/24865670\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "woeid", + ">", + "24865670", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "placeTypeName", + " ", + "code", + "=", + "\"29\"", + ">", + "Continent", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "name", + ">", + "Africa", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "place", + " ", + "xmlns", + "=", + "\"http://where.yahooapis.com/v1/schema.rng\"" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "xml:lang", + "=", + "\"en-US\"", + " ", + "yahoo:uri", + "=", + "\"http://where.yahooapis.com/v1/place/24865675\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "woeid", + ">", + "24865675", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "placeTypeName", + " ", + "code", + "=", + "\"29\"", + ">", + "Continent", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "name", + ">", + "Europe", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "place", + " ", + "xmlns", + "=", + "\"http://where.yahooapis.com/v1/schema.rng\"" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "xml:lang", + "=", + "\"en-US\"", + " ", + "yahoo:uri", + "=", + "\"http://where.yahooapis.com/v1/place/24865673\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "woeid", + ">", + "24865673", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "placeTypeName", + " ", + "code", + "=", + "\"29\"", + ">", + "Continent", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "name", + ">", + "South America", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "place", + " ", + "xmlns", + "=", + "\"http://where.yahooapis.com/v1/schema.rng\"" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "xml:lang", + "=", + "\"en-US\"", + " ", + "yahoo:uri", + "=", + "\"http://where.yahooapis.com/v1/place/28289421\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "woeid", + ">", + "28289421", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "placeTypeName", + " ", + "code", + "=", + "\"29\"", + ">", + "Continent", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "name", + ">", + "Antarctic", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "place", + " ", + "xmlns", + "=", + "\"http://where.yahooapis.com/v1/schema.rng\"" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "xml:lang", + "=", + "\"en-US\"", + " ", + "yahoo:uri", + "=", + "\"http://where.yahooapis.com/v1/place/24865671\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "woeid", + ">", + "24865671", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "placeTypeName", + " ", + "code", + "=", + "\"29\"", + ">", + "Continent", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "name", + ">", + "Asia", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "place", + " ", + "xmlns", + "=", + "\"http://where.yahooapis.com/v1/schema.rng\"" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "xml:lang", + "=", + "\"en-US\"", + " ", + "yahoo:uri", + "=", + "\"http://where.yahooapis.com/v1/place/24865672\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "woeid", + ">", + "24865672", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "placeTypeName", + " ", + "code", + "=", + "\"29\"", + ">", + "Continent", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "name", + ">", + "North America", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "tag_embed_attribute_list", + "values": [ + " ", + "<", + "place", + " ", + "xmlns", + "=", + "\"http://where.yahooapis.com/v1/schema.rng\"" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "xml:lang", + "=", + "\"en-US\"", + " ", + "yahoo:uri", + "=", + "\"http://where.yahooapis.com/v1/place/55949070\"", + ">" + ], + "types": [ + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "woeid", + ">", + "55949070", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "placeTypeName", + " ", + "code", + "=", + "\"29\"", + ">", + "Continent", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "text", + "entity.other.attribute-name", + "keyword.operator", + "string", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "<", + "name", + ">", + "Australia", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag", + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + " ", + "" + ], + "types": [ + "text", + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "meta.tag", + "meta.tag.tag-name", + "meta.tag" + ] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_xquery.json b/lib/ace/mode/_test/tokens_xquery.json new file mode 100644 index 00000000..2c1a8499 --- /dev/null +++ b/lib/ace/mode/_test/tokens_xquery.json @@ -0,0 +1,105 @@ +[ + { + "state": "start", + "values": [ + "xquery", + " ", + "version", + " ", + "\"1.0\"", + ";" + ], + "types": [ + "keyword", + "text", + "keyword", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "let", + " ", + "$message", + " :", + "=", + " ", + "\"Hello World!\"" + ], + "types": [ + "keyword", + "text", + "variable", + "text", + "keyword.operator", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + "return", + " <", + "results", + ">" + ], + "types": [ + "keyword", + "text", + "meta.tag", + "text" + ] + }, + { + "state": "start", + "values": [ + " <", + "message", + ">", + "{", + "$message", + "}", + "" + ], + "types": [ + "text", + "meta.tag", + "text", + "lparen", + "variable", + "rparen", + "text", + "meta.tag", + "text" + ] + }, + { + "state": "start", + "values": [ + "" + ], + "types": [ + "text", + "meta.tag", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/_test/tokens_yaml.json b/lib/ace/mode/_test/tokens_yaml.json new file mode 100644 index 00000000..4b5c63b5 --- /dev/null +++ b/lib/ace/mode/_test/tokens_yaml.json @@ -0,0 +1,410 @@ +[ + { + "state": "start", + "values": [ + "# This sample document was taken from wikipedia:" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "# http://en.wikipedia.org/wiki/YAML#Sample_document" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "---" + ], + "types": [ + "comment" + ] + }, + { + "state": "start", + "values": [ + "receipt:", + " Oz-Ware Purchase Invoice" + ], + "types": [ + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + "date:", + " ", + "2007", + "-08", + "-06" + ], + "types": [ + "identifier", + "text", + "constant.numeric", + "constant.numeric", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + "customer:" + ], + "types": [ + "identifier" + ] + }, + { + "state": "start", + "values": [ + " ", + "given:", + " Dorothy" + ], + "types": [ + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "family:", + " Gale" + ], + "types": [ + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "items:" + ], + "types": [ + "identifier" + ] + }, + { + "state": "start", + "values": [ + " - ", + "part_no:", + " ", + "'A4786'" + ], + "types": [ + "text", + "identifier", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "descrip:", + " Water Bucket ", + "(", + "Filled", + ")" + ], + "types": [ + "text", + "identifier", + "text", + "paren.lparen", + "text", + "paren.rparen" + ] + }, + { + "state": "start", + "values": [ + " ", + "price:", + " ", + "1.47" + ], + "types": [ + "text", + "identifier", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "quantity:", + " ", + "4" + ], + "types": [ + "text", + "identifier", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + " - ", + "part_no:", + " ", + "'E1628'" + ], + "types": [ + "text", + "identifier", + "text", + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "descrip:", + " High Heeled ", + "\"Ruby\"", + " Slippers" + ], + "types": [ + "text", + "identifier", + "text", + "string", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "size:", + " ", + "8" + ], + "types": [ + "text", + "identifier", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "price:", + " ", + "100.27" + ], + "types": [ + "text", + "identifier", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [ + " ", + "quantity:", + " ", + "1" + ], + "types": [ + "text", + "identifier", + "text", + "constant.numeric" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "bill-", + "to:", + " ", + "&id001" + ], + "types": [ + "text", + "identifier", + "text", + "variable" + ] + }, + { + "state": "qqstring", + "values": [ + " ", + "street:", + " ", + "|" + ], + "types": [ + "text", + "identifier", + "text", + "string" + ] + }, + { + "state": "qqstring", + "values": [ + " 123 Tornado Alley" + ], + "types": [ + "string" + ] + }, + { + "state": "qqstring", + "values": [ + " Suite 16" + ], + "types": [ + "string" + ] + }, + { + "state": "start", + "values": [ + " ", + "city:", + " East Centerville" + ], + "types": [ + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [ + " ", + "state:", + " KS" + ], + "types": [ + "text", + "identifier", + "text" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "start", + "values": [ + "ship-", + "to:", + " ", + "*id001" + ], + "types": [ + "text", + "identifier", + "text", + "variable" + ] + }, + { + "state": "start", + "values": [], + "types": [] + }, + { + "state": "qqstring", + "values": [ + "specialDelivery:", + " ", + ">" + ], + "types": [ + "identifier", + "text", + "string" + ] + }, + { + "state": "qqstring", + "values": [ + " Follow the Yellow Brick" + ], + "types": [ + "string" + ] + }, + { + "state": "qqstring", + "values": [ + " Road to the Emerald City." + ], + "types": [ + "string" + ] + }, + { + "state": "qqstring", + "values": [ + " Pay no attention to the" + ], + "types": [ + "string" + ] + }, + { + "state": "qqstring", + "values": [ + " man behind the curtain." + ], + "types": [ + "string" + ] + }, + { + "state": "qqstring", + "values": [], + "types": [] + } +] \ No newline at end of file diff --git a/lib/ace/mode/pgsql.js b/lib/ace/mode/pgsql.js index 0ac91688..1794fbcf 100755 --- a/lib/ace/mode/pgsql.js +++ b/lib/ace/mode/pgsql.js @@ -20,12 +20,11 @@ define(function(require, exports, module) { - var oop = require("ace/lib/oop"); - var TextMode = require("ace/mode/text").Mode; - var Tokenizer = require("ace/tokenizer").Tokenizer; - var PgsqlHighlightRules = require("ace/mode/pgsql_highlight_rules").PgsqlHighlightRules; - var Range = require("ace/range").Range; - // var EditSession = require("ace/edit_session").EditSession; + var oop = require("../lib/oop"); + var TextMode = require("../mode/text").Mode; + var Tokenizer = require("../tokenizer").Tokenizer; + var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules; + var Range = require("../range").Range; var Mode = function() { this.$tokenizer = new Tokenizer(new PgsqlHighlightRules().getRules()); diff --git a/lib/ace/mode/pgsql_highlight_rules.js b/lib/ace/mode/pgsql_highlight_rules.js index ca381b14..688e9ac7 100755 --- a/lib/ace/mode/pgsql_highlight_rules.js +++ b/lib/ace/mode/pgsql_highlight_rules.js @@ -23,8 +23,8 @@ define(function(require, exports, module) { -var oop = require("ace/lib/oop"); -var lang = require("ace/lib/lang"); +var oop = require("../lib/oop"); +var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; // Supporting perl and python for now -- both in pg core and ace From 7f876fbdaa8d70ea0fb6293b699ae0976d4758e8 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 31 Aug 2012 00:09:16 +0400 Subject: [PATCH 2/8] restore e92ed07a1992a69fa5c2046373a173b89c451210 --- lib/ace/mode/javascript_highlight_rules.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/ace/mode/javascript_highlight_rules.js b/lib/ace/mode/javascript_highlight_rules.js index ad3efba8..c45186c5 100644 --- a/lib/ace/mode/javascript_highlight_rules.js +++ b/lib/ace/mode/javascript_highlight_rules.js @@ -93,11 +93,7 @@ var JavaScriptHighlightRules = function() { ); // TODO: Unicode escape sequences - var identifierRe = "[" + unicode.packages.L + "\\$_][" - + unicode.packages.L - + unicode.packages.Mn + unicode.packages.Mc - + unicode.packages.Nd - + unicode.packages.Pc + "\\$_]*\\b"; + var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex "u[0-9a-fA-F]{4}|" + // unicode From 8d054b9afed04e43904a727efd5fe61cb04eaf54 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 31 Aug 2012 16:48:44 +0400 Subject: [PATCH 3/8] better way of handling keywords --- lib/ace/mode/_test/test_highlight_rules.js | 68 ++++++-- lib/ace/mode/javascript_highlight_rules.js | 190 ++++++--------------- lib/ace/mode/text_highlight_rules.js | 21 ++- lib/ace/mode/textile_highlight_rules.js | 2 +- 4 files changed, 125 insertions(+), 156 deletions(-) diff --git a/lib/ace/mode/_test/test_highlight_rules.js b/lib/ace/mode/_test/test_highlight_rules.js index 544438e6..2057e9df 100644 --- a/lib/ace/mode/_test/test_highlight_rules.js +++ b/lib/ace/mode/_test/test_highlight_rules.js @@ -8,7 +8,7 @@ require("amd-loader"); function generateTestData() { var root = Array(5).join("../") + "/demo/kitchen-sink/docs" var docs = fs.readdirSync(root) - var specialDocs = fs.readdirSync(".") + var specialDocs = fs.readdirSync(".") var modes = fs.readdirSync("../").filter(function(x){ return /(\w+)_highlight_rules.js$/.test(x) }).map(function(x) { @@ -31,12 +31,12 @@ function generateTestData() { if (!modeName) { return console.error(p) } - - var filePath = "text_" + modeName + ".txt" - if (specialDocs.indexOf(filePath) == -1) { - filePath = root + "/" + docName - } - + + var filePath = "text_" + modeName + ".txt" + if (specialDocs.indexOf(filePath) == -1) { + filePath = root + "/" + docName + } + var text = fs.readFileSync(filePath, "utf8") var Mode = require("../" + modeName).Mode; var tokenizer = new Mode().getTokenizer(); @@ -57,14 +57,16 @@ function generateTestData() { }) } -function test() { +function test(startAt) { var docs = fs.readdirSync(".").filter(function(x){ return /^tokens_\w+.json/.test(x) }); + if (startAt && startAt > 1) + docs = docs.slice(startAt - 1) docs.forEach(function(x, i){ var modeName = x.match(/tokens_(.*).json/)[1] - console.log((" " + (i+1)).slice(-3) + ") testing: \u001b[33m" + modeName + "\u001b[0m") + console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m") var text = fs.readFileSync("./" + x, "utf8") var data = JSON.parse(text) @@ -79,9 +81,12 @@ function test() { var values = tokens.tokens.map(function(x) {return x.value}) var types = tokens.tokens.map(function(x) {return x.type}) - testEqual(lineData.state, tokens.state) - testEqual(lineData.types, types) - testEqual(lineData.values, values) + var success = true + var report = + testEqual([ + lineData.state, tokens.state, + lineData.types, types, + lineData.values, values]) state = lineData.state }) @@ -89,14 +94,45 @@ function test() { console.log("\u001b[32m" + "all ok" + "\u001b[0m") - function testEqual(a, b) { - if (a + "" !== b + "") - throw a + "!=" + b + function testEqual(a) { + var err + if (a[0] !== a[1]) { + console.log(a[0],a[1]) + err = 1 + } + + if ( a[2] + "" !== a[3] + "" + || a[4] + "" !== a[5] + "" + ) { + arrayDiff(a[2],a[3]) + arrayDiff(a[4],a[5]) + err = 1 + } + if (err) { + throw "error" + } + } + + function arrayDiff(a1, a2) { + var l = Math.max(a1.length, a2.length); + var out = [] + for (var i = 0; i < l; i++) { + out.push("\n", padNumber(i+1, 3), ") ") + if (a1[i] !== a2[i]) { + out.push("\u001b[31m", a1[i], " != ", a2[i], "\u001b[0m") + } else { + out.push(a1[i]) + } + } + console.log(out.join("")) + } + function padNumber(num, digits) { + return (" " + num).slice(-digits) } } if (process.argv[2] == "gen") { generateTestData(process.argv.splice(3)) } else { - test() + test(parseInt(process.argv[2],10) || 0) } diff --git a/lib/ace/mode/javascript_highlight_rules.js b/lib/ace/mode/javascript_highlight_rules.js index c45186c5..93994a44 100644 --- a/lib/ace/mode/javascript_highlight_rules.js +++ b/lib/ace/mode/javascript_highlight_rules.js @@ -40,58 +40,43 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var unicode = require("../unicode"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JavaScriptHighlightRules = function() { - // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects - var globals = lang.arrayToMap( - // Constructors - ("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + - // E4X - "Namespace|QName|XML|XMLList|" + - "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + - "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + - // Errors - "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + - "SyntaxError|TypeError|URIError|" + - // Non-constructor functions - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + - "isNaN|parseFloat|parseInt|" + - // Other - "JSON|Math|" + - // Pseudo - "this|arguments|prototype|window|document" - ).split("|") - ); + var keywordMapper = this.createKeywordMapper({ + "variable.language": + "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors + "Namespace|QName|XML|XMLList|" + // E4X + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors + "SyntaxError|TypeError|URIError|" + + "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions + "isNaN|parseFloat|parseInt|" + + "JSON|Math|" + // Other + "this|arguments|prototype|window|document" , // Pseudo + "invalid.deprecated": + "__parent__|__count__|escape|unescape|with|__proto__|debugger", + "keyword": + "const|yield|import|get|set" + + "break|case|catch|continue|default|delete|do|else|finally|for|function|" + + "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|", + "storage.type": + "const|let|var|function", + "invalid.illegal": + "class|enum|extends|super|export|implements|private|" + + "public|interface|package|protected|static", + "constant.language": + "null|Infinity|NaN|undefined", + }, "identifier"); - var keywords = lang.arrayToMap( - ("break|case|catch|continue|default|delete|do|else|finally|for|function|" + - "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" + - "const|yield|import|get|set").split("|") - ); // keywords which can be followed by regular expressions var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield"; - var deprecated = lang.arrayToMap( - ("__parent__|__count__|escape|unescape|with|__proto__").split("|") - ); - - var definitions = lang.arrayToMap(("const|let|var|function").split("|")); - - var buildinConstants = lang.arrayToMap( - ("null|Infinity|NaN|undefined").split("|") - ); - - var futureReserved = lang.arrayToMap( - ("class|enum|extends|super|export|implements|private|" + - "public|interface|package|protected|static").split("|") - ); - // TODO: Unicode escape sequences var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b"; @@ -132,106 +117,58 @@ var JavaScriptHighlightRules = function() { }, { token : "constant.numeric", // float regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ - }, { // match stuff like: Sound.prototype.play = function() { } + }, { + // Sound.prototype.play = token : [ - "storage.type", - "punctuation.operator", - "support.function", - "punctuation.operator", - "entity.name.function", - "text", - "keyword.operator", - "text", - "storage.type", - "text", - "paren.lparen" + "storage.type", "punctuation.operator", "support.function", + "punctuation.operator", "entity.name.function", "text","keyword.operator" ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", + regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", next: "function_arguments" - }, { // match stuff like: Sound.prototype.play = myfunc + }, { + // Sound.play = function() { } token : [ - "storage.type", - "punctuation.operator", - "support.function", - "punctuation.operator", - "entity.name.function", - "text", - "keyword.operator", - "text" - ], - regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)", - next: "function_arguments" - }, { // match stuff like: Sound.play = function() { } - token : [ - "storage.type", - "punctuation.operator", - "entity.name.function", - "text", - "keyword.operator", - "text", - "storage.type", - "text", - "paren.lparen" + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", "storage.type", "text", "paren.lparen" ], regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", next: "function_arguments" - }, { // match stuff like: play = function() { } + }, { + // play = function() { } token : [ - "entity.name.function", - "text", - "keyword.operator", - "text", - "storage.type", - "text", - "paren.lparen" + "entity.name.function", "text", "keyword.operator", "text", "storage.type", + "text", "paren.lparen" ], regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", next: "function_arguments" - }, { // match stuff like: Sound.play = function play() { } + }, { + // Sound.play = function play() { } token : [ - "storage.type", - "punctuation.operator", - "entity.name.function", - "text", - "keyword.operator", - "text", - "storage.type", - "text", - "entity.name.function", - "text", - "paren.lparen" + "storage.type", "punctuation.operator", "entity.name.function", "text", + "keyword.operator", "text", + "storage.type", "text", "entity.name.function", "text", "paren.lparen" ], regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", next: "function_arguments" - }, { // match regular function like: function myFunc(arg) { } + }, { + // function myFunc(arg) { } token : [ - "storage.type", - "text", - "entity.name.function", - "text", - "paren.lparen" + "storage.type", "text", "entity.name.function", "text", "paren.lparen" ], regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", next: "function_arguments" - }, { // match stuff like: foobar: function() { } + }, { + // foobar: function() { } token : [ - "entity.name.function", - "text", - "punctuation.operator", - "text", - "storage.type", - "text", - "paren.lparen" + "entity.name.function", "text", "punctuation.operator", + "text", "storage.type", "text", "paren.lparen" ], regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", next: "function_arguments" - }, { // Attempt to match : function() { } (this is for issues with 'foo': function() { }) + }, { + // : function() { } (this is for issues with 'foo': function() { }) token : [ - "text", - "text", - "storage.type", - "text", - "paren.lparen" + "text", "text", "storage.type", "text", "paren.lparen" ], regex : "(:)(\\s*)(function)(\\s*)(\\()", next: "function_arguments" @@ -255,24 +192,7 @@ var JavaScriptHighlightRules = function() { token : ["storage.type", "punctuation.operator", "support.function.firebug"], regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/ }, { - token : function(value) { - if (globals.hasOwnProperty(value)) - return "variable.language"; - else if (deprecated.hasOwnProperty(value)) - return "invalid.deprecated"; - else if (definitions.hasOwnProperty(value)) - return "storage.type"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (futureReserved.hasOwnProperty(value)) - return "invalid.illegal"; - else if (value == "debugger") - return "invalid.deprecated"; - else - return "identifier"; - }, + token : keywordMapper, regex : identifierRe }, { token : "keyword.operator", diff --git a/lib/ace/mode/text_highlight_rules.js b/lib/ace/mode/text_highlight_rules.js index 4af6cb20..fb656fc8 100644 --- a/lib/ace/mode/text_highlight_rules.js +++ b/lib/ace/mode/text_highlight_rules.js @@ -74,7 +74,7 @@ var TextHighlightRules = function() { this.getRules = function() { return this.$rules; }; - + this.embedRules = function (HighlightRules, prefix, escapeRules, states) { var embedRules = new HighlightRules().getRules(); if (states) { @@ -88,21 +88,34 @@ var TextHighlightRules = function() { } } this.addRules(embedRules, prefix); - + for (var i = 0; i < states.length; i++) { Array.prototype.unshift.apply(this.$rules[states[i]], lang.deepCopy(escapeRules)); } - + if (!this.$embeds) { this.$embeds = []; } this.$embeds.push(prefix); } - + this.getEmbeds = function() { return this.$embeds; } + this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) { + var keywords = Object.create(null); + Object.keys(map).forEach(function(className) { + var list = map[className].split(splitChar || "|"); + for (var i = list.length; i--; ) + keywords[list[i]] = className; + }); + map = null; + return ignoreCase + ? function(value) {return keywords[value.toLowerCase()] || defaultToken } + : function(value) {return keywords[value] || defaultToken }; + } + }).call(TextHighlightRules.prototype); exports.TextHighlightRules = TextHighlightRules; diff --git a/lib/ace/mode/textile_highlight_rules.js b/lib/ace/mode/textile_highlight_rules.js index 87aa86fe..f44650cf 100644 --- a/lib/ace/mode/textile_highlight_rules.js +++ b/lib/ace/mode/textile_highlight_rules.js @@ -46,7 +46,7 @@ var TextileHighlightRules = function() { "start" : [ { token : function(value) { - if (value.match(/^h\d$/)) + if (value.charAt(0) == "h") return "markup.heading." + value.charAt(1); else return "markup.heading"; From 43f966bd5fec5f2493b04b58801321644e3860d8 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 31 Aug 2012 19:21:47 +0400 Subject: [PATCH 4/8] convert rest of the modes to new style --- lib/ace/mode/_test/tokens_liquid.json | 2 +- lib/ace/mode/c_cpp_highlight_rules.js | 30 ++- lib/ace/mode/clojure_highlight_rules.js | 164 +++++++------- lib/ace/mode/coffee_highlight_rules.js | 69 +++--- lib/ace/mode/csharp_highlight_rules.js | 28 +-- lib/ace/mode/css_highlight_rules.js | 59 +---- lib/ace/mode/glsl_highlight_rules.js | 32 ++- lib/ace/mode/golang_highlight_rules.js | 37 ++-- lib/ace/mode/groovy_highlight_rules.js | 64 +++--- lib/ace/mode/haxe_highlight_rules.js | 26 +-- lib/ace/mode/java_highlight_rules.js | 48 ++-- lib/ace/mode/liquid_highlight_rules.js | 244 ++++++++++----------- lib/ace/mode/lua_highlight_rules.js | 115 +++++----- lib/ace/mode/ocaml_highlight_rules.js | 31 ++- lib/ace/mode/perl_highlight_rules.js | 34 ++- lib/ace/mode/pgsql_highlight_rules.js | 57 +++-- lib/ace/mode/powershell_highlight_rules.js | 32 ++- lib/ace/mode/python_highlight_rules.js | 43 ++-- lib/ace/mode/ruby_highlight_rules.js | 54 ++--- lib/ace/mode/scad_highlight_rules.js | 26 +-- lib/ace/mode/scala_highlight_rules.js | 48 ++-- lib/ace/mode/sh_highlight_rules.js | 28 +-- lib/ace/mode/sql_highlight_rules.js | 33 ++- lib/ace/mode/tcl_highlight_rules.js | 14 +- lib/ace/mode/xquery_highlight_rules.js | 16 +- 25 files changed, 562 insertions(+), 772 deletions(-) diff --git a/lib/ace/mode/_test/tokens_liquid.json b/lib/ace/mode/_test/tokens_liquid.json index 36a09bc2..779eeb8f 100644 --- a/lib/ace/mode/_test/tokens_liquid.json +++ b/lib/ace/mode/_test/tokens_liquid.json @@ -1060,7 +1060,7 @@ "text", "keyword", "text", - "identifier", + "variable.language", "text", "identifier", "text", diff --git a/lib/ace/mode/c_cpp_highlight_rules.js b/lib/ace/mode/c_cpp_highlight_rules.js index 236b7284..5f021dbb 100644 --- a/lib/ace/mode/c_cpp_highlight_rules.js +++ b/lib/ace/mode/c_cpp_highlight_rules.js @@ -42,27 +42,32 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var c_cppHighlightRules = function() { - var keywords = lang.arrayToMap( - ("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|" + + var keywords = ( + "and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|" + "asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|" + "typeid|bitor|extern|protected|typename|bool|false|public|union|" + "break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|" + "friend|return|virtual|char|goto|short|void|class|if|signed|volatile|" + "compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|" + "static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|" + - "switch|delete|new|template|do|not|this|for").split("|") + "switch|delete|new|template|do|not|this|for" ); - var buildinConstants = lang.arrayToMap( - ("NULL").split("|") + var buildinConstants = ( + "NULL" ); + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": buildinConstants + }, "identifier"); + // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -107,16 +112,7 @@ var c_cppHighlightRules = function() { token : "keyword", // pre-compiler directivs regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)" }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", @@ -169,7 +165,7 @@ var c_cppHighlightRules = function() { } ] }; - + this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; diff --git a/lib/ace/mode/clojure_highlight_rules.js b/lib/ace/mode/clojure_highlight_rules.js index 3ac380c3..8865c3af 100644 --- a/lib/ace/mode/clojure_highlight_rules.js +++ b/lib/ace/mode/clojure_highlight_rules.js @@ -41,93 +41,94 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ClojureHighlightRules = function() { - var builtinFunctions = lang.arrayToMap( - ('* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' + - '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' + - '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' + - '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' + - '*read-eval* *source-path* *use-context-classloader* ' + - '*warn-on-reflection* + - -> -> ->> ->> .. / < < <= <= = ' + - '== > > >= >= accessor aclone ' + - 'add-classpath add-watch agent agent-errors aget alength alias all-ns ' + - 'alter alter-meta! alter-var-root amap ancestors and apply areduce ' + - 'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' + - 'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' + - 'atom await await-for await1 bases bean bigdec bigint binding bit-and ' + - 'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' + - 'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' + - 'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' + - 'char-escape-string char-name-string char? chars chunk chunk-append ' + - 'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' + - 'class class? clear-agent-errors clojure-version coll? comment commute ' + - 'comp comparator compare compare-and-set! compile complement concat cond ' + - 'condp conj conj! cons constantly construct-proxy contains? count ' + - 'counted? create-ns create-struct cycle dec decimal? declare definline ' + - 'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' + - 'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' + - 'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' + - 'double-array doubles drop drop-last drop-while empty empty? ensure ' + - 'enumeration-seq eval even? every? false? ffirst file-seq filter find ' + - 'find-doc find-ns find-var first float float-array float? floats flush ' + - 'fn fn? fnext for force format future future-call future-cancel ' + - 'future-cancelled? future-done? future? gen-class gen-interface gensym ' + - 'get get-in get-method get-proxy-class get-thread-bindings get-validator ' + - 'hash hash-map hash-set identical? identity if-let if-not ifn? import ' + - 'in-ns inc init-proxy instance? int int-array integer? interleave intern ' + - 'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' + - 'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' + - 'list* list? load load-file load-reader load-string loaded-libs locking ' + - 'long long-array longs loop macroexpand macroexpand-1 make-array ' + - 'make-hierarchy map map? mapcat max max-key memfn memoize merge ' + - 'merge-with meta method-sig methods min min-key mod name namespace neg? ' + - 'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' + - 'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' + - 'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' + - 'or parents partial partition pcalls peek persistent! pmap pop pop! ' + - 'pop-thread-bindings pos? pr pr-str prefer-method prefers ' + - 'primitives-classnames print print-ctor print-doc print-dup print-method ' + - 'print-namespace-doc print-simple print-special-doc print-str printf ' + - 'println println-str prn prn-str promise proxy proxy-call-with-super ' + - 'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' + - 'rand rand-int range ratio? rational? rationalize re-find re-groups ' + - 're-matcher re-matches re-pattern re-seq read read-line read-string ' + - 'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' + - 'refer refer-clojure release-pending-sends rem remove remove-method ' + - 'remove-ns remove-watch repeat repeatedly replace replicate require ' + - 'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' + - 'rsubseq second select-keys send send-off seq seq? seque sequence ' + - 'sequential? set set-validator! set? short short-array shorts ' + - 'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' + - 'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' + - 'split-at split-with str stream? string? struct struct-map subs subseq ' + - 'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' + - 'take-last take-nth take-while test the-ns time to-array to-array-2d ' + - 'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' + - 'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' + - 'unchecked-remainder unchecked-subtract underive unquote ' + - 'unquote-splicing update-in update-proxy use val vals var-get var-set ' + - 'var? vary-meta vec vector vector? when when-first when-let when-not ' + - 'while with-bindings with-bindings* with-in-str with-loading-context ' + - 'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' + - 'zero? zipmap ').split(" ") + var builtinFunctions = ( + '* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' + + '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' + + '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' + + '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' + + '*read-eval* *source-path* *use-context-classloader* ' + + '*warn-on-reflection* + - -> ->> .. / < <= = ' + + '== > > >= >= accessor aclone ' + + 'add-classpath add-watch agent agent-errors aget alength alias all-ns ' + + 'alter alter-meta! alter-var-root amap ancestors and apply areduce ' + + 'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' + + 'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' + + 'atom await await-for await1 bases bean bigdec bigint binding bit-and ' + + 'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' + + 'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' + + 'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' + + 'char-escape-string char-name-string char? chars chunk chunk-append ' + + 'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' + + 'class class? clear-agent-errors clojure-version coll? comment commute ' + + 'comp comparator compare compare-and-set! compile complement concat cond ' + + 'condp conj conj! cons constantly construct-proxy contains? count ' + + 'counted? create-ns create-struct cycle dec decimal? declare definline ' + + 'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' + + 'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' + + 'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' + + 'double-array doubles drop drop-last drop-while empty empty? ensure ' + + 'enumeration-seq eval even? every? false? ffirst file-seq filter find ' + + 'find-doc find-ns find-var first float float-array float? floats flush ' + + 'fn fn? fnext for force format future future-call future-cancel ' + + 'future-cancelled? future-done? future? gen-class gen-interface gensym ' + + 'get get-in get-method get-proxy-class get-thread-bindings get-validator ' + + 'hash hash-map hash-set identical? identity if-let if-not ifn? import ' + + 'in-ns inc init-proxy instance? int int-array integer? interleave intern ' + + 'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' + + 'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' + + 'list* list? load load-file load-reader load-string loaded-libs locking ' + + 'long long-array longs loop macroexpand macroexpand-1 make-array ' + + 'make-hierarchy map map? mapcat max max-key memfn memoize merge ' + + 'merge-with meta method-sig methods min min-key mod name namespace neg? ' + + 'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' + + 'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' + + 'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' + + 'or parents partial partition pcalls peek persistent! pmap pop pop! ' + + 'pop-thread-bindings pos? pr pr-str prefer-method prefers ' + + 'primitives-classnames print print-ctor print-doc print-dup print-method ' + + 'print-namespace-doc print-simple print-special-doc print-str printf ' + + 'println println-str prn prn-str promise proxy proxy-call-with-super ' + + 'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' + + 'rand rand-int range ratio? rational? rationalize re-find re-groups ' + + 're-matcher re-matches re-pattern re-seq read read-line read-string ' + + 'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' + + 'refer refer-clojure release-pending-sends rem remove remove-method ' + + 'remove-ns remove-watch repeat repeatedly replace replicate require ' + + 'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' + + 'rsubseq second select-keys send send-off seq seq? seque sequence ' + + 'sequential? set set-validator! set? short short-array shorts ' + + 'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' + + 'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' + + 'split-at split-with str stream? string? struct struct-map subs subseq ' + + 'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' + + 'take-last take-nth take-while test the-ns time to-array to-array-2d ' + + 'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' + + 'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' + + 'unchecked-remainder unchecked-subtract underive unquote ' + + 'unquote-splicing update-in update-proxy use val vals var-get var-set ' + + 'var? vary-meta vec vector vector? when when-first when-let when-not ' + + 'while with-bindings with-bindings* with-in-str with-loading-context ' + + 'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' + + 'zero? zipmap' ); - var keywords = lang.arrayToMap( - ('def do fn if let loop monitor-enter monitor-exit new quote recur set! ' + - 'throw try var').split(" ") + var keywords = ('throw try var ' + + 'def do fn if let loop monitor-enter monitor-exit new quote recur set!' ); - var buildinConstants = lang.arrayToMap( - ("true false nil").split(" ") - ); + var buildinConstants = ("true false nil"); + var keywordMapper = this.createKeywordMapper({ + "keyword": keywords, + "constant.language": buildinConstants, + "support.function": builtinFunctions + }, "identifier", false, " "); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -175,16 +176,7 @@ var ClojureHighlightRules = function() { token : "constant.language", regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]' }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" diff --git a/lib/ace/mode/coffee_highlight_rules.js b/lib/ace/mode/coffee_highlight_rules.js index d3fe7884..ffe6319e 100644 --- a/lib/ace/mode/coffee_highlight_rules.js +++ b/lib/ace/mode/coffee_highlight_rules.js @@ -38,10 +38,9 @@ define(function(require, exports, module) { "use strict"; - var lang = require("../lib/lang"); var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; - + oop.inherits(CoffeeHighlightRules, TextHighlightRules); function CoffeeHighlightRules() { @@ -52,34 +51,41 @@ define(function(require, exports, module) { regex : ".+" }; - var keywords = lang.arrayToMap(( + var keywords = ( "this|throw|then|try|typeof|super|switch|return|break|by)|continue|" + "catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" + "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" + - "or|on|unless|until|and|yes").split("|") + "or|on|unless|until|and|yes" ); - - var langConstant = lang.arrayToMap(( - "true|false|null|undefined").split("|") + + var langConstant = ( + "true|false|null|undefined" ); - - var illegal = lang.arrayToMap(( + + var illegal = ( "case|const|default|function|var|void|with|enum|export|implements|" + "interface|let|package|private|protected|public|static|yield|" + - "__hasProp|extends|slice|bind|indexOf").split("|") + "__hasProp|extends|slice|bind|indexOf" ); - - var supportClass = lang.arrayToMap(( + + var supportClass = ( "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|" + - "RangeError|String|SyntaxError|Error|EvalError|TypeError|URIError").split("|") + "String|RangeError|SyntaxError|Error|EvalError|TypeError|URIError" ); - - var supportFunction = lang.arrayToMap(( + + var supportFunction = ( "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" + - "encodeURIComponent|decodeURI|decodeURIComponent|RangeError|String|" + - "SyntaxError|Error|EvalError|TypeError|URIError").split("|") + "encodeURIComponent|decodeURI|decodeURIComponent|String|" ); + var keywordMapper = this.createKeywordMapper({ + "keyword": keywords, + "constant.language": langConstant, + "invalid.illegal": illegal, + "language.support.class": supportClass, + "language.support.function": supportFunction, + }, "identifier"); + this.$rules = { start : [ { @@ -89,20 +95,7 @@ define(function(require, exports, module) { token : "variable", regex : "@(?:" + identifier + ")?" }, { - token: function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (langConstant.hasOwnProperty(value)) - return "constant.language"; - else if (illegal.hasOwnProperty(value)) - return "invalid.illegal"; - else if (supportClass.hasOwnProperty(value)) - return "language.support.class"; - else if (supportFunction.hasOwnProperty(value)) - return "language.support.function"; - else - return "identifier"; - }, + token: keywordMapper, regex : identifier }, { token : "constant.numeric", @@ -164,40 +157,40 @@ define(function(require, exports, module) { token : "text", regex : "\\s+" }], - + qdoc : [{ token : "string", regex : ".*?'''", next : "start" }, stringfill], - + qqdoc : [{ token : "string", regex : '.*?"""', next : "start" }, stringfill], - + qstring : [{ token : "string", regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'", merge : true, next : "start" }, stringfill], - + qqstring : [{ token : "string", regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"', merge : true, next : "start" }, stringfill], - + js : [{ token : "string", merge : true, regex : "[^\\\\`]*(?:\\\\.[^\\\\`]*)*`", next : "start" }, stringfill], - + heregex : [{ token : "string.regex", regex : '.*?///[imgy]{0,4}', @@ -210,7 +203,7 @@ define(function(require, exports, module) { merge : true, regex : "\\S+" }], - + comment : [{ token : "comment", regex : '.*?###', diff --git a/lib/ace/mode/csharp_highlight_rules.js b/lib/ace/mode/csharp_highlight_rules.js index 7713e40b..22bbd82c 100644 --- a/lib/ace/mode/csharp_highlight_rules.js +++ b/lib/ace/mode/csharp_highlight_rules.js @@ -2,20 +2,15 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CSharpHighlightRules = function() { - - var keywords = lang.arrayToMap( - ("abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic").split("|") - ); - - var buildinConstants = lang.arrayToMap( - ("null|true|false").split("|") - ); - + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic", + "constant.language": "null|true|false" + }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -51,16 +46,7 @@ var CSharpHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" @@ -93,7 +79,7 @@ var CSharpHighlightRules = function() { } ] }; - + this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; diff --git a/lib/ace/mode/css_highlight_rules.js b/lib/ace/mode/css_highlight_rules.js index 8ac88e74..59324780 100644 --- a/lib/ace/mode/css_highlight_rules.js +++ b/lib/ace/mode/css_highlight_rules.js @@ -43,37 +43,21 @@ var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CssHighlightRules = function() { + var keywordMapper = this.createKeywordMapper({ + "support.type": "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index", + "support.function": "rgb|rgba|url|attr|counter|counters", + "support.constant": "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero", + "support.constant.color": "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow", + "support.constant.fonts": "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace" + }, "text", true); - var properties = lang.arrayToMap( - ("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|") - ); - - var functions = lang.arrayToMap( - ("rgb|rgba|url|attr|counter|counters").split("|") - ); - - var constants = lang.arrayToMap( - ("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|") - ); - - var colors = lang.arrayToMap( - ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" + - "purple|red|silver|teal|white|yellow").split("|") - ); - - var fonts = lang.arrayToMap( - ("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" + - "symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" + - "serif|monospace").split("|") - ); - // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b"; - + var base_ruleset = [ { token : "comment", // multi line comment @@ -99,34 +83,15 @@ var CssHighlightRules = function() { token : "constant.numeric", // hex3 color regex : "#[a-f0-9]{3}" }, { - token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"], + token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"], regex : pseudoElements }, { - token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], + token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], regex : pseudoClasses }, { - token : function(value) { - if (properties.hasOwnProperty(value.toLowerCase())) { - return "support.type"; - } - else if (functions.hasOwnProperty(value.toLowerCase())) { - return "support.function"; - } - else if (constants.hasOwnProperty(value.toLowerCase())) { - return "support.constant"; - } - else if (colors.hasOwnProperty(value.toLowerCase())) { - return "support.constant.color"; - } - else if (fonts.hasOwnProperty(value.toLowerCase())) { - return "support.constant.fonts"; - } - else { - return "text"; - } - }, + token : keywordMapper, regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" - } + } ]; var ruleset = lang.copyArray(base_ruleset); diff --git a/lib/ace/mode/glsl_highlight_rules.js b/lib/ace/mode/glsl_highlight_rules.js index ec83ae02..b192b2df 100644 --- a/lib/ace/mode/glsl_highlight_rules.js +++ b/lib/ace/mode/glsl_highlight_rules.js @@ -39,21 +39,20 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; var glslHighlightRules = function() { - var keywords = lang.arrayToMap( - ("attribute|const|uniform|varying|break|continue|do|for|while|" + + var keywords = ( + "attribute|const|uniform|varying|break|continue|do|for|while|" + "if|else|in|out|inout|float|int|void|bool|true|false|" + "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" + "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" + - "samplerCube|struct").split("|") + "samplerCube|struct" ); - var buildinConstants = lang.arrayToMap( - ("radians|degrees|sin|cos|tan|asin|acos|atan|pow|" + + var buildinConstants = ( + "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" + "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" + "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" + "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" + @@ -67,22 +66,19 @@ var glslHighlightRules = function() { // The following two are only for MIME x-shader/x-vertex. "gl_Position|gl_PointSize|" + // The following five are only for MIME x-shader/x-fragment. - "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData").split("|") + "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData" ); + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": buildinConstants + }, "identifier"); + this.$rules = new c_cppHighlightRules().$rules; this.$rules.start.forEach(function(rule) { - if (typeof rule.token == "function") - rule.token = function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }; + if (typeof rule.token == "function") + rule.token = keywordMapper; }) }; diff --git a/lib/ace/mode/golang_highlight_rules.js b/lib/ace/mode/golang_highlight_rules.js index 4b450055..ad0a85b0 100644 --- a/lib/ace/mode/golang_highlight_rules.js +++ b/lib/ace/mode/golang_highlight_rules.js @@ -1,20 +1,22 @@ define(function(require, exports, module) { var oop = require("../lib/oop"); - var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GolangHighlightRules = function() { - var keywords = lang.arrayToMap( - ("true|else|false|break|case|return|goto|if|const|" + - "continue|struct|default|switch|for|" + - "func|import|package|chan|defer|fallthrough|go|interface|map|range" + - "select|type|var").split("|") + var keywords = ( + "true|else|false|break|case|return|goto|if|const|" + + "continue|struct|default|switch|for|" + + "func|import|package|chan|defer|fallthrough|go|interface|map|range" + + "select|type|var" ); + var buildinConstants = ("nil|true|false|iota"); - var buildinConstants = lang.arrayToMap( - ("nil|true|false|iota").split("|") - ); + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": buildinConstants + }, "identifier"); this.$rules = { "start" : [ @@ -57,16 +59,7 @@ define(function(require, exports, module) { token : "keyword", // pre-compiler directivs regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)" }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", @@ -119,9 +112,9 @@ define(function(require, exports, module) { } ] }; - - this.embedRules(DocCommentHighlightRules, "doc-", - [ DocCommentHighlightRules.getEndRule("start") ]); + + this.embedRules(DocCommentHighlightRules, "doc-", + [ DocCommentHighlightRules.getEndRule("start") ]); } oop.inherits(GolangHighlightRules, TextHighlightRules); diff --git a/lib/ace/mode/groovy_highlight_rules.js b/lib/ace/mode/groovy_highlight_rules.js index 6a151eca..b9f4033a 100644 --- a/lib/ace/mode/groovy_highlight_rules.js +++ b/lib/ace/mode/groovy_highlight_rules.js @@ -2,31 +2,30 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var GroovyHighlightRules = function() { - var keywords = lang.arrayToMap( - ("assert|with|abstract|continue|for|new|switch|" + - "assert|default|goto|package|synchronized|" + - "boolean|do|if|private|this|" + - "break|double|implements|protected|throw|" + - "byte|else|import|public|throws|" + - "case|enum|instanceof|return|transient|" + - "catch|extends|int|short|try|" + - "char|final|interface|static|void|" + - "class|finally|long|strictfp|volatile|" + - "def|float|native|super|while").split("|") + var keywords = ( + "assert|with|abstract|continue|for|new|switch|" + + "assert|default|goto|package|synchronized|" + + "boolean|do|if|private|this|" + + "break|double|implements|protected|throw|" + + "byte|else|import|public|throws|" + + "case|enum|instanceof|return|transient|" + + "catch|extends|int|short|try|" + + "char|final|interface|static|void|" + + "class|finally|long|strictfp|volatile|" + + "def|float|native|super|while" ); - var buildinConstants = lang.arrayToMap( - ("null|Infinity|NaN|undefined").split("|") + var buildinConstants = ( + "null|Infinity|NaN|undefined" ); - var langClasses = lang.arrayToMap( - ("AbstractMethodError|AssertionError|ClassCircularityError|"+ + var langClasses = ( + "AbstractMethodError|AssertionError|ClassCircularityError|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ExceptionInInitializerError|IllegalAccessError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+ @@ -49,12 +48,18 @@ var GroovyHighlightRules = function() { "ArrayStoreException|ClassCastException|LinkageError|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ - "Cloneable|Class|CharSequence|Comparable|String|Object").split("|") - ); - - var importClasses = lang.arrayToMap( - ("").split("|") + "Cloneable|Class|CharSequence|Comparable|String|Object" ); + + // TODO var importClasses = ""; + + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "support.function": langClasses, + "constant.language": buildinConstants + }, "identifier"); + // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -97,20 +102,7 @@ var GroovyHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (langClasses.hasOwnProperty(value)) - return "support.function"; - else if (importClasses.hasOwnProperty(value)) - return "support.function"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" @@ -172,7 +164,7 @@ var GroovyHighlightRules = function() { } ] }; - + this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; diff --git a/lib/ace/mode/haxe_highlight_rules.js b/lib/ace/mode/haxe_highlight_rules.js index 5b17c650..4e7f18b1 100644 --- a/lib/ace/mode/haxe_highlight_rules.js +++ b/lib/ace/mode/haxe_highlight_rules.js @@ -2,20 +2,25 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); + var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var HaxeHighlightRules = function() { - var keywords = lang.arrayToMap( - ("break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std").split("|") + var keywords = ( + "break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std" ); - var buildinConstants = lang.arrayToMap( - ("null|true|false").split("|") + var buildinConstants = ( + "null|true|false" ); + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": buildinConstants + }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -51,16 +56,7 @@ var HaxeHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" diff --git a/lib/ace/mode/java_highlight_rules.js b/lib/ace/mode/java_highlight_rules.js index 77efd672..a37f9586 100644 --- a/lib/ace/mode/java_highlight_rules.js +++ b/lib/ace/mode/java_highlight_rules.js @@ -2,15 +2,14 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var JavaHighlightRules = function() { // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html - var keywords = lang.arrayToMap( - ("abstract|continue|for|new|switch|" + + var keywords = ( + "abstract|continue|for|new|switch|" + "assert|default|goto|package|synchronized|" + "boolean|do|if|private|this|" + "break|double|implements|protected|throw|" + @@ -19,15 +18,14 @@ var JavaHighlightRules = function() { "catch|extends|int|short|try|" + "char|final|interface|static|void|" + "class|finally|long|strictfp|volatile|" + - "const|float|native|super|while").split("|") + "const|float|native|super|while" ); - var buildinConstants = lang.arrayToMap( - ("null|Infinity|NaN|undefined").split("|") - ); + var buildinConstants = ("null|Infinity|NaN|undefined"); - var langClasses = lang.arrayToMap( - ("AbstractMethodError|AssertionError|ClassCircularityError|"+ + + var langClasses = ( + "AbstractMethodError|AssertionError|ClassCircularityError|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ExceptionInInitializerError|IllegalAccessError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+ @@ -50,12 +48,17 @@ var JavaHighlightRules = function() { "ArrayStoreException|ClassCastException|LinkageError|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ - "Cloneable|Class|CharSequence|Comparable|String|Object").split("|") - ); - - var importClasses = lang.arrayToMap( - ("").split("|") + "Cloneable|Class|CharSequence|Comparable|String|Object" ); + + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": buildinConstants, + "support.function": langClasses, + + }, "identifier"); + // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -90,20 +93,7 @@ var JavaHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (langClasses.hasOwnProperty(value)) - return "support.function"; - else if (importClasses.hasOwnProperty(value)) - return "support.function"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" @@ -133,7 +123,7 @@ var JavaHighlightRules = function() { } ] }; - + this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; diff --git a/lib/ace/mode/liquid_highlight_rules.js b/lib/ace/mode/liquid_highlight_rules.js index cb8fcb35..26f3649a 100644 --- a/lib/ace/mode/liquid_highlight_rules.js +++ b/lib/ace/mode/liquid_highlight_rules.js @@ -41,157 +41,149 @@ define(function(require, exports, module) { var oop = require("../lib/oop"); var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; -var lang = require("../lib/lang"); var xmlUtil = require("./xml_util"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LiquidHighlightRules = function() { // see: https://developer.mozilla.org/en/Liquid/Reference/Global_Objects - var functions = lang.arrayToMap( + var functions = ( // Standard Filters - ("date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" + + "date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" + "escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" + "truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split" - ).split("|") ); - var keywords = lang.arrayToMap( + var keywords = ( // Standard Tags - ("capture|endcapture|case|endcase|when|comment|endcomment|" + + "capture|endcapture|case|endcase|when|comment|endcomment|" + "cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" + - // Commonly used tags - "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow").split("|") + // Commonly used tags + "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow" ); - var builtinVariables = lang.arrayToMap( - ['forloop'] - // ("forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" + + var builtinVariables = 'forloop|tablerowloop'; + // "forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" + // "tablerowloop\\.(length|index|index0|rindex|rindex0|first|last|col|col0|"+ - // "col_first|col_last)").split("|") - ); + // "col_first|col_last)" - var definitions = lang.arrayToMap(("assign").split("|")); + var definitions = ("assign"); + + var keywordMapper = this.createKeywordMapper({ + "variable.language": builtinVariables, + "keyword": keywords, + "support.function": functions, + "keyword.definition": definitions + }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { - start : [{ - token : "variable", - regex : "{%", - next : "liquid_start" - }, { - token : "variable", - regex : "{{", - next : "liquid_start" - }, { - token : "meta.tag", - merge : true, - regex : "<\\!\\[CDATA\\[", - next : "cdata" - }, { - token : "xml_pe", - regex : "<\\?.*?\\?>" - }, { - token : "comment", - merge : true, - regex : "<\\!--", - next : "comment" - }, { - token : "meta.tag", - regex : "<(?=\\s*script\\b)", - next : "script" - }, { - token : "meta.tag", - regex : "<(?=\\s*style\\b)", - next : "style" - }, { - token : "meta.tag", // opening tag - regex : "<\\/?", - next : "tag" - }, { - token : "text", - regex : "\\s+" - }, { - token : "text", - regex : "[^<]+" - } ], + start : [{ + token : "variable", + regex : "{%", + next : "liquid_start" + }, { + token : "variable", + regex : "{{", + next : "liquid_start" + }, { + token : "meta.tag", + merge : true, + regex : "<\\!\\[CDATA\\[", + next : "cdata" + }, { + token : "xml_pe", + regex : "<\\?.*?\\?>" + }, { + token : "comment", + merge : true, + regex : "<\\!--", + next : "comment" + }, { + token : "meta.tag", + regex : "<(?=\\s*script\\b)", + next : "script" + }, { + token : "meta.tag", + regex : "<(?=\\s*style\\b)", + next : "style" + }, { + token : "meta.tag", // opening tag + regex : "<\\/?", + next : "tag" + }, { + token : "text", + regex : "\\s+" + }, { + token : "text", + regex : "[^<]+" + } ], - cdata : [ { - token : "text", - regex : "\\]\\]>", - next : "start" - }, { - token : "text", - merge : true, - regex : "\\s+" - }, { - token : "text", - merge : true, - regex : ".+" - } ], + cdata : [ { + token : "text", + regex : "\\]\\]>", + next : "start" + }, { + token : "text", + merge : true, + regex : "\\s+" + }, { + token : "text", + merge : true, + regex : ".+" + } ], - comment : [ { - token : "comment", - regex : ".*?-->", - next : "start" - }, { - token : "comment", - merge : true, - regex : ".+" - } ] , + comment : [ { + token : "comment", + regex : ".*?-->", + next : "start" + }, { + token : "comment", + merge : true, + regex : ".+" + } ] , - liquid_start : [{ - token: "variable", - regex: "}}", - next: "start" - }, { - token: "variable", - regex: "%}", - next: "start" - }, { - token : "string", // single line - regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - }, { - token : "string", // single line - regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" - }, { - token : "constant.numeric", // hex - regex : "0[xX][0-9a-fA-F]+\\b" - }, { - token : "constant.numeric", // float - regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" - }, { - token : "constant.language.boolean", - regex : "(?:true|false)\\b" - }, { - token : function(value) { - if (functions.hasOwnProperty(value)) - return "support.function"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinVariables.hasOwnProperty(value)) - return "variable.language"; - else if (definitions.hasOwnProperty(value)) - return "keyword.definition"; - else - return "identifier"; - }, - regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" - }, { - token : "keyword.operator", - regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:" - }, { - token : "paren.lparen", - regex : /[\[\({]/ - }, { - token : "paren.rparen", - regex : /[\])}]/ - }, { - token : "text", - regex : "\\s+" - }] + liquid_start : [{ + token: "variable", + regex: "}}", + next: "start" + }, { + token: "variable", + regex: "%}", + next: "start" + }, { + token : "string", // single line + regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + }, { + token : "string", // single line + regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" + }, { + token : "constant.numeric", // hex + regex : "0[xX][0-9a-fA-F]+\\b" + }, { + token : "constant.numeric", // float + regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" + }, { + token : "constant.language.boolean", + regex : "(?:true|false)\\b" + }, { + token : keywordMapper, + regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, { + token : "keyword.operator", + regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:" + }, { + token : "paren.lparen", + regex : /[\[\({]/ + }, { + token : "paren.rparen", + regex : /[\])}]/ + }, { + token : "text", + regex : "\\s+" + }] }; xmlUtil.tag(this.$rules, "tag", "start"); diff --git a/lib/ace/mode/lua_highlight_rules.js b/lib/ace/mode/lua_highlight_rules.js index 57e5fead..35dcc2d1 100644 --- a/lib/ace/mode/lua_highlight_rules.js +++ b/lib/ace/mode/lua_highlight_rules.js @@ -41,22 +41,20 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var LuaHighlightRules = function() { - var keywords = lang.arrayToMap( - ("break|do|else|elseif|end|for|function|if|in|local|repeat|"+ - "return|then|until|while|or|and|not").split("|") + var keywords = ( + "break|do|else|elseif|end|for|function|if|in|local|repeat|"+ + "return|then|until|while|or|and|not" ); - var builtinConstants = lang.arrayToMap( - ("true|false|nil|_G|_VERSION").split("|") - ); + var builtinConstants = ("true|false|nil|_G|_VERSION"); - var builtinFunctions = lang.arrayToMap( - ("string|xpcall|package|tostring|print|os|unpack|require|"+ + var functions = ( + // builtinFunctions + "string|xpcall|package|tostring|print|os|unpack|require|"+ "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+ "collectgarbage|getmetatable|module|rawset|math|debug|"+ "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+ @@ -75,25 +73,27 @@ var LuaHighlightRules = function() { "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+ "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+ "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+ - "status|wrap|create|running").split("|") - ); - - var stdLibaries = lang.arrayToMap( - ("string|package|os|io|math|debug|table|coroutine").split("|") - ); - - var metatableMethods = lang.arrayToMap( - ("__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+ - "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber").split("|") + "status|wrap|create|running|"+ + // metatableMethods + "__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+ + "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber" ); - var futureReserved = lang.arrayToMap( - ("").split("|") - ); - - var deprecatedIn5152 = lang.arrayToMap( - ("setn|foreach|foreachi|gcinfo|log10|maxn").split("|") - ); + var stdLibaries = ("string|package|os|io|math|debug|table|coroutine"); + + var futureReserved = ""; + + var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn"); + + var keywordMapper = this.createKeywordMapper({ + "keyword": keywords, + "support.function": functions, + "invalid.deprecated": deprecatedIn5152, + "constant.library": stdLibaries, + "constant.language": builtinConstants, + "invalid.illegal": futureReserved, + "variable.language": "this" + }, "identifier"); var strPre = ""; @@ -105,13 +105,13 @@ var LuaHighlightRules = function() { var intPart = "(?:\\d+)"; var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))"; var floatNumber = "(?:" + pointFloat + ")"; - - var comment_stack = []; - - this.$rules = { - "start" : - + var comment_stack = []; + + this.$rules = { + "start" : + + // bracketed comments [{ token : "comment", // --[[ comment @@ -132,7 +132,7 @@ var LuaHighlightRules = function() { token : "comment", // --[====+[ comment regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]' }, - + // multiline bracketed comments { token : "comment", // --[[ comment @@ -169,20 +169,20 @@ var LuaHighlightRules = function() { // you can never be too paranoid ;) if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined) comment_stack.push(match.length); - + return "comment"; }, regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*$', merge : true, next : "qcomment5" }, - + // single line comments { token : "comment", regex : "\\-\\-.*$" - }, - + }, + // bracketed strings { token : "string", // [[ string @@ -203,7 +203,7 @@ var LuaHighlightRules = function() { token : "string", // [====+[ string regex : strPre + '\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]' }, - + // multiline bracketed strings { token : "string", // [[ string @@ -236,14 +236,14 @@ var LuaHighlightRules = function() { var pattern = /\[(\=+)\[/, match; if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined) comment_stack.push(match.length); - + return "string"; }, regex : strPre + '\\[\\={5}\\=*\\[.*$', merge : true, next : "qstring5" - }, - + }, + { token : "string", // " string regex : strPre + '"(?:[^\\\\]|\\\\.)*?"' @@ -257,24 +257,7 @@ var LuaHighlightRules = function() { token : "constant.numeric", // integer regex : integer + "\\b" }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (futureReserved.hasOwnProperty(value)) - return "invalid.illegal"; - else if (stdLibaries.hasOwnProperty(value)) - return "constant.library"; - else if (deprecatedIn5152.hasOwnProperty(value)) - return "invalid.deprecated"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else if (metatableMethods.hasOwnProperty(value)) - return "support.function"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", @@ -289,7 +272,7 @@ var LuaHighlightRules = function() { token : "text", regex : "\\s+" } ], - + "qcomment": [ { token : "comment", regex : "(?:[^\\\\]|\\\\.)*?\\]\\]", @@ -336,7 +319,7 @@ var LuaHighlightRules = function() { regex : '.+' } ], "qcomment5": [ { - token : function(value){ + token : function(value){ // very hackish, mutates the qcomment5 field on the fly. var pattern = /\](\=+)\]/, rule = this.rules.qcomment5[0], match; rule.next = "start"; @@ -347,7 +330,7 @@ var LuaHighlightRules = function() { rule.next = "qcomment5"; } } - + return "comment"; }, regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]", @@ -357,7 +340,7 @@ var LuaHighlightRules = function() { merge : true, regex : '.+' } ], - + "qstring": [ { token : "string", regex : "(?:[^\\\\]|\\\\.)*?\\]\\]", @@ -404,7 +387,7 @@ var LuaHighlightRules = function() { regex : '.+' } ], "qstring5": [ { - token : function(value){ + token : function(value){ // very hackish, mutates the qstring5 field on the fly. var pattern = /\](\=+)\]/, rule = this.rules.qstring5[0], match; rule.next = "start"; @@ -415,7 +398,7 @@ var LuaHighlightRules = function() { rule.next = "qstring5"; } } - + return "string"; }, regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]", @@ -425,7 +408,7 @@ var LuaHighlightRules = function() { merge : true, regex : '.+' } ] - + }; } diff --git a/lib/ace/mode/ocaml_highlight_rules.js b/lib/ace/mode/ocaml_highlight_rules.js index dca7b229..96ec9f15 100644 --- a/lib/ace/mode/ocaml_highlight_rules.js +++ b/lib/ace/mode/ocaml_highlight_rules.js @@ -41,24 +41,21 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var OcamlHighlightRules = function() { - var keywords = lang.arrayToMap(( + var keywords = ( "and|as|assert|begin|class|constraint|do|done|downto|else|end|" + "exception|external|for|fun|function|functor|if|in|include|" + "inherit|initializer|lazy|let|match|method|module|mutable|new|" + "object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" + - "virtual|when|while|with").split("|") + "virtual|when|while|with" ); - var builtinConstants = lang.arrayToMap( - ("true|false").split("|") - ); + var builtinConstants = ("true|false"); - var builtinFunctions = lang.arrayToMap(( + var builtinFunctions = ( "abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" + "add_available_units|add_big_int|add_buffer|add_channel|add_char|" + "add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" + @@ -239,7 +236,14 @@ var OcamlHighlightRules = function() { "MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" + "Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" + "Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak" - ).split("|")); + ); + + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "constant.language": builtinConstants, + "support.function": builtinFunctions + }, "identifier"); var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))"; var octInteger = "(?:0[oO]?[0-7]+)"; @@ -293,16 +297,7 @@ var OcamlHighlightRules = function() { regex : integer + "\\b" }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { diff --git a/lib/ace/mode/perl_highlight_rules.js b/lib/ace/mode/perl_highlight_rules.js index ed1e45c8..f79629fb 100644 --- a/lib/ace/mode/perl_highlight_rules.js +++ b/lib/ace/mode/perl_highlight_rules.js @@ -39,22 +39,19 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PerlHighlightRules = function() { - var keywords = lang.arrayToMap( - ("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" + - "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars").split("|") + var keywords = ( + "base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" + + "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars" ); - var buildinConstants = lang.arrayToMap( - ("ARGV|ENV|INC|SIG").split("|") - ); + var buildinConstants = ("ARGV|ENV|INC|SIG"); - var builtinFunctions = lang.arrayToMap( - ("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" + + var builtinFunctions = ( + "getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" + "gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" + "getpeername|setpriority|getprotoent|setprotoent|getpriority|" + "endprotoent|getservent|setservent|endservent|sethostent|socketpair|" + @@ -75,9 +72,15 @@ var PerlHighlightRules = function() { "join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" + "keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" + "eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" + - "map|die|uc|lc|do").split("|") + "map|die|uc|lc|do" ); + var keywordMapper = this.createKeywordMapper({ + "keyword": keywords, + "constant.language": buildinConstants, + "support.function": builtinFunctions + }, "identifier"); + // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -112,16 +115,7 @@ var PerlHighlightRules = function() { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", diff --git a/lib/ace/mode/pgsql_highlight_rules.js b/lib/ace/mode/pgsql_highlight_rules.js index 688e9ac7..866b5ed5 100755 --- a/lib/ace/mode/pgsql_highlight_rules.js +++ b/lib/ace/mode/pgsql_highlight_rules.js @@ -32,10 +32,10 @@ var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules; var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules; var PgsqlHighlightRules = function() { - + // Keywords, functions, operators last updated for pg 9.1. - var keywords = lang.arrayToMap( - ("abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" + + var keywords = ( + "abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" + "analyse|analyze|and|any|anyarray|anyelement|anyenum|anynonarray|array|as|asc|assertion|" + "assignment|asymmetric|at|attribute|authorization|backward|before|begin|between|bigint|" + "binary|bit|bool|boolean|both|box|bpchar|by|bytea|cache|called|cascade|cascaded|case|cast|" + @@ -74,12 +74,12 @@ var PgsqlHighlightRules = function() { "unlogged|until|update|user|using|uuid|vacuum|valid|validate|validator|value|values|varbit|" + "varchar|variadic|varying|verbose|version|view|void|volatile|when|where|whitespace|window|" + "with|without|work|wrapper|write|xid|xml|xmlattributes|xmlconcat|xmlelement|xmlexists|" + - "xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone").split("|") + "xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone" ); - - - var builtinFunctions = lang.arrayToMap( - ("RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" + + + + var builtinFunctions = ( + "RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" + "RI_FKey_noaction_del|RI_FKey_noaction_upd|RI_FKey_restrict_del|RI_FKey_restrict_upd|" + "RI_FKey_setdefault_del|RI_FKey_setdefault_upd|RI_FKey_setnull_del|" + "RI_FKey_setnull_upd|abbrev|abs|abstime|abstimeeq|abstimege|abstimegt|abstimein|abstimele|" + @@ -392,9 +392,15 @@ var PgsqlHighlightRules = function() { "win866_to_mic|win866_to_win1251|win_to_utf8|xideq|xideqint4|xidin|xidout|xidrecv|xidsend|" + "xml|xml_in|xml_is_well_formed|xml_is_well_formed_content|xml_is_well_formed_document|" + "xml_out|xml_recv|xml_send|xmlagg|xmlcomment|xmlconcat2|xmlexists|xmlvalidate|xpath|" + - "xpath_exists").split("|") + "xpath_exists" ); - + + var keywordMapper = this.createKeywordMapper({ + "support.function": builtinFunctions, + "keyword": keywords, + }, "identifier", true); + + var sqlRules = [ { token : "string", // single line string -- assume dollar strings if multi-line for now @@ -406,16 +412,7 @@ var PgsqlHighlightRules = function() { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { - token : function(value) { - value = value.toLowerCase(); - if (keywords.hasOwnProperty(value)) { - return "keyword"; - } else if (builtinFunctions.hasOwnProperty(value)) { - return "support.function"; - } else { - return "identifier"; - } - }, + token : keywordMapper, regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers }, { token : "keyword.operator", @@ -434,14 +431,14 @@ var PgsqlHighlightRules = function() { regex : "\\s+" } ]; - + this.$rules = { "start" : [ { token : "comment", regex : "--.*$" - }, + }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi-line comment @@ -457,7 +454,7 @@ var PgsqlHighlightRules = function() { regex : "^\\\\[\\S]+.*$" } ], - + "statement" : [ { token : "comment", @@ -489,7 +486,7 @@ var PgsqlHighlightRules = function() { next : "dollarStatementString" } ].concat(sqlRules), - + "dollarSql" : [ { token : "comment", @@ -509,7 +506,7 @@ var PgsqlHighlightRules = function() { next : "dollarSqlString" } ].concat(sqlRules), - + "comment" : [ { token : "comment", // closing comment @@ -521,7 +518,7 @@ var PgsqlHighlightRules = function() { regex : ".+" } ], - + "commentStatement" : [ { token : "comment", // closing comment @@ -533,7 +530,7 @@ var PgsqlHighlightRules = function() { regex : ".+" } ], - + "commentDollarSql" : [ { token : "comment", // closing comment @@ -545,7 +542,7 @@ var PgsqlHighlightRules = function() { regex : ".+" } ], - + "dollarStatementString" : [ { token : "string", // closing dollarstring @@ -557,7 +554,7 @@ var PgsqlHighlightRules = function() { regex : ".+" } ], - + "dollarSqlString" : [ { token : "string", // closing dollarstring @@ -570,7 +567,7 @@ var PgsqlHighlightRules = function() { } ] }; - + this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]); this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]); diff --git a/lib/ace/mode/powershell_highlight_rules.js b/lib/ace/mode/powershell_highlight_rules.js index 68cd0684..29071a3b 100644 --- a/lib/ace/mode/powershell_highlight_rules.js +++ b/lib/ace/mode/powershell_highlight_rules.js @@ -2,18 +2,17 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PowershellHighlightRules = function() { - - var keywords = lang.arrayToMap( - ("function|if|else|elseif|switch|while|default|for|do|until|break|continue|" + - "foreach|return|filter|in|trap|throw|param|begin|process|end").split("|") + + var keywords = ( + "function|if|else|elseif|switch|while|default|for|do|until|break|continue|" + + "foreach|return|filter|in|trap|throw|param|begin|process|end" ); - var builtinFunctions = lang.arrayToMap( - ("Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" + + var builtinFunctions = ( + "Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" + "Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" + "Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" + "Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" + @@ -53,12 +52,18 @@ var PowershellHighlightRules = function() { "Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" + "Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" + "Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|" + - "Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption").split("|")); + "Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption" + ); + + var keywordMapper = this.createKeywordMapper({ + "support.function": builtinFunctions, + "keyword": keywords + }, "identifier"); var binaryOperatorsRe = "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace|contains|notcontains|" + "ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|" + "is|isnot|as|" + - "and|or|band|bor|not"; + "and|or|band|bor|not"; // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -90,14 +95,7 @@ var PowershellHighlightRules = function() { token : "variable.instance", regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b" }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b" diff --git a/lib/ace/mode/python_highlight_rules.js b/lib/ace/mode/python_highlight_rules.js index b9e5e48c..91d6d478 100644 --- a/lib/ace/mode/python_highlight_rules.js +++ b/lib/ace/mode/python_highlight_rules.js @@ -43,35 +43,39 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var PythonHighlightRules = function() { - var keywords = lang.arrayToMap( - ("and|as|assert|break|class|continue|def|del|elif|else|except|exec|" + + var keywords = ( + "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" + "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" + - "raise|return|try|while|with|yield").split("|") + "raise|return|try|while|with|yield" ); - var builtinConstants = lang.arrayToMap( - ("True|False|None|NotImplemented|Ellipsis|__debug__").split("|") + var builtinConstants = ( + "True|False|None|NotImplemented|Ellipsis|__debug__" ); - var builtinFunctions = lang.arrayToMap( - ("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" + + var builtinFunctions = ( + "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" + "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" + "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" + "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" + "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" + "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" + "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" + - "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern").split("|") + "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern" ); - var futureReserved = lang.arrayToMap( - ("").split("|") - ); + //var futureReserved = ""; + var keywordMapper = this.createKeywordMapper({ + "invalid.deprecated": "debugger", + "support.function": builtinFunctions, + //"invalid.illegal": futureReserved, + "constant.language": builtinConstants, + "keyword": keywords + }, "identifier"); var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?"; @@ -127,20 +131,7 @@ var PythonHighlightRules = function() { token : "constant.numeric", // integer regex : integer + "\\b" }, { - token : function(value) { - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (futureReserved.hasOwnProperty(value)) - return "invalid.illegal"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else if (value == "debugger") - return "invalid.deprecated"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", diff --git a/lib/ace/mode/ruby_highlight_rules.js b/lib/ace/mode/ruby_highlight_rules.js index 67cbc672..5124f1aa 100644 --- a/lib/ace/mode/ruby_highlight_rules.js +++ b/lib/ace/mode/ruby_highlight_rules.js @@ -40,14 +40,13 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var RubyHighlightRules = function() { - var builtinFunctions = lang.arrayToMap( - ("abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" + - "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" + + var builtinFunctions = ( + "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" + + "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" + "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" + "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" + "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" + @@ -75,25 +74,33 @@ var RubyHighlightRules = function() { "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "translate|localize|extract_locale_from_tld|t|l|caches_page|expire_page|caches_action|expire_action|" + "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" + - "has_many|has_one|belongs_to|has_and_belongs_to_many").split("|") + "has_many|has_one|belongs_to|has_and_belongs_to_many" ); - var keywords = lang.arrayToMap( - ("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + - "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + - "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield").split("|") + var keywords = ( + "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + + "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" + + "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield" ); - var buildinConstants = lang.arrayToMap( - ("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + - "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING").split("|") + var buildinConstants = ( + "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + + "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING" ); - var builtinVariables = lang.arrayToMap( - ("\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" + - "$!|root_url|flash|session|cookies|params|request|response|logger").split("|") + var builtinVariables = ( + "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" + + "$!|root_url|flash|session|cookies|params|request|response|logger|self" ); + var keywordMapper = this.createKeywordMapper({ + "keyword": keywords, + "constant.language": buildinConstants, + "variable.language": builtinVariables, + "support.function": builtinFunctions, + "invalid.deprecated": "debugger" // TODO is this a remnant from js mode? + }, "identifier"); + // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -141,22 +148,7 @@ var RubyHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { - token : function(value) { - if (value == "self") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinVariables.hasOwnProperty(value)) - return "variable.language"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else if (value == "debugger") - return "invalid.deprecated"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" diff --git a/lib/ace/mode/scad_highlight_rules.js b/lib/ace/mode/scad_highlight_rules.js index 82234750..b2283122 100644 --- a/lib/ace/mode/scad_highlight_rules.js +++ b/lib/ace/mode/scad_highlight_rules.js @@ -47,14 +47,11 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var scadHighlightRules = function() { - - var keywords = lang.arrayToMap( - ("module|if|else|for").split("|") - ); - - var buildinConstants = lang.arrayToMap( - ("NULL").split("|") - ); + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": "module|if|else|for", + "constant.language": "NULL", + }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -97,17 +94,8 @@ var scadHighlightRules = function() { }, { token : "keyword", // pre-compiler directivs regex : "(?:use|include)" - }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + }, { + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", diff --git a/lib/ace/mode/scala_highlight_rules.js b/lib/ace/mode/scala_highlight_rules.js index c39962db..2b905256 100644 --- a/lib/ace/mode/scala_highlight_rules.js +++ b/lib/ace/mode/scala_highlight_rules.js @@ -2,27 +2,22 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ScalaHighlightRules = function() { // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html - var keywords = lang.arrayToMap( - ( + var keywords = ( "case|default|do|else|for|if|match|while|throw|return|try|catch|finally|yield|" + "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|" + "override|package|private|protected|sealed|super|this|trait|type|val|var|with" - ).split("|") ); - var buildinConstants = lang.arrayToMap( - ("true|false").split("|") - ); - - var langClasses = lang.arrayToMap( - ("AbstractMethodError|AssertionError|ClassCircularityError|"+ + var buildinConstants = ("true|false"); + + var langClasses = ( + "AbstractMethodError|AssertionError|ClassCircularityError|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ExceptionInInitializerError|IllegalAccessError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+ @@ -49,13 +44,17 @@ var ScalaHighlightRules = function() { "Cloneable|Class|CharSequence|Comparable|String|Object|" + "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" + "Option|Array|Char|Byte|Short|Int|Long|Nothing" - - ).split("|") - ); - - var importClasses = lang.arrayToMap( - ("").split("|") + + ); + + var keywordMapper = this.createKeywordMapper({ + "variable.language": "this", + "keyword": keywords, + "support.function": langClasses, + "constant.language": buildinConstants + }, "identifier"); + // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used @@ -95,20 +94,7 @@ var ScalaHighlightRules = function() { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { - token : function(value) { - if (value == "this") - return "variable.language"; - else if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (langClasses.hasOwnProperty(value)) - return "support.function"; - else if (importClasses.hasOwnProperty(value)) - return "support.function"; - else if (buildinConstants.hasOwnProperty(value)) - return "constant.language"; - else - return "identifier"; - }, + token : keywordMapper, // TODO: Unicode escape sequences // TODO: Unicode identifiers regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" @@ -168,7 +154,7 @@ var ScalaHighlightRules = function() { } ] }; - + this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; diff --git a/lib/ace/mode/sh_highlight_rules.js b/lib/ace/mode/sh_highlight_rules.js index d416ab7a..64806372 100644 --- a/lib/ace/mode/sh_highlight_rules.js +++ b/lib/ace/mode/sh_highlight_rules.js @@ -41,21 +41,19 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ShHighlightRules = function() { - var reservedKeywords = lang.arrayToMap( - ('!|{|}|case|do|done|elif|else|'+ + var reservedKeywords = ( + '!|{|}|case|do|done|elif|else|'+ 'esac|fi|for|if|in|then|until|while|'+ '&|;|export|local|read|typeset|unset|'+ 'elif|select|set' - ).split('|') ); - var languageConstructs = lang.arrayToMap( - ('[|]|alias|bg|bind|break|builtin|'+ + var languageConstructs = ( + '[|]|alias|bg|bind|break|builtin|'+ 'cd|command|compgen|complete|continue|'+ 'dirs|disown|echo|enable|eval|exec|'+ 'exit|fc|fg|getopts|hash|help|history|'+ @@ -63,9 +61,14 @@ var ShHighlightRules = function() { 'pwd|return|set|shift|shopt|source|'+ 'suspend|test|times|trap|type|ulimit|'+ 'umask|unalias|wait' - ).split('|') ); + var keywordMapper = this.createKeywordMapper({ + "keyword": reservedKeywords, + "constant.language": languageConstructs, + "invalid.deprecated": "debugger" + }, "identifier"); + var integer = "(?:(?:[1-9]\\d*)|(?:0))"; // var integer = "(?:" + decimalInteger + ")"; @@ -112,16 +115,7 @@ var ShHighlightRules = function() { token : "constant.numeric", // integer regex : integer + "\\b" }, { - token : function(value) { - if (reservedKeywords.hasOwnProperty(value)) - return "keyword"; - else if (languageConstructs.hasOwnProperty(value)) - return "constant.language"; - else if (value == "debugger") - return "invalid.deprecated"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", diff --git a/lib/ace/mode/sql_highlight_rules.js b/lib/ace/mode/sql_highlight_rules.js index dc099edc..70d91c60 100644 --- a/lib/ace/mode/sql_highlight_rules.js +++ b/lib/ace/mode/sql_highlight_rules.js @@ -22,24 +22,29 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SqlHighlightRules = function() { - var keywords = lang.arrayToMap( - ("select|from|where|and|or|group|by|order|limit|offset|having|as|case|" + - "when|else|end|type|left|right|join|on|outer|desc|asc").split("|") + var keywords = ( + "select|from|where|and|or|group|by|order|limit|offset|having|as|case|" + + "when|else|end|type|left|right|join|on|outer|desc|asc" ); - var builtinConstants = lang.arrayToMap( - ("true|false|null").split("|") + var builtinConstants = ( + "true|false|null" ); - var builtinFunctions = lang.arrayToMap( - ("count|min|max|avg|sum|rank|now|coalesce").split("|") + var builtinFunctions = ( + "count|min|max|avg|sum|rank|now|coalesce" ); + var keywordMapper = this.createKeywordMapper({ + "support.function": builtinFunctions, + "keyword": keywords, + "constant.language": builtinConstants + }, "identifier", true); + this.$rules = { "start" : [ { token : "comment", @@ -54,17 +59,7 @@ var SqlHighlightRules = function() { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { - token : function(value) { - value = value.toLowerCase(); - if (keywords.hasOwnProperty(value)) - return "keyword"; - else if (builtinConstants.hasOwnProperty(value)) - return "constant.language"; - else if (builtinFunctions.hasOwnProperty(value)) - return "support.function"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", diff --git a/lib/ace/mode/tcl_highlight_rules.js b/lib/ace/mode/tcl_highlight_rules.js index bf352314..2a40e69a 100644 --- a/lib/ace/mode/tcl_highlight_rules.js +++ b/lib/ace/mode/tcl_highlight_rules.js @@ -39,15 +39,12 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TclHighlightRules = function() { - var builtinFunctions = lang.arrayToMap( - ("").split("|") - - ); + //TODO var builtinFunctions = ""; + this.$rules = { "start" : [ { @@ -86,12 +83,7 @@ var TclHighlightRules = function() { token : "support.function", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::" }, { - token : function(value) { - if (builtinFunctions.hasOwnProperty(value)) - return "keyword"; - else - return "identifier"; - }, + token : "identifier", regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "paren.lparen", diff --git a/lib/ace/mode/xquery_highlight_rules.js b/lib/ace/mode/xquery_highlight_rules.js index fc14c2c5..a74ce205 100644 --- a/lib/ace/mode/xquery_highlight_rules.js +++ b/lib/ace/mode/xquery_highlight_rules.js @@ -38,15 +38,14 @@ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); -var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var XQueryHighlightRules = function() { - var keywords = lang.arrayToMap( - ("after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning").split("|") - ); - + var keywordMapper = this.createKeywordMapper({ + keyword: "after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning" + }, "identifier"); + // regexp must not have capturing parentheses // regexps are ordered -> the first match is used @@ -89,12 +88,7 @@ var XQueryHighlightRules = function() { token: "support.function", regex: "\\w[\\w+_\\-:]+(?=\\()" }, { - token : function(value) { - if (keywords[value]) - return "keyword"; - else - return "identifier"; - }, + token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token: "keyword.operator", From c4716740c25cd2a676751612bd62cfd1d600b31b Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 31 Aug 2012 19:27:52 +0400 Subject: [PATCH 5/8] add css and js highlighting to php mode --- lib/ace/mode/_test/tokens_php.json | 36 +++---- lib/ace/mode/php_highlight_rules.js | 146 ++++++---------------------- 2 files changed, 46 insertions(+), 136 deletions(-) diff --git a/lib/ace/mode/_test/tokens_php.json b/lib/ace/mode/_test/tokens_php.json index 13dfbea4..8de22fe6 100644 --- a/lib/ace/mode/_test/tokens_php.json +++ b/lib/ace/mode/_test/tokens_php.json @@ -1,6 +1,6 @@ [ { - "state": "start", + "state": "php-start", "values": [ "" - }, - { - token : "comment", - regex : "<\\!--", - next : "htmlcomment" - }, - { - token : "meta.tag", - regex : "' - }, { token : "comment", regex : "\\/\\/.*$" @@ -1063,103 +1037,39 @@ var PhpHighlightRules = function() { token : "string", regex : ".+?" } - ], - "htmlcomment" : [ - { - token : "comment", - regex : ".*?-->", - next : "start" - }, { - token : "comment", - regex : ".+" - } - ], - "htmltag" : [ - { - token : "meta.tag", - regex : ">", - next : "start" - }, { - token : "text", - regex : "[-_a-zA-Z0-9:]+" - }, { - token : "text", - regex : "\\s+" - }, { - token : "string", - regex : '".*?"' - }, { - token : "string", - regex : "'.*?'" - } - ], - "css" : [ - { - token : "meta.tag", - regex : "<\/style>", - next : "htmltag" - }, { - token : "meta.tag", - regex : ">" - }, { - token : 'text', - regex : "(?:media|type|href)" - }, { - token : 'string', - regex : '=".*?"' - }, { - token : "paren.lparen", - regex : "\{", - next : "cssdeclaration" - }, { - token : "keyword", - regex : "#[A-Za-z0-9\-\_\.]+" - }, { - token : "variable", - regex : "\\.[A-Za-z0-9\-\_\.]+" - }, { - token : "constant", - regex : "[A-Za-z0-9]+" - } - ], - "cssdeclaration" : [ - { - token : "support.type", - regex : "[\-a-zA-Z]+", - next : "cssvalue" - }, - { - token : "paren.rparen", - regex : '\}', - next : "css" - } - ], - "cssvalue" : [ - { - token : "text", - regex : "\:" - }, - { - token : "constant", - regex : "#[0-9a-zA-Z]+" - }, - { - token : "text", - regex : "[\-\_0-9a-zA-Z\"' ,%]+" - }, - { - token : "text", - regex : ";", - next : "cssdeclaration" - } - ] + ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); }; +oop.inherits(PhpLangHighlightRules, TextHighlightRules); + + +var PhpHighlightRules = function() { + this.$rules = new HtmlHighlightRules().getRules(); + + for (var i in this.$rules) { + this.$rules[i].unshift({ + token : "support.php_tag", // php open tag + regex : "<\\?(?:php|\\=)", + next : "php-start" + }); + } + + this.embedRules(PhpLangHighlightRules, "php-"); + + this.$rules["php-start"].unshift({ + token : "support.php_tag", // php close tag + regex : "\\?>", + next : "start" + }); +}; + oop.inherits(PhpHighlightRules, TextHighlightRules); + + exports.PhpHighlightRules = PhpHighlightRules; }); From 441ca92f9a6ae5520baeaf25592fb40ac1bf5006 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 4 Sep 2012 13:36:53 +0200 Subject: [PATCH 6/8] Fix multiple code style issues --- lib/ace/mode/_test/test_highlight_rules.js | 143 ++++++++++----------- 1 file changed, 67 insertions(+), 76 deletions(-) diff --git a/lib/ace/mode/_test/test_highlight_rules.js b/lib/ace/mode/_test/test_highlight_rules.js index 2057e9df..7f560fc6 100644 --- a/lib/ace/mode/_test/test_highlight_rules.js +++ b/lib/ace/mode/_test/test_highlight_rules.js @@ -1,138 +1,129 @@ var fs = require("fs"); -var path = require("path"); if (!fs.existsSync) - fs.existsSync = path.existsSync; + fs.existsSync = require("path").existsSync; require("amd-loader"); function generateTestData() { - var root = Array(5).join("../") + "/demo/kitchen-sink/docs" - var docs = fs.readdirSync(root) - var specialDocs = fs.readdirSync(".") + var root = Array(5).join("../") + "/demo/kitchen-sink/docs"; + var docs = fs.readdirSync(root); + var specialDocs = fs.readdirSync("."); var modes = fs.readdirSync("../").filter(function(x){ - return /(\w+)_highlight_rules.js$/.test(x) + return /^\w+_highlight_rules.js$/.test(x); }).map(function(x) { - return x.replace(/_highlight_rules.js$/, "") + return x.replace(/_highlight_rules.js$/, ""); }); - console.log(docs) - console.log(modes) + console.log("Docs:", docs.join()); + console.log("Modes:", modes); docs.forEach(function(docName){ - var p = docName.toLowerCase().split("."), modeName - if (modes.indexOf(p[0]) != -1) { - modeName = p[0] - } else if (modes.indexOf(p[1]) != -1) { - modeName = p[1] - } else { - modeName = {"txt": "text", cpp: "c_cpp"}[p[1]] - } + var p = docName.toLowerCase().split("."); + var modeName; + if (modes.indexOf(p[0]) != -1) + modeName = p[0]; + else if (modes.indexOf(p[1]) != -1) + modeName = p[1]; + else + modeName = {"txt": "text", cpp: "c_cpp"}[p[1]]; - if (!modeName) { - return console.error(p) - } - - var filePath = "text_" + modeName + ".txt" + var filePath = "text_" + modeName + ".txt"; if (specialDocs.indexOf(filePath) == -1) { - filePath = root + "/" + docName + filePath = root + "/" + docName; } - var text = fs.readFileSync(filePath, "utf8") + var text = fs.readFileSync(filePath, "utf8"); var Mode = require("../" + modeName).Mode; var tokenizer = new Mode().getTokenizer(); - var state = "start" - var data = text.split(/\n|\r|\r\n]/).map(function(line) { - var tokens = tokenizer.getLineTokens(line, state) - state = tokens.state - tokens = tokens.tokens + var state = "start"; + var data = text.split(/\n|\r|\r\n/).map(function(line) { + var tokens = tokenizer.getLineTokens(line, state); + state = tokens.state; + tokens = tokens.tokens; return { state: state, - values: tokens.map(function(x) {return x.value}), - types: tokens.map(function(x) {return x.type}) - } - }) + values: tokens.map(function(x) {return x.value;}), + types: tokens.map(function(x) {return x.type;}) + }; + }); - fs.writeFileSync("tokens_" + modeName + ".json", JSON.stringify(data, null, 1), "utf8") - }) + fs.writeFileSync("tokens_" + modeName + ".json", JSON.stringify(data, null, 1), "utf8"); + }); } function test(startAt) { var docs = fs.readdirSync(".").filter(function(x){ - return /^tokens_\w+.json/.test(x) + return /^tokens_\w+.json$/.test(x); }); if (startAt && startAt > 1) - docs = docs.slice(startAt - 1) + docs = docs.slice(startAt - 1); docs.forEach(function(x, i){ - var modeName = x.match(/tokens_(.*).json/)[1] + var modeName = x.match(/tokens_(.*).json/)[1]; - console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m") + console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m"); - var text = fs.readFileSync("./" + x, "utf8") - var data = JSON.parse(text) + var text = fs.readFileSync("./" + x, "utf8"); + var data = JSON.parse(text); var Mode = require("../" + modeName).Mode; var tokenizer = new Mode().getTokenizer(); - var state = "start" + var state = "start"; data.forEach(function(lineData) { - var line = lineData.values.join("") + var line = lineData.values.join(""); - var tokens = tokenizer.getLineTokens(line, state) - var values = tokens.tokens.map(function(x) {return x.value}) - var types = tokens.tokens.map(function(x) {return x.type}) + var tokens = tokenizer.getLineTokens(line, state); + var values = tokens.tokens.map(function(x) {return x.value;}); + var types = tokens.tokens.map(function(x) {return x.type;}); - var success = true + var success = true; var report = testEqual([ lineData.state, tokens.state, lineData.types, types, - lineData.values, values]) + lineData.values, values]); - state = lineData.state - }) - }) + state = lineData.state; + }); + }); - console.log("\u001b[32m" + "all ok" + "\u001b[0m") + console.log("\u001b[32m" + "all ok" + "\u001b[0m"); function testEqual(a) { - var err + var err; if (a[0] !== a[1]) { - console.log(a[0],a[1]) - err = 1 + console.log(a[0],a[1]); + err = 1; } - if ( a[2] + "" !== a[3] + "" - || a[4] + "" !== a[5] + "" - ) { - arrayDiff(a[2],a[3]) - arrayDiff(a[4],a[5]) - err = 1 + if ( a[2] + "" !== a[3] + "" || a[4] + "" !== a[5] + "") { + arrayDiff(a[2],a[3]); + arrayDiff(a[4],a[5]); + err = 1; } if (err) { - throw "error" + throw "error"; } } function arrayDiff(a1, a2) { var l = Math.max(a1.length, a2.length); - var out = [] + var out = []; for (var i = 0; i < l; i++) { - out.push("\n", padNumber(i+1, 3), ") ") - if (a1[i] !== a2[i]) { - out.push("\u001b[31m", a1[i], " != ", a2[i], "\u001b[0m") - } else { - out.push(a1[i]) - } + out.push("\n", padNumber(i+1, 3), ") "); + if (a1[i] !== a2[i]) + out.push("\u001b[31m", a1[i], " != ", a2[i], "\u001b[0m"); + else + out.push(a1[i]); } - console.log(out.join("")) + console.log(out.join("")); } function padNumber(num, digits) { - return (" " + num).slice(-digits) + return (" " + num).slice(-digits); } } -if (process.argv[2] == "gen") { - generateTestData(process.argv.splice(3)) -} else { - test(parseInt(process.argv[2],10) || 0) -} +if (process.argv[2] == "gen") + generateTestData(process.argv.splice(3)); +else + test(parseInt(process.argv[2],10) || 0); From 25eeca0a75742c6de626862897df861e51c17384 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 4 Sep 2012 20:35:21 +0400 Subject: [PATCH 7/8] fix running mode tests from different directory --- lib/ace/mode/_test/test_highlight_rules.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/ace/mode/_test/test_highlight_rules.js b/lib/ace/mode/_test/test_highlight_rules.js index 7f560fc6..2c7d9f53 100644 --- a/lib/ace/mode/_test/test_highlight_rules.js +++ b/lib/ace/mode/_test/test_highlight_rules.js @@ -4,11 +4,13 @@ if (!fs.existsSync) require("amd-loader"); +var cwd = __dirname + "/"; + function generateTestData() { var root = Array(5).join("../") + "/demo/kitchen-sink/docs"; - var docs = fs.readdirSync(root); - var specialDocs = fs.readdirSync("."); - var modes = fs.readdirSync("../").filter(function(x){ + var docs = fs.readdirSync(cwd + root); + var specialDocs = fs.readdirSync(cwd); + var modes = fs.readdirSync(cwd + "../").filter(function(x){ return /^\w+_highlight_rules.js$/.test(x); }).map(function(x) { return x.replace(/_highlight_rules.js$/, ""); @@ -17,7 +19,7 @@ function generateTestData() { console.log("Docs:", docs.join()); console.log("Modes:", modes); - docs.forEach(function(docName){ + docs.forEach(function(docName) { var p = docName.toLowerCase().split("."); var modeName; if (modes.indexOf(p[0]) != -1) @@ -32,7 +34,7 @@ function generateTestData() { filePath = root + "/" + docName; } - var text = fs.readFileSync(filePath, "utf8"); + var text = fs.readFileSync(cwd + filePath, "utf8"); var Mode = require("../" + modeName).Mode; var tokenizer = new Mode().getTokenizer(); @@ -48,22 +50,22 @@ function generateTestData() { }; }); - fs.writeFileSync("tokens_" + modeName + ".json", JSON.stringify(data, null, 1), "utf8"); + fs.writeFileSync(cwd + "tokens_" + modeName + ".json", JSON.stringify(data, null, 1), "utf8"); }); } function test(startAt) { - var docs = fs.readdirSync(".").filter(function(x){ + var docs = fs.readdirSync(cwd).filter(function(x) { return /^tokens_\w+.json$/.test(x); }); if (startAt && startAt > 1) docs = docs.slice(startAt - 1); - docs.forEach(function(x, i){ + docs.forEach(function(x, i) { var modeName = x.match(/tokens_(.*).json/)[1]; console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m"); - var text = fs.readFileSync("./" + x, "utf8"); + var text = fs.readFileSync(cwd + x, "utf8"); var data = JSON.parse(text); var Mode = require("../" + modeName).Mode; var tokenizer = new Mode().getTokenizer(); From b43af68f9fc007f82022046735e5006c264a0300 Mon Sep 17 00:00:00 2001 From: Mostafa Eweda Date: Tue, 4 Sep 2012 18:42:01 +0200 Subject: [PATCH 8/8] trivial priniting tweak --- lib/ace/mode/_test/test_highlight_rules.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ace/mode/_test/test_highlight_rules.js b/lib/ace/mode/_test/test_highlight_rules.js index 2c7d9f53..3286c125 100644 --- a/lib/ace/mode/_test/test_highlight_rules.js +++ b/lib/ace/mode/_test/test_highlight_rules.js @@ -16,7 +16,7 @@ function generateTestData() { return x.replace(/_highlight_rules.js$/, ""); }); - console.log("Docs:", docs.join()); + console.log("Docs:", docs); console.log("Modes:", modes); docs.forEach(function(docName) {