Merge pull request #901 from ajaxorg/syntax

Syntax higlighters
This commit is contained in:
Mostafa Eweda 2012-09-04 09:43:33 -07:00
commit abfcd22253
74 changed files with 26004 additions and 1042 deletions

View file

@ -0,0 +1,8 @@
{
"name": "ace-mode-creator",
"version": "0.1.0",
"dependencies": {
"connect": "",
"socket.io": ""
}
}

View file

@ -0,0 +1,131 @@
var fs = require("fs");
if (!fs.existsSync)
fs.existsSync = require("path").existsSync;
require("amd-loader");
var cwd = __dirname + "/";
function generateTestData() {
var root = Array(5).join("../") + "/demo/kitchen-sink/docs";
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$/, "");
});
console.log("Docs:", docs);
console.log("Modes:", modes);
docs.forEach(function(docName) {
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]];
var filePath = "text_" + modeName + ".txt";
if (specialDocs.indexOf(filePath) == -1) {
filePath = root + "/" + docName;
}
var text = fs.readFileSync(cwd + 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(cwd + "tokens_" + modeName + ".json", JSON.stringify(data, null, 1), "utf8");
});
}
function test(startAt) {
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) {
var modeName = x.match(/tokens_(.*).json/)[1];
console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m");
var text = fs.readFileSync(cwd + 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;});
var success = true;
var report =
testEqual([
lineData.state, tokens.state,
lineData.types, types,
lineData.values, values]);
state = lineData.state;
});
});
console.log("\u001b[32m" + "all ok" + "\u001b[0m");
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(parseInt(process.argv[2],10) || 0);

View file

@ -0,0 +1,47 @@
function foo(items, nada) {
for (var i=0; i<items.length; i++) {
alert(items[i] + "juhu\n");
} // Real Tab.
}
/************************************/
/** total mess, tricky to highlight**/
function () {
/**
* docComment
**/
r = /u\t*/
g = 1.00E^1, y = 1.2 + .2 + 052 + 0x25
t = ['d', '']
}
function () {
/* eee */
}
"s\
s\u7824sss\u1"
'\
string'
'
string'
"trailing space\
" " /not a regexp/g
/**
*doc
*/
a = {
'a': b,
'g': function(t)
gta:function(a,b)
}
foo.protoype.d = function(a, b,
c, d)
foo.d =function(a, b)
foo.d =function(a, /*****/ d"string"

View file

@ -0,0 +1,273 @@
[
{
"state": "start",
"values": [
"Searching for 'var' in /workspace/configs"
],
"types": [
"text"
]
},
{
"state": "start",
"values": [],
"types": []
},
{
"state": "start",
"values": [
"configs/default.js",
":"
],
"types": [
"string",
"text"
]
},
{
"state": "start",
"values": [
" 1",
": ",
"var fs = require(\"fs\");"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t2",
": ",
"var argv = require('optimist').argv;"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t3",
": ",
"var path = require(\"path\");"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t5",
": ",
"var clientExtensions = {};"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t6",
": ",
"var clientDirs = fs.readdirSync(__dirname + \"/../plugins-client\");"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t7",
": ",
"for (var i = 0; i < clientDirs.length; i++) {"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t8",
": ",
"var dir = clientDirs[i];"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t12",
": ",
"var name = dir.split(\".\")[1];"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t16",
": ",
"var projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t17",
": ",
"var fsUrl = \"/workspace\";"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t19",
": ",
"var port = argv.p || process.env.PORT || 3131;"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t20",
": ",
"var host = argv.l || \"localhost\";"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [
"\t22",
": ",
"var config = {"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [],
"types": []
},
{
"state": "start",
"values": [
"configs/local.js",
":"
],
"types": [
"string",
"text"
]
},
{
"state": "start",
"values": [
"\t2",
": ",
"var config = require(\"./default\");"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [],
"types": []
},
{
"state": "start",
"values": [
"configs/packed.js",
":"
],
"types": [
"string",
"text"
]
},
{
"state": "start",
"values": [
"\t1",
": ",
"var config = require(\"./default\");"
],
"types": [
"c9searchresults.constant.numeric",
"c9searchresults.text",
"c9searchresults.text"
]
},
{
"state": "start",
"values": [],
"types": []
},
{
"state": "start",
"values": [],
"types": []
},
{
"state": "start",
"values": [
"Found 15 matches in 3 files"
],
"types": [
"text"
]
}
]

View file

@ -0,0 +1,207 @@
[
{
"state": "start",
"values": [
"// compound assignment operators"
],
"types": [
"comment"
]
},
{
"state": "start",
"values": [],
"types": []
},
{
"state": "start",
"values": [
"#include",
" ",
"<iostream>"
],
"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"
]
}
]

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

View file

@ -0,0 +1,65 @@
[
{
"state": "start",
"values": [
"<!--",
"- hello world --->"
],
"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#",
"</",
"cfoutput",
">"
],
"types": [
"meta.tag",
"meta.tag.tag-name",
"meta.tag",
"text",
"meta.tag",
"meta.tag.tag-name",
"meta.tag"
]
}
]

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

File diff suppressed because it is too large Load diff

View file

@ -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"
]
}
]

View file

@ -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": []
}
]

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

View file

@ -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": [
" ",
"</",
"style",
">"
],
"types": [
"text",
"meta.tag",
"meta.tag.tag-name.style",
"meta.tag"
]
},
{
"state": "start",
"values": [],
"types": []
},
{
"state": "start",
"values": [
" ",
"</",
"head",
">"
],
"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",
"</",
"h1",
">"
],
"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": [
" ",
"</",
"body",
">"
],
"types": [
"text",
"meta.tag",
"meta.tag.tag-name",
"meta.tag"
]
},
{
"state": "start",
"values": [
"</",
"html",
">"
],
"types": [
"meta.tag",
"meta.tag.tag-name",
"meta.tag"
]
}
]

View file

@ -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"
]
}
]

View file

@ -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": []
}
]

File diff suppressed because it is too large Load diff

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

View file

