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

View file

@ -41,93 +41,94 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var ClojureHighlightRules = function() {
var builtinFunctions = lang.arrayToMap(
('* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
'*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
'*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
'*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
'*read-eval* *source-path* *use-context-classloader* ' +
'*warn-on-reflection* + - -> -&gt; ->> -&gt;&gt; .. / < &lt; <= &lt;= = ' +
'== > &gt; >= &gt;= accessor aclone ' +
'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
'char-escape-string char-name-string char? chars chunk chunk-append ' +
'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
'class class? clear-agent-errors clojure-version coll? comment commute ' +
'comp comparator compare compare-and-set! compile complement concat cond ' +
'condp conj conj! cons constantly construct-proxy contains? count ' +
'counted? create-ns create-struct cycle dec decimal? declare definline ' +
'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
'double-array doubles drop drop-last drop-while empty empty? ensure ' +
'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
'find-doc find-ns find-var first float float-array float? floats flush ' +
'fn fn? fnext for force format future future-call future-cancel ' +
'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
'list* list? load load-file load-reader load-string loaded-libs locking ' +
'long long-array longs loop macroexpand macroexpand-1 make-array ' +
'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
'primitives-classnames print print-ctor print-doc print-dup print-method ' +
'print-namespace-doc print-simple print-special-doc print-str printf ' +
'println println-str prn prn-str promise proxy proxy-call-with-super ' +
'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
're-matcher re-matches re-pattern re-seq read read-line read-string ' +
'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
'refer refer-clojure release-pending-sends rem remove remove-method ' +
'remove-ns remove-watch repeat repeatedly replace replicate require ' +
'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
'rsubseq second select-keys send send-off seq seq? seque sequence ' +
'sequential? set set-validator! set? short short-array shorts ' +
'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
'split-at split-with str stream? string? struct struct-map subs subseq ' +
'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
'unchecked-remainder unchecked-subtract underive unquote ' +
'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
'var? vary-meta vec vector vector? when when-first when-let when-not ' +
'while with-bindings with-bindings* with-in-str with-loading-context ' +
'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
'zero? zipmap ').split(" ")
var builtinFunctions = (
'* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
'*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
'*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
'*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
'*read-eval* *source-path* *use-context-classloader* ' +
'*warn-on-reflection* + - -> ->> .. / < <= = ' +
'== > &gt; >= &gt;= accessor aclone ' +
'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
'char-escape-string char-name-string char? chars chunk chunk-append ' +
'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
'class class? clear-agent-errors clojure-version coll? comment commute ' +
'comp comparator compare compare-and-set! compile complement concat cond ' +
'condp conj conj! cons constantly construct-proxy contains? count ' +
'counted? create-ns create-struct cycle dec decimal? declare definline ' +
'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
'double-array doubles drop drop-last drop-while empty empty? ensure ' +
'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
'find-doc find-ns find-var first float float-array float? floats flush ' +
'fn fn? fnext for force format future future-call future-cancel ' +
'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
'list* list? load load-file load-reader load-string loaded-libs locking ' +
'long long-array longs loop macroexpand macroexpand-1 make-array ' +
'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
'primitives-classnames print print-ctor print-doc print-dup print-method ' +
'print-namespace-doc print-simple print-special-doc print-str printf ' +
'println println-str prn prn-str promise proxy proxy-call-with-super ' +
'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
're-matcher re-matches re-pattern re-seq read read-line read-string ' +
'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
'refer refer-clojure release-pending-sends rem remove remove-method ' +
'remove-ns remove-watch repeat repeatedly replace replicate require ' +
'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
'rsubseq second select-keys send send-off seq seq? seque sequence ' +
'sequential? set set-validator! set? short short-array shorts ' +
'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
'split-at split-with str stream? string? struct struct-map subs subseq ' +
'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
'unchecked-remainder unchecked-subtract underive unquote ' +
'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
'var? vary-meta vec vector vector? when when-first when-let when-not ' +
'while with-bindings with-bindings* with-in-str with-loading-context ' +
'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
'zero? zipmap'
);
var keywords = lang.arrayToMap(
('def do fn if let loop monitor-enter monitor-exit new quote recur set! ' +
'throw try var').split(" ")
var keywords = ('throw try var ' +
'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
);
var buildinConstants = lang.arrayToMap(
("true false nil").split(" ")
);
var buildinConstants = ("true false nil");
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"constant.language": buildinConstants,
"support.function": builtinFunctions
}, "identifier", false, " ");
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -175,16 +176,7 @@ var ClojureHighlightRules = function() {
token : "constant.language",
regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
}, {
token : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else
return "identifier";
},
token : keywordMapper,
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

@ -38,10 +38,9 @@
define(function(require, exports, module) {
"use strict";
var lang = require("../lib/lang");
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
oop.inherits(CoffeeHighlightRules, TextHighlightRules);
function CoffeeHighlightRules() {
@ -52,34 +51,41 @@ define(function(require, exports, module) {
regex : ".+"
};
var keywords = lang.arrayToMap((
var keywords = (
"this|throw|then|try|typeof|super|switch|return|break|by)|continue|" +
"catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
"or|on|unless|until|and|yes").split("|")
"or|on|unless|until|and|yes"
);
var langConstant = lang.arrayToMap((
"true|false|null|undefined").split("|")
var langConstant = (
"true|false|null|undefined"
);
var illegal = lang.arrayToMap((
var illegal = (
"case|const|default|function|var|void|with|enum|export|implements|" +
"interface|let|package|private|protected|public|static|yield|" +
"__hasProp|extends|slice|bind|indexOf").split("|")
"__hasProp|extends|slice|bind|indexOf"
);
var supportClass = lang.arrayToMap((
var supportClass = (
"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|" +
"RangeError|String|SyntaxError|Error|EvalError|TypeError|URIError").split("|")
"String|RangeError|SyntaxError|Error|EvalError|TypeError|URIError"
);
var supportFunction = lang.arrayToMap((
var supportFunction = (
"Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
"encodeURIComponent|decodeURI|decodeURIComponent|RangeError|String|" +
"SyntaxError|Error|EvalError|TypeError|URIError").split("|")
"encodeURIComponent|decodeURI|decodeURIComponent|String|"
);
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"constant.language": langConstant,
"invalid.illegal": illegal,
"language.support.class": supportClass,
"language.support.function": supportFunction,
}, "identifier");
this.$rules = {
start : [
{
@ -89,20 +95,7 @@ define(function(require, exports, module) {
token : "variable",
regex : "@(?:" + identifier + ")?"
}, {
token: function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (langConstant.hasOwnProperty(value))
return "constant.language";
else if (illegal.hasOwnProperty(value))
return "invalid.illegal";
else if (supportClass.hasOwnProperty(value))
return "language.support.class";
else if (supportFunction.hasOwnProperty(value))
return "language.support.function";
else
return "identifier";
},
token: keywordMapper,
regex : identifier
}, {
token : "constant.numeric",
@ -164,40 +157,40 @@ define(function(require, exports, module) {
token : "text",
regex : "\\s+"
}],
qdoc : [{
token : "string",
regex : ".*?'''",
next : "start"
}, stringfill],
qqdoc : [{
token : "string",
regex : '.*?"""',
next : "start"
}, stringfill],
qstring : [{
token : "string",
regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
merge : true,
next : "start"
}, stringfill],
qqstring : [{
token : "string",
regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
merge : true,
next : "start"
}, stringfill],
js : [{
token : "string",
merge : true,
regex : "[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",
next : "start"
}, stringfill],
heregex : [{
token : "string.regex",
regex : '.*?///[imgy]{0,4}',
@ -210,7 +203,7 @@ define(function(require, exports, module) {
merge : true,
regex : "\\S+"
}],
comment : [{
token : "comment",
regex : '.*?###',

View file

@ -2,20 +2,15 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CSharpHighlightRules = function() {
var keywords = lang.arrayToMap(
("abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic").split("|")
);
var buildinConstants = lang.arrayToMap(
("null|true|false").split("|")
);
var keywordMapper = this.createKeywordMapper({
"variable.language": "this",
"keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic",
"constant.language": "null|true|false"
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -51,16 +46,7 @@ var CSharpHighlightRules = function() {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
}, {
token : function(value) {
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
},
token : keywordMapper,
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
@ -93,7 +79,7 @@ var CSharpHighlightRules = function() {
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
};

View file

@ -43,37 +43,21 @@ var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CssHighlightRules = function() {
var keywordMapper = this.createKeywordMapper({
"support.type": "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index",
"support.function": "rgb|rgba|url|attr|counter|counters",
"support.constant": "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero",
"support.constant.color": "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow",
"support.constant.fonts": "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace"
}, "text", true);
var properties = lang.arrayToMap(
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
);
var functions = lang.arrayToMap(
("rgb|rgba|url|attr|counter|counters").split("|")
);
var constants = lang.arrayToMap(
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
);
var colors = lang.arrayToMap(
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
"purple|red|silver|teal|white|yellow").split("|")
);
var fonts = lang.arrayToMap(
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
"serif|monospace").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
var base_ruleset = [
{
token : "comment", // multi line comment
@ -99,34 +83,15 @@ var CssHighlightRules = function() {
token : "constant.numeric", // hex3 color
regex : "#[a-f0-9]{3}"
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
regex : pseudoElements
}, {
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
regex : pseudoClasses
}, {
token : function(value) {
if (properties.hasOwnProperty(value.toLowerCase())) {
return "support.type";
}
else if (functions.hasOwnProperty(value.toLowerCase())) {
return "support.function";
}
else if (constants.hasOwnProperty(value.toLowerCase())) {
return "support.constant";
}
else if (colors.hasOwnProperty(value.toLowerCase())) {
return "support.constant.color";
}
else if (fonts.hasOwnProperty(value.toLowerCase())) {
return "support.constant.fonts";
}
else {
return "text";
}
},
token : keywordMapper,
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
}
}
];
var ruleset = lang.copyArray(base_ruleset);

View file

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

View file

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

View file

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

View file

@ -2,20 +2,25 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var HaxeHighlightRules = function() {
var keywords = lang.arrayToMap(
("break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std").split("|")
var keywords = (
"break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std"
);
var buildinConstants = lang.arrayToMap(
("null|true|false").split("|")
var buildinConstants = (
"null|true|false"
);
var keywordMapper = this.createKeywordMapper({
"variable.language": "this",
"keyword": keywords,
"constant.language": buildinConstants
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -51,16 +56,7 @@ var HaxeHighlightRules = function() {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
}, {
token : function(value) {
if (value == "this")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else
return "identifier";
},
token : keywordMapper,
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

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

View file

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

View file

@ -41,157 +41,149 @@ define(function(require, exports, module) {
var oop = require("../lib/oop");
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
var lang = require("../lib/lang");
var xmlUtil = require("./xml_util");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LiquidHighlightRules = function() {
// see: https://developer.mozilla.org/en/Liquid/Reference/Global_Objects
var functions = lang.arrayToMap(
var functions = (
// Standard Filters
("date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" +
"date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" +
"escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" +
"truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split"
).split("|")
);
var keywords = lang.arrayToMap(
var keywords = (
// Standard Tags
("capture|endcapture|case|endcase|when|comment|endcomment|" +
"capture|endcapture|case|endcase|when|comment|endcomment|" +
"cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" +
// Commonly used tags
"style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow").split("|")
// Commonly used tags
"style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow"
);
var builtinVariables = lang.arrayToMap(
['forloop']
// ("forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" +
var builtinVariables = 'forloop|tablerowloop';
// "forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" +
// "tablerowloop\\.(length|index|index0|rindex|rindex0|first|last|col|col0|"+
// "col_first|col_last)").split("|")
);
// "col_first|col_last)"
var definitions = lang.arrayToMap(("assign").split("|"));
var definitions = ("assign");
var keywordMapper = this.createKeywordMapper({
"variable.language": builtinVariables,
"keyword": keywords,
"support.function": functions,
"keyword.definition": definitions
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
start : [{
token : "variable",
regex : "{%",
next : "liquid_start"
}, {
token : "variable",
regex : "{{",
next : "liquid_start"
}, {
token : "meta.tag",
merge : true,
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "meta.tag",
regex : "<(?=\\s*script\\b)",
next : "script"
}, {
token : "meta.tag",
regex : "<(?=\\s*style\\b)",
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
next : "tag"
}, {
token : "text",
regex : "\\s+"
}, {
token : "text",
regex : "[^<]+"
} ],
start : [{
token : "variable",
regex : "{%",
next : "liquid_start"
}, {
token : "variable",
regex : "{{",
next : "liquid_start"
}, {
token : "meta.tag",
merge : true,
regex : "<\\!\\[CDATA\\[",
next : "cdata"
}, {
token : "xml_pe",
regex : "<\\?.*?\\?>"
}, {
token : "comment",
merge : true,
regex : "<\\!--",
next : "comment"
}, {
token : "meta.tag",
regex : "<(?=\\s*script\\b)",
next : "script"
}, {
token : "meta.tag",
regex : "<(?=\\s*style\\b)",
next : "style"
}, {
token : "meta.tag", // opening tag
regex : "<\\/?",
next : "tag"
}, {
token : "text",
regex : "\\s+"
}, {
token : "text",
regex : "[^<]+"
} ],
cdata : [ {
token : "text",
regex : "\\]\\]>",
next : "start"
}, {
token : "text",
merge : true,
regex : "\\s+"
}, {
token : "text",
merge : true,
regex : ".+"
} ],
cdata : [ {
token : "text",
regex : "\\]\\]>",
next : "start"
}, {
token : "text",
merge : true,
regex : "\\s+"
}, {
token : "text",
merge : true,
regex : ".+"
} ],
comment : [ {
token : "comment",
regex : ".*?-->",
next : "start"
}, {
token : "comment",
merge : true,
regex : ".+"
} ] ,
comment : [ {
token : "comment",
regex : ".*?-->",
next : "start"
}, {
token : "comment",
merge : true,
regex : ".+"
} ] ,
liquid_start : [{
token: "variable",
regex: "}}",
next: "start"
}, {
token: "variable",
regex: "%}",
next: "start"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
}, {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
}, {
token : function(value) {
if (functions.hasOwnProperty(value))
return "support.function";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (builtinVariables.hasOwnProperty(value))
return "variable.language";
else if (definitions.hasOwnProperty(value))
return "keyword.definition";
else
return "identifier";
},
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",
regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
}, {
token : "paren.lparen",
regex : /[\[\({]/
}, {
token : "paren.rparen",
regex : /[\])}]/
}, {
token : "text",
regex : "\\s+"
}]
liquid_start : [{
token: "variable",
regex: "}}",
next: "start"
}, {
token: "variable",
regex: "%}",
next: "start"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
}, {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
}, {
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",
regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
}, {
token : "paren.lparen",
regex : /[\[\({]/
}, {
token : "paren.rparen",
regex : /[\])}]/
}, {
token : "text",
regex : "\\s+"
}]
};
xmlUtil.tag(this.$rules, "tag", "start");

View file

@ -41,22 +41,20 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var LuaHighlightRules = function() {
var keywords = lang.arrayToMap(
("break|do|else|elseif|end|for|function|if|in|local|repeat|"+
"return|then|until|while|or|and|not").split("|")
var keywords = (
"break|do|else|elseif|end|for|function|if|in|local|repeat|"+
"return|then|until|while|or|and|not"
);
var builtinConstants = lang.arrayToMap(
("true|false|nil|_G|_VERSION").split("|")
);
var builtinConstants = ("true|false|nil|_G|_VERSION");
var builtinFunctions = lang.arrayToMap(
("string|xpcall|package|tostring|print|os|unpack|require|"+
var functions = (
// builtinFunctions
"string|xpcall|package|tostring|print|os|unpack|require|"+
"getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+
"collectgarbage|getmetatable|module|rawset|math|debug|"+
"pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+
@ -75,25 +73,27 @@ var LuaHighlightRules = function() {
"gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+
"setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+
"foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+
"status|wrap|create|running").split("|")
);
var stdLibaries = lang.arrayToMap(
("string|package|os|io|math|debug|table|coroutine").split("|")
);
var metatableMethods = lang.arrayToMap(
("__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
"__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber").split("|")
"status|wrap|create|running|"+
// metatableMethods
"__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
"__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber"
);
var futureReserved = lang.arrayToMap(
("").split("|")
);
var deprecatedIn5152 = lang.arrayToMap(
("setn|foreach|foreachi|gcinfo|log10|maxn").split("|")
);
var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
var futureReserved = "";
var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"support.function": functions,
"invalid.deprecated": deprecatedIn5152,
"constant.library": stdLibaries,
"constant.language": builtinConstants,
"invalid.illegal": futureReserved,
"variable.language": "this"
}, "identifier");
var strPre = "";
@ -105,13 +105,13 @@ var LuaHighlightRules = function() {
var intPart = "(?:\\d+)";
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
var floatNumber = "(?:" + pointFloat + ")";
var comment_stack = [];
this.$rules = {
"start" :
var comment_stack = [];
this.$rules = {
"start" :
// bracketed comments
[{
token : "comment", // --[[ comment
@ -132,7 +132,7 @@ var LuaHighlightRules = function() {
token : "comment", // --[====+[ comment
regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
},
// multiline bracketed comments
{
token : "comment", // --[[ comment
@ -169,20 +169,20 @@ var LuaHighlightRules = function() {
// you can never be too paranoid ;)
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined)
comment_stack.push(match.length);
return "comment";
},
regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*$',
merge : true,
next : "qcomment5"
},
// single line comments
{
token : "comment",
regex : "\\-\\-.*$"
},
},
// bracketed strings
{
token : "string", // [[ string
@ -203,7 +203,7 @@ var LuaHighlightRules = function() {
token : "string", // [====+[ string
regex : strPre + '\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
},
// multiline bracketed strings
{
token : "string", // [[ string
@ -236,14 +236,14 @@ var LuaHighlightRules = function() {
var pattern = /\[(\=+)\[/, match;
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined)
comment_stack.push(match.length);
return "string";
},
regex : strPre + '\\[\\={5}\\=*\\[.*$',
merge : true,
next : "qstring5"
},
},
{
token : "string", // " string
regex : strPre + '"(?:[^\\\\]|\\\\.)*?"'
@ -257,24 +257,7 @@ var LuaHighlightRules = function() {
token : "constant.numeric", // integer
regex : integer + "\\b"
}, {
token : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (builtinConstants.hasOwnProperty(value))
return "constant.language";
else if (futureReserved.hasOwnProperty(value))
return "invalid.illegal";
else if (stdLibaries.hasOwnProperty(value))
return "constant.library";
else if (deprecatedIn5152.hasOwnProperty(value))
return "invalid.deprecated";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else if (metatableMethods.hasOwnProperty(value))
return "support.function";
else
return "identifier";
},
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",
@ -289,7 +272,7 @@ var LuaHighlightRules = function() {
token : "text",
regex : "\\s+"
} ],
"qcomment": [ {
token : "comment",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\]",
@ -336,7 +319,7 @@ var LuaHighlightRules = function() {
regex : '.+'
} ],
"qcomment5": [ {
token : function(value){
token : function(value){
// very hackish, mutates the qcomment5 field on the fly.
var pattern = /\](\=+)\]/, rule = this.rules.qcomment5[0], match;
rule.next = "start";
@ -347,7 +330,7 @@ var LuaHighlightRules = function() {
rule.next = "qcomment5";
}
}
return "comment";
},
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]",
@ -357,7 +340,7 @@ var LuaHighlightRules = function() {
merge : true,
regex : '.+'
} ],
"qstring": [ {
token : "string",
regex : "(?:[^\\\\]|\\\\.)*?\\]\\]",
@ -404,7 +387,7 @@ var LuaHighlightRules = function() {
regex : '.+'
} ],
"qstring5": [ {
token : function(value){
token : function(value){
// very hackish, mutates the qstring5 field on the fly.
var pattern = /\](\=+)\]/, rule = this.rules.qstring5[0], match;
rule.next = "start";
@ -415,7 +398,7 @@ var LuaHighlightRules = function() {
rule.next = "qstring5";
}
}
return "string";
},
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]",
@ -425,7 +408,7 @@ var LuaHighlightRules = function() {
merge : true,
regex : '.+'
} ]
};
}

View file

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

View file

@ -39,22 +39,19 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PerlHighlightRules = function() {
var keywords = lang.arrayToMap(
("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
"no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars").split("|")
var keywords = (
"base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
"no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
);
var buildinConstants = lang.arrayToMap(
("ARGV|ENV|INC|SIG").split("|")
);
var buildinConstants = ("ARGV|ENV|INC|SIG");
var builtinFunctions = lang.arrayToMap(
("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
var builtinFunctions = (
"getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
"gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
"getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
"endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
@ -75,9 +72,15 @@ var PerlHighlightRules = function() {
"join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
"keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
"eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
"map|die|uc|lc|do").split("|")
"map|die|uc|lc|do"
);
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"constant.language": buildinConstants,
"support.function": builtinFunctions
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -112,16 +115,7 @@ var PerlHighlightRules = function() {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else
return "identifier";
},
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",

View file

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

View file

@ -23,8 +23,8 @@
define(function(require, exports, module) {
var oop = require("ace/lib/oop");
var lang = require("ace/lib/lang");
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
// Supporting perl and python for now -- both in pg core and ace
@ -32,10 +32,10 @@ var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules;
var PgsqlHighlightRules = function() {
// Keywords, functions, operators last updated for pg 9.1.
var keywords = lang.arrayToMap(
("abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" +
var keywords = (
"abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" +
"analyse|analyze|and|any|anyarray|anyelement|anyenum|anynonarray|array|as|asc|assertion|" +
"assignment|asymmetric|at|attribute|authorization|backward|before|begin|between|bigint|" +
"binary|bit|bool|boolean|both|box|bpchar|by|bytea|cache|called|cascade|cascaded|case|cast|" +
@ -74,12 +74,12 @@ var PgsqlHighlightRules = function() {
"unlogged|until|update|user|using|uuid|vacuum|valid|validate|validator|value|values|varbit|" +
"varchar|variadic|varying|verbose|version|view|void|volatile|when|where|whitespace|window|" +
"with|without|work|wrapper|write|xid|xml|xmlattributes|xmlconcat|xmlelement|xmlexists|" +
"xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone").split("|")
"xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone"
);
var builtinFunctions = lang.arrayToMap(
("RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" +
var builtinFunctions = (
"RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" +
"RI_FKey_noaction_del|RI_FKey_noaction_upd|RI_FKey_restrict_del|RI_FKey_restrict_upd|" +
"RI_FKey_setdefault_del|RI_FKey_setdefault_upd|RI_FKey_setnull_del|" +
"RI_FKey_setnull_upd|abbrev|abs|abstime|abstimeeq|abstimege|abstimegt|abstimein|abstimele|" +
@ -392,9 +392,15 @@ var PgsqlHighlightRules = function() {
"win866_to_mic|win866_to_win1251|win_to_utf8|xideq|xideqint4|xidin|xidout|xidrecv|xidsend|" +
"xml|xml_in|xml_is_well_formed|xml_is_well_formed_content|xml_is_well_formed_document|" +
"xml_out|xml_recv|xml_send|xmlagg|xmlcomment|xmlconcat2|xmlexists|xmlvalidate|xpath|" +
"xpath_exists").split("|")
"xpath_exists"
);
var keywordMapper = this.createKeywordMapper({
"support.function": builtinFunctions,
"keyword": keywords,
}, "identifier", true);
var sqlRules = [
{
token : "string", // single line string -- assume dollar strings if multi-line for now
@ -406,16 +412,7 @@ var PgsqlHighlightRules = function() {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : function(value) {
value = value.toLowerCase();
if (keywords.hasOwnProperty(value)) {
return "keyword";
} else if (builtinFunctions.hasOwnProperty(value)) {
return "support.function";
} else {
return "identifier";
}
},
token : keywordMapper,
regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers
}, {
token : "keyword.operator",
@ -434,14 +431,14 @@ var PgsqlHighlightRules = function() {
regex : "\\s+"
}
];
this.$rules = {
"start" : [
{
token : "comment",
regex : "--.*$"
},
},
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi-line comment
@ -457,7 +454,7 @@ var PgsqlHighlightRules = function() {
regex : "^\\\\[\\S]+.*$"
}
],
"statement" : [
{
token : "comment",
@ -489,7 +486,7 @@ var PgsqlHighlightRules = function() {
next : "dollarStatementString"
}
].concat(sqlRules),
"dollarSql" : [
{
token : "comment",
@ -509,7 +506,7 @@ var PgsqlHighlightRules = function() {
next : "dollarSqlString"
}
].concat(sqlRules),
"comment" : [
{
token : "comment", // closing comment
@ -521,7 +518,7 @@ var PgsqlHighlightRules = function() {
regex : ".+"
}
],
"commentStatement" : [
{
token : "comment", // closing comment
@ -533,7 +530,7 @@ var PgsqlHighlightRules = function() {
regex : ".+"
}
],
"commentDollarSql" : [
{
token : "comment", // closing comment
@ -545,7 +542,7 @@ var PgsqlHighlightRules = function() {
regex : ".+"
}
],
"dollarStatementString" : [
{
token : "string", // closing dollarstring
@ -557,7 +554,7 @@ var PgsqlHighlightRules = function() {
regex : ".+"
}
],
"dollarSqlString" : [
{
token : "string", // closing dollarstring
@ -570,7 +567,7 @@ var PgsqlHighlightRules = function() {
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);

View file

@ -43,8 +43,9 @@ var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var PhpHighlightRules = function() {
var PhpLangHighlightRules = function() {
var docComment = DocCommentHighlightRules;
// http://php.net/quickref.php
var builtinFunctions = lang.arrayToMap(
@ -904,33 +905,6 @@ var PhpHighlightRules = function() {
this.$rules = {
"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",
regex : "\\/\\/.*$"
@ -1063,103 +1037,39 @@ var PhpHighlightRules = function() {
token : "string",
regex : ".+?"
}
],
"htmlcomment" : [
{
token : "comment",
regex : ".*?-->",
next : "start"
}, {
token : "comment",
regex : ".+"
}
],
"htmltag" : [
{
token : "meta.tag",
regex : ">",
next : "start"
}, {
token : "text",
regex : "[-_a-zA-Z0-9:]+"
}, {
token : "text",
regex : "\\s+"
}, {
token : "string",
regex : '".*?"'
}, {
token : "string",
regex : "'.*?'"
}
],
"css" : [
{
token : "meta.tag",
regex : "<\/style>",
next : "htmltag"
}, {
token : "meta.tag",
regex : ">"
}, {
token : 'text',
regex : "(?:media|type|href)"
}, {
token : 'string',
regex : '=".*?"'
}, {
token : "paren.lparen",
regex : "\{",
next : "cssdeclaration"
}, {
token : "keyword",
regex : "#[A-Za-z0-9\-\_\.]+"
}, {
token : "variable",
regex : "\\.[A-Za-z0-9\-\_\.]+"
}, {
token : "constant",
regex : "[A-Za-z0-9]+"
}
],
"cssdeclaration" : [
{
token : "support.type",
regex : "[\-a-zA-Z]+",
next : "cssvalue"
},
{
token : "paren.rparen",
regex : '\}',
next : "css"
}
],
"cssvalue" : [
{
token : "text",
regex : "\:"
},
{
token : "constant",
regex : "#[0-9a-zA-Z]+"
},
{
token : "text",
regex : "[\-\_0-9a-zA-Z\"' ,%]+"
},
{
token : "text",
regex : ";",
next : "cssdeclaration"
}
]
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(PhpLangHighlightRules, TextHighlightRules);
var PhpHighlightRules = function() {
this.$rules = new HtmlHighlightRules().getRules();
for (var i in this.$rules) {
this.$rules[i].unshift({
token : "support.php_tag", // php open tag
regex : "<\\?(?:php|\\=)",
next : "php-start"
});
}
this.embedRules(PhpLangHighlightRules, "php-");
this.$rules["php-start"].unshift({
token : "support.php_tag", // php close tag
regex : "\\?>",
next : "start"
});
};
oop.inherits(PhpHighlightRules, TextHighlightRules);
exports.PhpHighlightRules = PhpHighlightRules;
});

View file

@ -2,18 +2,17 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PowershellHighlightRules = function() {
var keywords = lang.arrayToMap(
("function|if|else|elseif|switch|while|default|for|do|until|break|continue|" +
"foreach|return|filter|in|trap|throw|param|begin|process|end").split("|")
var keywords = (
"function|if|else|elseif|switch|while|default|for|do|until|break|continue|" +
"foreach|return|filter|in|trap|throw|param|begin|process|end"
);
var builtinFunctions = lang.arrayToMap(
("Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" +
var builtinFunctions = (
"Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" +
"Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" +
"Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" +
"Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" +
@ -53,12 +52,18 @@ var PowershellHighlightRules = function() {
"Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" +
"Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" +
"Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|" +
"Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption").split("|"));
"Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption"
);
var keywordMapper = this.createKeywordMapper({
"support.function": builtinFunctions,
"keyword": keywords
}, "identifier");
var binaryOperatorsRe = "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace|contains|notcontains|" +
"ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|" +
"is|isnot|as|" +
"and|or|band|bor|not";
"and|or|band|bor|not";
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -90,14 +95,7 @@ var PowershellHighlightRules = function() {
token : "variable.instance",
regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b"
}, {
token : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else
return "identifier";
},
token : keywordMapper,
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"

View file

@ -43,35 +43,39 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PythonHighlightRules = function() {
var keywords = lang.arrayToMap(
("and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
var keywords = (
"and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
"finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
"raise|return|try|while|with|yield").split("|")
"raise|return|try|while|with|yield"
);
var builtinConstants = lang.arrayToMap(
("True|False|None|NotImplemented|Ellipsis|__debug__").split("|")
var builtinConstants = (
"True|False|None|NotImplemented|Ellipsis|__debug__"
);
var builtinFunctions = lang.arrayToMap(
("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
var builtinFunctions = (
"abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
"eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
"binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
"float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
"chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
"cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
"__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
"buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern").split("|")
"buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
);
var futureReserved = lang.arrayToMap(
("").split("|")
);
//var futureReserved = "";
var keywordMapper = this.createKeywordMapper({
"invalid.deprecated": "debugger",
"support.function": builtinFunctions,
//"invalid.illegal": futureReserved,
"constant.language": builtinConstants,
"keyword": keywords
}, "identifier");
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
@ -127,20 +131,7 @@ var PythonHighlightRules = function() {
token : "constant.numeric", // integer
regex : integer + "\\b"
}, {
token : function(value) {
if (keywords.hasOwnProperty(value))
return "keyword";
else if (builtinConstants.hasOwnProperty(value))
return "constant.language";
else if (futureReserved.hasOwnProperty(value))
return "invalid.illegal";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else if (value == "debugger")
return "invalid.deprecated";
else
return "identifier";
},
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "keyword.operator",

View file

@ -40,14 +40,13 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var RubyHighlightRules = function() {
var builtinFunctions = lang.arrayToMap(
("abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
"assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
var builtinFunctions = (
"abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
"assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
"assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
"assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
"assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
@ -75,25 +74,33 @@ var RubyHighlightRules = function() {
"filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
"translate|localize|extract_locale_from_tld|t|l|caches_page|expire_page|caches_action|expire_action|" +
"cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
"has_many|has_one|belongs_to|has_and_belongs_to_many").split("|")
"has_many|has_one|belongs_to|has_and_belongs_to_many"
);
var keywords = lang.arrayToMap(
("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
"__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
"redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield").split("|")
var keywords = (
"alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
"__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
"redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
);
var buildinConstants = lang.arrayToMap(
("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
"RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING").split("|")
var buildinConstants = (
"true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
"RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
);
var builtinVariables = lang.arrayToMap(
("\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
"$!|root_url|flash|session|cookies|params|request|response|logger").split("|")
var builtinVariables = (
"\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
"$!|root_url|flash|session|cookies|params|request|response|logger|self"
);
var keywordMapper = this.createKeywordMapper({
"keyword": keywords,
"constant.language": buildinConstants,
"variable.language": builtinVariables,
"support.function": builtinFunctions,
"invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
}, "identifier");
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
@ -141,22 +148,7 @@ var RubyHighlightRules = function() {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
}, {
token : function(value) {
if (value == "self")
return "variable.language";
else if (keywords.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else if (builtinVariables.hasOwnProperty(value))
return "variable.language";
else if (builtinFunctions.hasOwnProperty(value))
return "support.function";
else if (value == "debugger")
return "invalid.deprecated";
else
return "identifier";
},
token : keywordMapper,
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -74,7 +74,7 @@ var TextHighlightRules = function() {
this.getRules = function() {
return this.$rules;
};
this.embedRules = function (HighlightRules, prefix, escapeRules, states) {
var embedRules = new HighlightRules().getRules();
if (states) {
@ -88,21 +88,34 @@ var TextHighlightRules = function() {
}
}
this.addRules(embedRules, prefix);
for (var i = 0; i < states.length; i++) {
Array.prototype.unshift.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
}
if (!this.$embeds) {
this.$embeds = [];
}
this.$embeds.push(prefix);
}
this.getEmbeds = function() {
return this.$embeds;
}
this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
var keywords = Object.create(null);
Object.keys(map).forEach(function(className) {
var list = map[className].split(splitChar || "|");
for (var i = list.length; i--; )
keywords[list[i]] = className;
});
map = null;
return ignoreCase
? function(value) {return keywords[value.toLowerCase()] || defaultToken }
: function(value) {return keywords[value] || defaultToken };
}
}).call(TextHighlightRules.prototype);
exports.TextHighlightRules = TextHighlightRules;

View file

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

View file

@ -38,15 +38,14 @@ define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XQueryHighlightRules = function() {
var keywords = lang.arrayToMap(
("after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning").split("|")
);
var keywordMapper = this.createKeywordMapper({
keyword: "after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning"
}, "identifier");
// regexp must not have capturing parentheses
// regexps are ordered -> the first match is used
@ -89,12 +88,7 @@ var XQueryHighlightRules = function() {
token: "support.function",
regex: "\\w[\\w+_\\-:]+(?=\\()"
}, {
token : function(value) {
if (keywords[value])
return "keyword";
else
return "identifier";
},
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token: "keyword.operator",