@ -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": []
}
]

File diff suppressed because it is too large Load diff

View file

@ -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": []
}
]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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"
]
}
]

View file

@ -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": []
}
]

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,417 @@
[
{
"state": "php-start",
"values": [
"<?php"
],
"types": [
"support.php_tag"
]
},
{
"state": "php-start",
"values": [],
"types": []
},
{
"state": "php-start",
"values": [
"function",
" ",
"nfact",
"(",
"$n",
")",
" ",
"{"
],
"types": [
"keyword",
"text",
"identifier",
"lparen",
"variable",
"rparen",
"text",
"lparen"
]
},
{
"state": "php-start",
"values": [
" ",
"if",
" ",
"(",
"$n",
" ",
"==",
" ",
"0",
")",
" ",
"{"
],
"types": [
"text",
"keyword",
"text",
"lparen",
"variable",
"text",
"keyword.operator",
"text",
"constant.numeric",
"rparen",
"text",
"lparen"
]
},
{
"state": "php-start",
"values": [
" ",
"return",
" ",
"1",
";"
],
"types": [
"text",
"support.function",
"text",
"constant.numeric",
"text"
]
},
{
"state": "php-start",
"values": [
" ",
"}"
],
"types": [
"text",
"rparen"
]
},
{
"state": "php-start",
"values": [
" ",
"else",
" ",
"{"
],
"types": [
"text",
"keyword",
"text",
"lparen"
]
},
{
"state": "php-start",
"values": [
" ",
"return",
" ",
"$n",
" ",
"*",
" ",
"nfact",
"(",
"$n",
" ",
"-",
" ",
"1",
")",
";"
],
"types": [
"text",
"support.function",
"text",
"variable",
"text",
"keyword.operator",
"text",
"identifier",
"lparen",
"variable",
"text",
"keyword.operator",
"text",
"constant.numeric",
"rparen",
"text"
]
},
{
"state": "php-start",
"values": [
" ",
"}"
],
"types": [
"text",
"rparen"
]
},
{
"state": "php-start",
"values": [
"}"
],
"types": [
"rparen"
]
},
{
"state": "php-start",
"values": [],
"types": []
},
{
"state": "php-start",
"values": [
"echo",
" ",
"\"",
"\\n",
"\\n",
"P",
"l",
"e",
"a",
"s",
"e",
" ",
"e",
"n",
"t",
"e",
"r",
" ",
"a",
" ",
"w",
"h",
"o",
"l",
"e",
" ",
"n",
"u",
"m",
"b",
"e",
"r",
" ",
".",
".",
".",
" ",
"\"",
";"
],
"types": [
"support.function",
"text",
"string",
"constant.language.escape",
"constant.language.escape",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"text"
]
},
{
"state": "php-start",
"values": [
"$num",
" ",
"=",
" ",
"trim",
"(",
"fgets",
"(",
"STDIN",
")",
")",
";"
],
"types": [
"variable",
"text",
"keyword.operator",
"text",
"support.function",
"lparen",
"support.function",
"lparen",
"constant.language",
"rparen",
"rparen",
"text"
]
},
{
"state": "php-start",
"values": [],
"types": []
},
{
"state": "php-start",
"values": [
"// ===== PROCESS - Determing the factorial of the input number ====="
],
"types": [
"comment"
]
},
{
"state": "php-start",
"values": [
"$output",
" ",
"=",
" ",
"\"",
"\\n",
"\\n",
"F",
"a",
"c",
"t",
"o",
"r",
"i",
"a",
"l",
" ",
"\"",
" . ",
"$num",
" . ",
"\"",
" ",
"=",
" ",
"\"",
" . ",
"nfact",
"(",
"$num",
")",
" . ",
"\"",
"\\n",
"\\n",
"\"",
";"
],
"types": [
"variable",
"text",
"keyword.operator",
"text",
"string",
"constant.language.escape",
"constant.language.escape",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"string",
"text",
"variable",
"text",
"string",
"string",
"string",
"string",
"string",
"text",
"identifier",
"lparen",
"variable",
"rparen",
"text",
"string",
"constant.language.escape",
"constant.language.escape",
"string",
"text"
]
},
{
"state": "php-start",
"values": [
"echo",
" ",
"$output",
";"
],
"types": [
"support.function",
"text",
"variable",
"text"
]
},
{
"state": "php-start",
"values": [],
"types": []
},
{
"state": "start",
"values": [
"?>"
],
"types": [
"support.php_tag"
]
}
]

View file

@ -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": []
}
]

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

File diff suppressed because it is too large Load diff

View file

@ -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"
]
}
]

View file

@ -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": []
}
]

View file

@ -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"
]
}
]

File diff suppressed because it is too large Load diff

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

View file

@ -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"
]
}
]

File diff suppressed because it is too large Load diff

View file

@ -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",
"}",
"</",
"message",
">"
],
"types": [
"text",
"meta.tag",
"text",
"lparen",
"variable",
"rparen",
"text",
"meta.tag",
"text"
]
},
{
"state": "start",
"values": [
"</",
"results",
">"
],
"types": [
"text",
"meta.tag",
"text"
]
},
{
"state": "start",
"values": [],
"types": []
}
]

View file

@ -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": []
}
]

View file

@ -42,27 +42,32 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var c_cppHighlightRules = function() { var c_cppHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|" + "and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|" +
"asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|" + "asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|" +
"typeid|bitor|extern|protected|typename|bool|false|public|union|" + "typeid|bitor|extern|protected|typename|bool|false|public|union|" +
"break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|" + "break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|" +
"friend|return|virtual|char|goto|short|void|class|if|signed|volatile|" + "friend|return|virtual|char|goto|short|void|class|if|signed|volatile|" +
"compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|" + "compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|" +
"static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|" + "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( var buildinConstants = (
("NULL").split("|") "NULL"
); );
var keywordMapper = this.createKeywordMapper({
"variable.language": "this",
"keyword": keywords,
"constant.language": buildinConstants
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -107,16 +112,7 @@ var c_cppHighlightRules = function() {
token : "keyword", // pre-compiler directivs token : "keyword", // pre-compiler directivs
regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)" regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
}, { }, {
token : function(value) { token : keywordMapper,
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -41,20 +41,19 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ClojureHighlightRules = function() { var ClojureHighlightRules = function() {
var builtinFunctions = lang.arrayToMap( var builtinFunctions = (
('* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' + '* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
'*command-line-args* *compile-files* *compile-path* *e *err* *file* ' + '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
'*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' + '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
'*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' + '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
'*read-eval* *source-path* *use-context-classloader* ' + '*read-eval* *source-path* *use-context-classloader* ' +
'*warn-on-reflection* + - -> -&gt; ->> -&gt;&gt; .. / < &lt; <= &lt;= = ' + '*warn-on-reflection* + - -> ->> .. / < <= = ' +
'== > &gt; >= &gt;= accessor aclone ' + '== > &gt; >= &gt;= accessor aclone ' +
'add-classpath add-watch agent agent-errors aget alength alias all-ns ' + 'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
'alter alter-meta! alter-var-root amap ancestors and apply areduce ' + 'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
@ -116,18 +115,20 @@ var ClojureHighlightRules = function() {
'var? vary-meta vec vector vector? when when-first when-let when-not ' + 'var? vary-meta vec vector vector? when when-first when-let when-not ' +
'while with-bindings with-bindings* with-in-str with-loading-context ' + '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 ' + 'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
'zero? zipmap ').split(" ") 'zero? zipmap'
); );
var keywords = lang.arrayToMap( var keywords = ('throw try var ' +
('def do fn if let loop monitor-enter monitor-exit new quote recur set! ' + 'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
'throw try var').split(" ")
); );
var buildinConstants = lang.arrayToMap( var buildinConstants = ("true false nil");
("true false nil").split(" ")
);
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"constant.language": buildinConstants,
"support.function": builtinFunctions
}, "identifier", false, " ");
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -175,16 +176,7 @@ var ClojureHighlightRules = function() {
token : "constant.language", token : "constant.language",
regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]' regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -38,7 +38,6 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
var lang = require("../lib/lang");
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
@ -52,34 +51,41 @@ define(function(require, exports, module) {
regex : ".+" regex : ".+"
}; };
var keywords = lang.arrayToMap(( var keywords = (
"this|throw|then|try|typeof|super|switch|return|break|by)|continue|" + "this|throw|then|try|typeof|super|switch|return|break|by)|continue|" +
"catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" + "catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" + "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(( var langConstant = (
"true|false|null|undefined").split("|") "true|false|null|undefined"
); );
var illegal = lang.arrayToMap(( var illegal = (
"case|const|default|function|var|void|with|enum|export|implements|" + "case|const|default|function|var|void|with|enum|export|implements|" +
"interface|let|package|private|protected|public|static|yield|" + "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|" + "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|" + "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
"encodeURIComponent|decodeURI|decodeURIComponent|RangeError|String|" + "encodeURIComponent|decodeURI|decodeURIComponent|String|"
"SyntaxError|Error|EvalError|TypeError|URIError").split("|")
); );
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"constant.language": langConstant,
"invalid.illegal": illegal,
"language.support.class": supportClass,
"language.support.function": supportFunction,
}, "identifier");
this.$rules = { this.$rules = {
start : [ start : [
{ {
@ -89,20 +95,7 @@ define(function(require, exports, module) {
token : "variable", token : "variable",
regex : "@(?:" + identifier + ")?" regex : "@(?:" + identifier + ")?"
}, { }, {
token: function(value) { token: keywordMapper,
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";
},
regex : identifier regex : identifier
}, { }, {
token : "constant.numeric", token : "constant.numeric",

View file

@ -2,20 +2,15 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CSharpHighlightRules = function() { var CSharpHighlightRules = function() {
var keywordMapper = this.createKeywordMapper({
var keywords = lang.arrayToMap( "variable.language": "this",
("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("|") "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");
var buildinConstants = lang.arrayToMap(
("null|true|false").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -51,16 +46,7 @@ var CSharpHighlightRules = function() {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : keywordMapper,
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -43,29 +43,13 @@ var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CssHighlightRules = function() { var CssHighlightRules = function() {
var keywordMapper = this.createKeywordMapper({
var properties = lang.arrayToMap( "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",
("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("|") "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",
var functions = lang.arrayToMap( "support.constant.fonts": "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"
("rgb|rgba|url|attr|counter|counters").split("|") }, "text", true);
);
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. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -105,26 +89,7 @@ var CssHighlightRules = function() {
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
regex : pseudoClasses regex : pseudoClasses
}, { }, {
token : function(value) { token : keywordMapper,
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";
}
},
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
} }
]; ];

View file

@ -39,21 +39,20 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
var glslHighlightRules = function() { var glslHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("attribute|const|uniform|varying|break|continue|do|for|while|" + "attribute|const|uniform|varying|break|continue|do|for|while|" +
"if|else|in|out|inout|float|int|void|bool|true|false|" + "if|else|in|out|inout|float|int|void|bool|true|false|" +
"lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" + "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" +
"mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" + "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" +
"samplerCube|struct").split("|") "samplerCube|struct"
); );
var buildinConstants = lang.arrayToMap( var buildinConstants = (
("radians|degrees|sin|cos|tan|asin|acos|atan|pow|" + "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" +
"exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" + "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" +
"min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" + "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" +
"normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" + "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" +
@ -67,22 +66,19 @@ var glslHighlightRules = function() {
// The following two are only for MIME x-shader/x-vertex. // The following two are only for MIME x-shader/x-vertex.
"gl_Position|gl_PointSize|" + "gl_Position|gl_PointSize|" +
// The following five are only for MIME x-shader/x-fragment. // 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 = new c_cppHighlightRules().$rules;
this.$rules.start.forEach(function(rule) { this.$rules.start.forEach(function(rule) {
if (typeof rule.token == "function") if (typeof rule.token == "function")
rule.token = function(value) { rule.token = keywordMapper;
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
};
}) })
}; };

View file

@ -1,20 +1,22 @@
define(function(require, exports, module) { define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var GolangHighlightRules = function() { var GolangHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("true|else|false|break|case|return|goto|if|const|" + "true|else|false|break|case|return|goto|if|const|" +
"continue|struct|default|switch|for|" + "continue|struct|default|switch|for|" +
"func|import|package|chan|defer|fallthrough|go|interface|map|range" + "func|import|package|chan|defer|fallthrough|go|interface|map|range" +
"select|type|var").split("|") "select|type|var"
); );
var buildinConstants = ("nil|true|false|iota");
var buildinConstants = lang.arrayToMap( var keywordMapper = this.createKeywordMapper({
("nil|true|false|iota").split("|") "variable.language": "this",
); "keyword": keywords,
"constant.language": buildinConstants
}, "identifier");
this.$rules = { this.$rules = {
"start" : [ "start" : [
@ -57,16 +59,7 @@ define(function(require, exports, module) {
token : "keyword", // pre-compiler directivs token : "keyword", // pre-compiler directivs
regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)" regex : "(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"
}, { }, {
token : function(value) { token : keywordMapper,
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -2,14 +2,13 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var GroovyHighlightRules = function() { var GroovyHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("assert|with|abstract|continue|for|new|switch|" + "assert|with|abstract|continue|for|new|switch|" +
"assert|default|goto|package|synchronized|" + "assert|default|goto|package|synchronized|" +
"boolean|do|if|private|this|" + "boolean|do|if|private|this|" +
"break|double|implements|protected|throw|" + "break|double|implements|protected|throw|" +
@ -18,15 +17,15 @@ var GroovyHighlightRules = function() {
"catch|extends|int|short|try|" + "catch|extends|int|short|try|" +
"char|final|interface|static|void|" + "char|final|interface|static|void|" +
"class|finally|long|strictfp|volatile|" + "class|finally|long|strictfp|volatile|" +
"def|float|native|super|while").split("|") "def|float|native|super|while"
); );
var buildinConstants = lang.arrayToMap( var buildinConstants = (
("null|Infinity|NaN|undefined").split("|") "null|Infinity|NaN|undefined"
); );
var langClasses = lang.arrayToMap( var langClasses = (
("AbstractMethodError|AssertionError|ClassCircularityError|"+ "AbstractMethodError|AssertionError|ClassCircularityError|"+
"ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
"ExceptionInInitializerError|IllegalAccessError|"+ "ExceptionInInitializerError|IllegalAccessError|"+
"IllegalThreadStateException|InstantiationError|InternalError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+
@ -49,12 +48,18 @@ var GroovyHighlightRules = function() {
"ArrayStoreException|ClassCastException|LinkageError|"+ "ArrayStoreException|ClassCastException|LinkageError|"+
"NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
"Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
"Cloneable|Class|CharSequence|Comparable|String|Object").split("|") "Cloneable|Class|CharSequence|Comparable|String|Object"
); );
var importClasses = lang.arrayToMap( // TODO var importClasses = "";
("").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. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -97,20 +102,7 @@ var GroovyHighlightRules = function() {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -2,20 +2,25 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var HaxeHighlightRules = function() { var HaxeHighlightRules = function() {
var keywords = lang.arrayToMap( 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").split("|") "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( var buildinConstants = (
("null|true|false").split("|") "null|true|false"
); );
var keywordMapper = this.createKeywordMapper({
"variable.language": "this",
"keyword": keywords,
"constant.language": buildinConstants
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -51,16 +56,7 @@ var HaxeHighlightRules = function() {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : keywordMapper,
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -2,15 +2,14 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var JavaHighlightRules = function() { var JavaHighlightRules = function() {
// taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html
var keywords = lang.arrayToMap( var keywords = (
("abstract|continue|for|new|switch|" + "abstract|continue|for|new|switch|" +
"assert|default|goto|package|synchronized|" + "assert|default|goto|package|synchronized|" +
"boolean|do|if|private|this|" + "boolean|do|if|private|this|" +
"break|double|implements|protected|throw|" + "break|double|implements|protected|throw|" +
@ -19,15 +18,14 @@ var JavaHighlightRules = function() {
"catch|extends|int|short|try|" + "catch|extends|int|short|try|" +
"char|final|interface|static|void|" + "char|final|interface|static|void|" +
"class|finally|long|strictfp|volatile|" + "class|finally|long|strictfp|volatile|" +
"const|float|native|super|while").split("|") "const|float|native|super|while"
); );
var buildinConstants = lang.arrayToMap( var buildinConstants = ("null|Infinity|NaN|undefined");
("null|Infinity|NaN|undefined").split("|")
);
var langClasses = lang.arrayToMap(
("AbstractMethodError|AssertionError|ClassCircularityError|"+ var langClasses = (
"AbstractMethodError|AssertionError|ClassCircularityError|"+
"ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
"ExceptionInInitializerError|IllegalAccessError|"+ "ExceptionInInitializerError|IllegalAccessError|"+
"IllegalThreadStateException|InstantiationError|InternalError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+
@ -50,12 +48,17 @@ var JavaHighlightRules = function() {
"ArrayStoreException|ClassCastException|LinkageError|"+ "ArrayStoreException|ClassCastException|LinkageError|"+
"NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
"Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
"Cloneable|Class|CharSequence|Comparable|String|Object").split("|") "Cloneable|Class|CharSequence|Comparable|String|Object"
); );
var importClasses = lang.arrayToMap( var keywordMapper = this.createKeywordMapper({
("").split("|") "variable.language": "this",
); "keyword": keywords,
"constant.language": buildinConstants,
"support.function": langClasses,
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -90,20 +93,7 @@ var JavaHighlightRules = function() {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -40,64 +40,45 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var unicode = require("../unicode"); var unicode = require("../unicode");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var JavaScriptHighlightRules = function() { var JavaScriptHighlightRules = function() {
// see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
var globals = lang.arrayToMap( var keywordMapper = this.createKeywordMapper({
// Constructors "variable.language":
("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
// E4X "Namespace|QName|XML|XMLList|" + // E4X
"Namespace|QName|XML|XMLList|" +
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
// Errors "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
"SyntaxError|TypeError|URIError|" + "SyntaxError|TypeError|URIError|" +
// Non-constructor functions "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
"isNaN|parseFloat|parseInt|" + "isNaN|parseFloat|parseInt|" +
// Other "JSON|Math|" + // Other
"JSON|Math|" + "this|arguments|prototype|window|document" , // Pseudo
// Pseudo "invalid.deprecated":
"this|arguments|prototype|window|document" "__parent__|__count__|escape|unescape|with|__proto__|debugger",
).split("|") "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 // keywords which can be followed by regular expressions
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield"; 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 // TODO: Unicode escape sequences
var identifierRe = "[" + unicode.packages.L + "\\$_][" var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "\\$_]*\\b";
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
"u[0-9a-fA-F]{4}|" + // unicode "u[0-9a-fA-F]{4}|" + // unicode
@ -136,106 +117,58 @@ var JavaScriptHighlightRules = function() {
}, { }, {
token : "constant.numeric", // float token : "constant.numeric", // float
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
}, { // match stuff like: Sound.prototype.play = function() { } }, {
// Sound.prototype.play =
token : [ token : [
"storage.type", "storage.type", "punctuation.operator", "support.function",
"punctuation.operator", "punctuation.operator", "entity.name.function", "text","keyword.operator"
"support.function",
"punctuation.operator",
"entity.name.function",
"text",
"keyword.operator",
"text",
"storage.type",
"text",
"paren.lparen"
], ],
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
next: "function_arguments" next: "function_arguments"
}, { // match stuff like: Sound.prototype.play = myfunc }, {
// Sound.play = function() { }
token : [ token : [
"storage.type", "storage.type", "punctuation.operator", "entity.name.function", "text",
"punctuation.operator", "keyword.operator", "text", "storage.type", "text", "paren.lparen"
"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"
], ],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments" next: "function_arguments"
}, { // match stuff like: play = function() { } }, {
// play = function() { }
token : [ token : [
"entity.name.function", "entity.name.function", "text", "keyword.operator", "text", "storage.type",
"text", "text", "paren.lparen"
"keyword.operator",
"text",
"storage.type",
"text",
"paren.lparen"
], ],
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments" next: "function_arguments"
}, { // match stuff like: Sound.play = function play() { } }, {
// Sound.play = function play() { }
token : [ token : [
"storage.type", "storage.type", "punctuation.operator", "entity.name.function", "text",
"punctuation.operator", "keyword.operator", "text",
"entity.name.function", "storage.type", "text", "entity.name.function", "text", "paren.lparen"
"text",
"keyword.operator",
"text",
"storage.type",
"text",
"entity.name.function",
"text",
"paren.lparen"
], ],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
next: "function_arguments" next: "function_arguments"
}, { // match regular function like: function myFunc(arg) { } }, {
// function myFunc(arg) { }
token : [ token : [
"storage.type", "storage.type", "text", "entity.name.function", "text", "paren.lparen"
"text",
"entity.name.function",
"text",
"paren.lparen"
], ],
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
next: "function_arguments" next: "function_arguments"
}, { // match stuff like: foobar: function() { } }, {
// foobar: function() { }
token : [ token : [
"entity.name.function", "entity.name.function", "text", "punctuation.operator",
"text", "text", "storage.type", "text", "paren.lparen"
"punctuation.operator",
"text",
"storage.type",
"text",
"paren.lparen"
], ],
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments" next: "function_arguments"
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { }) }, {
// : function() { } (this is for issues with 'foo': function() { })
token : [ token : [
"text", "text", "text", "storage.type", "text", "paren.lparen"
"text",
"storage.type",
"text",
"paren.lparen"
], ],
regex : "(:)(\\s*)(function)(\\s*)(\\()", regex : "(:)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments" next: "function_arguments"
@ -259,24 +192,7 @@ var JavaScriptHighlightRules = function() {
token : ["storage.type", "punctuation.operator", "support.function.firebug"], token : ["storage.type", "punctuation.operator", "support.function.firebug"],
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
regex : identifierRe regex : identifierRe
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -41,37 +41,40 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
var lang = require("../lib/lang");
var xmlUtil = require("./xml_util"); var xmlUtil = require("./xml_util");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LiquidHighlightRules = function() { var LiquidHighlightRules = function() {
// see: https://developer.mozilla.org/en/Liquid/Reference/Global_Objects // see: https://developer.mozilla.org/en/Liquid/Reference/Global_Objects
var functions = lang.arrayToMap( var functions = (
// Standard Filters // 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|" + "escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" +
"truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split" "truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split"
).split("|")
); );
var keywords = lang.arrayToMap( var keywords = (
// Standard Tags // 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|" + "cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" +
// Commonly used tags // Commonly used tags
"style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow").split("|") "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow"
); );
var builtinVariables = lang.arrayToMap( var builtinVariables = 'forloop|tablerowloop';
['forloop'] // "forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" +
// ("forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" +
// "tablerowloop\\.(length|index|index0|rindex|rindex0|first|last|col|col0|"+ // "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. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -166,18 +169,7 @@ var LiquidHighlightRules = function() {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -41,22 +41,20 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LuaHighlightRules = function() { var LuaHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("break|do|else|elseif|end|for|function|if|in|local|repeat|"+ "break|do|else|elseif|end|for|function|if|in|local|repeat|"+
"return|then|until|while|or|and|not").split("|") "return|then|until|while|or|and|not"
); );
var builtinConstants = lang.arrayToMap( var builtinConstants = ("true|false|nil|_G|_VERSION");
("true|false|nil|_G|_VERSION").split("|")
);
var builtinFunctions = lang.arrayToMap( var functions = (
("string|xpcall|package|tostring|print|os|unpack|require|"+ // builtinFunctions
"string|xpcall|package|tostring|print|os|unpack|require|"+
"getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+ "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+
"collectgarbage|getmetatable|module|rawset|math|debug|"+ "collectgarbage|getmetatable|module|rawset|math|debug|"+
"pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+ "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+
@ -75,25 +73,27 @@ var LuaHighlightRules = function() {
"gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+ "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+
"setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+ "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+
"foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+ "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+
"status|wrap|create|running").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 stdLibaries = lang.arrayToMap( var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
("string|package|os|io|math|debug|table|coroutine").split("|")
);
var metatableMethods = lang.arrayToMap( var futureReserved = "";
("__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
"__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber").split("|")
);
var futureReserved = lang.arrayToMap( var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
("").split("|")
);
var deprecatedIn5152 = lang.arrayToMap( var keywordMapper = this.createKeywordMapper({
("setn|foreach|foreachi|gcinfo|log10|maxn").split("|") "keyword": keywords,
); "support.function": functions,
"invalid.deprecated": deprecatedIn5152,
"constant.library": stdLibaries,
"constant.language": builtinConstants,
"invalid.illegal": futureReserved,
"variable.language": "this"
}, "identifier");
var strPre = ""; var strPre = "";
@ -257,24 +257,7 @@ var LuaHighlightRules = function() {
token : "constant.numeric", // integer token : "constant.numeric", // integer
regex : integer + "\\b" regex : integer + "\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -41,24 +41,21 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var OcamlHighlightRules = function() { var OcamlHighlightRules = function() {
var keywords = lang.arrayToMap(( var keywords = (
"and|as|assert|begin|class|constraint|do|done|downto|else|end|" + "and|as|assert|begin|class|constraint|do|done|downto|else|end|" +
"exception|external|for|fun|function|functor|if|in|include|" + "exception|external|for|fun|function|functor|if|in|include|" +
"inherit|initializer|lazy|let|match|method|module|mutable|new|" + "inherit|initializer|lazy|let|match|method|module|mutable|new|" +
"object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" + "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( var builtinConstants = ("true|false");
("true|false").split("|")
);
var builtinFunctions = lang.arrayToMap(( var builtinFunctions = (
"abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" + "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_available_units|add_big_int|add_buffer|add_channel|add_char|" +
"add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" + "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|" + "MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" +
"Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" + "Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" +
"Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak" "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 decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
var octInteger = "(?:0[oO]?[0-7]+)"; var octInteger = "(?:0[oO]?[0-7]+)";
@ -293,16 +297,7 @@ var OcamlHighlightRules = function() {
regex : integer + "\\b" regex : integer + "\\b"
}, },
{ {
token : function(value) { token : keywordMapper,
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";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, },
{ {

View file

@ -39,22 +39,19 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PerlHighlightRules = function() { var PerlHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" + "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("|") "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
); );
var buildinConstants = lang.arrayToMap( var buildinConstants = ("ARGV|ENV|INC|SIG");
("ARGV|ENV|INC|SIG").split("|")
);
var builtinFunctions = lang.arrayToMap( var builtinFunctions = (
("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" + "getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
"gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" + "gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
"getpeername|setpriority|getprotoent|setprotoent|getpriority|" + "getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
"endprotoent|getservent|setservent|endservent|sethostent|socketpair|" + "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|" + "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|" + "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|" + "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. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -112,16 +115,7 @@ var PerlHighlightRules = function() {
token : "constant.numeric", // float token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -20,12 +20,11 @@
define(function(require, exports, module) { define(function(require, exports, module) {
var oop = require("ace/lib/oop"); var oop = require("../lib/oop");
var TextMode = require("ace/mode/text").Mode; var TextMode = require("../mode/text").Mode;
var Tokenizer = require("ace/tokenizer").Tokenizer; var Tokenizer = require("../tokenizer").Tokenizer;
var PgsqlHighlightRules = require("ace/mode/pgsql_highlight_rules").PgsqlHighlightRules; var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
var Range = require("ace/range").Range; var Range = require("../range").Range;
// var EditSession = require("ace/edit_session").EditSession;
var Mode = function() { var Mode = function() {
this.$tokenizer = new Tokenizer(new PgsqlHighlightRules().getRules()); this.$tokenizer = new Tokenizer(new PgsqlHighlightRules().getRules());

View file

@ -23,8 +23,8 @@
define(function(require, exports, module) { define(function(require, exports, module) {
var oop = require("ace/lib/oop"); var oop = require("../lib/oop");
var lang = require("ace/lib/lang"); var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
// Supporting perl and python for now -- both in pg core and ace // Supporting perl and python for now -- both in pg core and ace
@ -34,8 +34,8 @@ var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRu
var PgsqlHighlightRules = function() { var PgsqlHighlightRules = function() {
// Keywords, functions, operators last updated for pg 9.1. // Keywords, functions, operators last updated for pg 9.1.
var keywords = lang.arrayToMap( var keywords = (
("abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" + "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|" + "analyse|analyze|and|any|anyarray|anyelement|anyenum|anynonarray|array|as|asc|assertion|" +
"assignment|asymmetric|at|attribute|authorization|backward|before|begin|between|bigint|" + "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|" + "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|" + "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|" + "varchar|variadic|varying|verbose|version|view|void|volatile|when|where|whitespace|window|" +
"with|without|work|wrapper|write|xid|xml|xmlattributes|xmlconcat|xmlelement|xmlexists|" + "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( var builtinFunctions = (
("RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" + "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_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_setdefault_del|RI_FKey_setdefault_upd|RI_FKey_setnull_del|" +
"RI_FKey_setnull_upd|abbrev|abs|abstime|abstimeeq|abstimege|abstimegt|abstimein|abstimele|" + "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|" + "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|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|" + "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 = [ var sqlRules = [
{ {
token : "string", // single line string -- assume dollar strings if multi-line for now token : "string", // single line string -- assume dollar strings if multi-line for now
@ -406,16 +412,7 @@ var PgsqlHighlightRules = function() {
token : "constant.numeric", // float token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, { }, {
token : function(value) { token : keywordMapper,
value = value.toLowerCase();
if (keywords.hasOwnProperty(value)) {
return "keyword";
} else if (builtinFunctions.hasOwnProperty(value)) {
return "support.function";
} else {
return "identifier";
}
},
regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -43,8 +43,9 @@ var oop = require("../lib/oop");
var lang = require("../lib/lang"); var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var PhpHighlightRules = function() { var PhpLangHighlightRules = function() {
var docComment = DocCommentHighlightRules; var docComment = DocCommentHighlightRules;
// http://php.net/quickref.php // http://php.net/quickref.php
var builtinFunctions = lang.arrayToMap( var builtinFunctions = lang.arrayToMap(
@ -904,33 +905,6 @@ var PhpHighlightRules = function() {
this.$rules = { this.$rules = {
"start" : [ "start" : [
{
token : "support.php_tag", // php open tag
regex : "<\\?(?:php|\\=)"
},
{
token : "support.php_tag", // php close tag
regex : "\\?>"
},
{
token : "comment",
regex : "<\\!--",
next : "htmlcomment"
},
{
token : "meta.tag",
regex : "<style",
next : "css"
},
{
token : "meta.tag", // opening tag
regex : "<\\/?[-_a-zA-Z0-9:]+",
next : "htmltag"
},
{
token : 'meta.tag',
regex : '<\!DOCTYPE.*?>'
},
{ {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
@ -1063,95 +1037,6 @@ var PhpHighlightRules = function() {
token : "string", token : "string",
regex : ".+?" 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"
}
] ]
}; };
@ -1159,7 +1044,32 @@ var PhpHighlightRules = function() {
[ DocCommentHighlightRules.getEndRule("start") ]); [ 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); oop.inherits(PhpHighlightRules, TextHighlightRules);
exports.PhpHighlightRules = PhpHighlightRules; exports.PhpHighlightRules = PhpHighlightRules;
}); });

View file

@ -2,18 +2,17 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PowershellHighlightRules = function() { var PowershellHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("function|if|else|elseif|switch|while|default|for|do|until|break|continue|" + "function|if|else|elseif|switch|while|default|for|do|until|break|continue|" +
"foreach|return|filter|in|trap|throw|param|begin|process|end").split("|") "foreach|return|filter|in|trap|throw|param|begin|process|end"
); );
var builtinFunctions = lang.arrayToMap( var builtinFunctions = (
("Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" + "Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" +
"Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" + "Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" +
"Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" + "Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" +
"Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" + "Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" +
@ -53,7 +52,13 @@ var PowershellHighlightRules = function() {
"Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" + "Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" +
"Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" + "Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" +
"Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|" + "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|" + 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|" + "ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|" +
@ -90,14 +95,7 @@ var PowershellHighlightRules = function() {
token : "variable.instance", token : "variable.instance",
regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b" regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b"
}, { }, {
token : function(value) { token : keywordMapper,
if (keywords.hasOwnProperty(value))
return "keyword";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else
return "identifier";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"

View file

@ -43,35 +43,39 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PythonHighlightRules = function() { var PythonHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("and|as|assert|break|class|continue|def|del|elif|else|except|exec|" + "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|" + "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( var builtinConstants = (
("True|False|None|NotImplemented|Ellipsis|__debug__").split("|") "True|False|None|NotImplemented|Ellipsis|__debug__"
); );
var builtinFunctions = lang.arrayToMap( var builtinFunctions = (
("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" + "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
"eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" + "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
"binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" + "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
"float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" + "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
"chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" + "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
"cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" + "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
"__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" + "__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( //var futureReserved = "";
("").split("|") 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)?"; var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
@ -127,20 +131,7 @@ var PythonHighlightRules = function() {
token : "constant.numeric", // integer token : "constant.numeric", // integer
regex : integer + "\\b" regex : integer + "\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -40,13 +40,12 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var RubyHighlightRules = function() { var RubyHighlightRules = function() {
var builtinFunctions = lang.arrayToMap( var builtinFunctions = (
("abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" + "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_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_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_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
@ -75,25 +74,33 @@ var RubyHighlightRules = function() {
"filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" + "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|" + "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|" + "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( var keywords = (
("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" + "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|" + "__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("|") "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
); );
var buildinConstants = lang.arrayToMap( var buildinConstants = (
("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" + "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
"RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING").split("|") "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
); );
var builtinVariables = lang.arrayToMap( var builtinVariables = (
("\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" + "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
"$!|root_url|flash|session|cookies|params|request|response|logger").split("|") "$!|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. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -141,22 +148,7 @@ var RubyHighlightRules = function() {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -47,14 +47,11 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var scadHighlightRules = function() { var scadHighlightRules = function() {
var keywordMapper = this.createKeywordMapper({
var keywords = lang.arrayToMap( "variable.language": "this",
("module|if|else|for").split("|") "keyword": "module|if|else|for",
); "constant.language": "NULL",
}, "identifier");
var buildinConstants = lang.arrayToMap(
("NULL").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -98,16 +95,7 @@ var scadHighlightRules = function() {
token : "keyword", // pre-compiler directivs token : "keyword", // pre-compiler directivs
regex : "(?:use|include)" regex : "(?:use|include)"
}, { }, {
token : function(value) { token : keywordMapper,
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -2,27 +2,22 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ScalaHighlightRules = function() { var ScalaHighlightRules = function() {
// taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html // 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|" + "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|" + "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|" +
"override|package|private|protected|sealed|super|this|trait|type|val|var|with" "override|package|private|protected|sealed|super|this|trait|type|val|var|with"
).split("|")
); );
var buildinConstants = lang.arrayToMap( var buildinConstants = ("true|false");
("true|false").split("|")
);
var langClasses = lang.arrayToMap( var langClasses = (
("AbstractMethodError|AssertionError|ClassCircularityError|"+ "AbstractMethodError|AssertionError|ClassCircularityError|"+
"ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
"ExceptionInInitializerError|IllegalAccessError|"+ "ExceptionInInitializerError|IllegalAccessError|"+
"IllegalThreadStateException|InstantiationError|InternalError|"+ "IllegalThreadStateException|InstantiationError|InternalError|"+
@ -50,12 +45,16 @@ var ScalaHighlightRules = function() {
"Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" + "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" +
"Option|Array|Char|Byte|Short|Int|Long|Nothing" "Option|Array|Char|Byte|Short|Int|Long|Nothing"
).split("|")
); );
var importClasses = lang.arrayToMap( var keywordMapper = this.createKeywordMapper({
("").split("|") "variable.language": "this",
); "keyword": keywords,
"support.function": langClasses,
"constant.language": buildinConstants
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead. // regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -95,20 +94,7 @@ var ScalaHighlightRules = function() {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : "(?:true|false)\\b" regex : "(?:true|false)\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
// TODO: Unicode escape sequences // TODO: Unicode escape sequences
// TODO: Unicode identifiers // TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -41,21 +41,19 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ShHighlightRules = function() { var ShHighlightRules = function() {
var reservedKeywords = lang.arrayToMap( var reservedKeywords = (
('!|{|}|case|do|done|elif|else|'+ '!|{|}|case|do|done|elif|else|'+
'esac|fi|for|if|in|then|until|while|'+ 'esac|fi|for|if|in|then|until|while|'+
'&|;|export|local|read|typeset|unset|'+ '&|;|export|local|read|typeset|unset|'+
'elif|select|set' 'elif|select|set'
).split('|')
); );
var languageConstructs = lang.arrayToMap( var languageConstructs = (
('[|]|alias|bg|bind|break|builtin|'+ '[|]|alias|bg|bind|break|builtin|'+
'cd|command|compgen|complete|continue|'+ 'cd|command|compgen|complete|continue|'+
'dirs|disown|echo|enable|eval|exec|'+ 'dirs|disown|echo|enable|eval|exec|'+
'exit|fc|fg|getopts|hash|help|history|'+ 'exit|fc|fg|getopts|hash|help|history|'+
@ -63,9 +61,14 @@ var ShHighlightRules = function() {
'pwd|return|set|shift|shopt|source|'+ 'pwd|return|set|shift|shopt|source|'+
'suspend|test|times|trap|type|ulimit|'+ 'suspend|test|times|trap|type|ulimit|'+
'umask|unalias|wait' '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 = "(?:(?:[1-9]\\d*)|(?:0))";
// var integer = "(?:" + decimalInteger + ")"; // var integer = "(?:" + decimalInteger + ")";
@ -112,16 +115,7 @@ var ShHighlightRules = function() {
token : "constant.numeric", // integer token : "constant.numeric", // integer
regex : integer + "\\b" regex : integer + "\\b"
}, { }, {
token : function(value) { token : keywordMapper,
if (reservedKeywords.hasOwnProperty(value))
return "keyword";
else if (languageConstructs.hasOwnProperty(value))
return "constant.language";
else if (value == "debugger")
return "invalid.deprecated";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -22,24 +22,29 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var SqlHighlightRules = function() { var SqlHighlightRules = function() {
var keywords = lang.arrayToMap( var keywords = (
("select|from|where|and|or|group|by|order|limit|offset|having|as|case|" + "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("|") "when|else|end|type|left|right|join|on|outer|desc|asc"
); );
var builtinConstants = lang.arrayToMap( var builtinConstants = (
("true|false|null").split("|") "true|false|null"
); );
var builtinFunctions = lang.arrayToMap( var builtinFunctions = (
("count|min|max|avg|sum|rank|now|coalesce").split("|") "count|min|max|avg|sum|rank|now|coalesce"
); );
var keywordMapper = this.createKeywordMapper({
"support.function": builtinFunctions,
"keyword": keywords,
"constant.language": builtinConstants
}, "identifier", true);
this.$rules = { this.$rules = {
"start" : [ { "start" : [ {
token : "comment", token : "comment",
@ -54,17 +59,7 @@ var SqlHighlightRules = function() {
token : "constant.numeric", // float token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, { }, {
token : function(value) { token : keywordMapper,
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";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "keyword.operator", token : "keyword.operator",

View file

@ -39,15 +39,12 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var TclHighlightRules = function() { var TclHighlightRules = function() {
var builtinFunctions = lang.arrayToMap( //TODO var builtinFunctions = "";
("").split("|")
);
this.$rules = { this.$rules = {
"start" : [ "start" : [
{ {
@ -86,12 +83,7 @@ var TclHighlightRules = function() {
token : "support.function", token : "support.function",
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::" regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"
}, { }, {
token : function(value) { token : "identifier",
if (builtinFunctions.hasOwnProperty(value))
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token : "paren.lparen", token : "paren.lparen",

View file

@ -103,6 +103,19 @@ var TextHighlightRules = function() {
return this.$embeds; 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); }).call(TextHighlightRules.prototype);
exports.TextHighlightRules = TextHighlightRules; exports.TextHighlightRules = TextHighlightRules;

View file

@ -46,7 +46,7 @@ var TextileHighlightRules = function() {
"start" : [ "start" : [
{ {
token : function(value) { token : function(value) {
if (value.match(/^h\d$/)) if (value.charAt(0) == "h")
return "markup.heading." + value.charAt(1); return "markup.heading." + value.charAt(1);
else else
return "markup.heading"; return "markup.heading";

View file

@ -38,14 +38,13 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XQueryHighlightRules = function() { var XQueryHighlightRules = function() {
var keywords = lang.arrayToMap( var keywordMapper = this.createKeywordMapper({
("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("|") 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 // regexp must not have capturing parentheses
// regexps are ordered -> the first match is used // regexps are ordered -> the first match is used
@ -89,12 +88,7 @@ var XQueryHighlightRules = function() {
token: "support.function", token: "support.function",
regex: "\\w[\\w+_\\-:]+(?=\\()" regex: "\\w[\\w+_\\-:]+(?=\\()"
}, { }, {
token : function(value) { token : keywordMapper,
if (keywords[value])
return "keyword";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, { }, {
token: "keyword.operator", token: "keyword.operator",