Save everything in case computer melts

This commit is contained in:
Garen Torikian 2012-09-08 19:37:24 -07:00 • committed by nightwing
commit ff2ac65b2b
55 changed files with 2437 additions and 1289 deletions

View file

@ -1,513 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>jade</string>
</array>
<key>keyEquivalent</key>
<string>^~J</string>
<key>name</key>
<string>Jade</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.control.import.include.jade</string>
</dict>
</dict>
<key>match</key>
<string>^\s*\b(include)\b</string>
</dict>
<dict>
<key>match</key>
<string>^(!!!)(\s*[a-zA-Z0-9-_]+)?</string>
<key>name</key>
<string>keyword.other.doctype.jade</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.section.comment.jade</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(//-?)(?:\s*[^-\s]|\s+\S).*$\n?</string>
<key>name</key>
<string>comment.line.double-slash.jade</string>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(//-?)\s*$</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.section.comment.jade</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1\s+|$)</string>
<key>name</key>
<string>comment.block.jade</string>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(\:markdown)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1\s+)</string>
<key>name</key>
<string>meta.filter.markdown.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>text.html.markdown</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(\:sass)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1\s+)</string>
<key>name</key>
<string>meta.filter.sass.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.sass</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(\:less)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1\s+)</string>
<key>name</key>
<string>meta.filter.less.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.css.less</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(\:coffeescript)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1\s+)(?=\s*.)</string>
<key>name</key>
<string>meta.filter.coffee.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.coffee</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(\:cdata)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
</dict>
</dict>
<key>end</key>
<string>^(?!\1\s+)</string>
<key>name</key>
<string>meta.filter.cdata.jade</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function.jade</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.parameters.begin.jade</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>variable.parameter.function.jade</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>punctuation.definition.parameters.end.jade</string>
</dict>
</dict>
<key>comment</key>
<string>match stuff like: mixin dialog-title-desc(title, desc)</string>
<key>match</key>
<string>^\s*(mixin) ([\w\-]+)\s*(\()(.*?)(\))</string>
<key>name</key>
<string>meta.mixin.jade</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.function.jade</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.jade</string>
</dict>
</dict>
<key>comment</key>
<string>match stuff like: mixin dialog-title-desc</string>
<key>match</key>
<string>^\s*(mixin) ([\w\-]+)</string>
<key>name</key>
<string>meta.mixin.jade</string>
</dict>
<dict>
<key>begin</key>
<string>^\s*(-|=|!=)</string>
<key>end</key>
<string>$</string>
<key>name</key>
<string>source.js.embedded.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
<dict>
<key>match</key>
<string>\b(each)\b</string>
<key>name</key>
<string>keyword.control.js</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>^(\s*)(script)</string>
<key>beginCaptures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.script.jade</string>
</dict>
</dict>
<key>end</key>
<string>^((?=(\1)([\w#\.]|$\n?))|^$\n?)</string>
<key>name</key>
<string>source.js.embedded.jade</string>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>(?&lt;=script)\s*\(</string>
<key>end</key>
<string>\)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
</array>
</dict>
<dict>
<key>include</key>
<string>source.js</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>[#!]\{[^\}]+\}</string>
<key>name</key>
<string>string.interpolated.jade</string>
</dict>
<dict>
<key>begin</key>
<string>^\s*(?!\w+\:)(?:(([\w]+))|(?=\.|#))</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>meta.tag.any.jade</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.tag.jade</string>
</dict>
</dict>
<key>comment</key>
<string>Match any tag, id or class. skip AST filters</string>
<key>end</key>
<string>$|(?!\.|#|=|-)</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\.[\w-]+</string>
<key>name</key>
<string>meta.tag.attribute.class.jade</string>
</dict>
<dict>
<key>match</key>
<string>#[\w-]+</string>
<key>name</key>
<string>meta.tag.attribute.id.jade</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;=\w)\s*\(</string>
<key>end</key>
<string>\)</string>
<key>name</key>
<string>meta.tag.attribute.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#tag-stuff</string>
</dict>
</array>
</dict>
</array>
<key>repository</key>
<dict>
<key>entities</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.entity.jade</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.entity.jade</string>
</dict>
</dict>
<key>match</key>
<string>(&amp;)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)</string>
<key>name</key>
<string>constant.character.entity.jade</string>
</dict>
<dict>
<key>match</key>
<string>&amp;</string>
<key>name</key>
<string>invalid.illegal.bad-ampersand.jade</string>
</dict>
</array>
</dict>
<key>filter-langs</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#markdown</string>
</dict>
<dict>
<key>include</key>
<string>#sass</string>
</dict>
</array>
</dict>
<key>markdown</key>
<dict>
<key>begin</key>
<string>markdown\s*$\n?</string>
<key>end</key>
<string>(?!^\1\s+)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>text.html.markdown</string>
</dict>
</array>
</dict>
<key>sass</key>
<dict>
<key>begin</key>
<string>^(\s*)\:sass</string>
<key>end</key>
<string>(?!^\1\s+)</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.sass</string>
</dict>
</array>
</dict>
<key>string-double-quoted</key>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.jade</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.jade</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#entities</string>
</dict>
</array>
</dict>
<key>string-single-quoted</key>
<dict>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.jade</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.jade</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.jade</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#entities</string>
</dict>
</array>
</dict>
<key>tag-generic-attribute</key>
<dict>
<key>match</key>
<string>\b([a-zA-Z\-:]+)</string>
<key>name</key>
<string>entity.other.attribute-name.jade</string>
</dict>
<key>tag-stuff</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#string-double-quoted</string>
</dict>
<dict>
<key>include</key>
<string>#string-single-quoted</string>
</dict>
<dict>
<key>include</key>
<string>#tag-generic-attribute</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.jade</string>
<key>uuid</key>
<string>C5B73B98-5F2A-42E3-9F0E-028A74A9FE4B</string>
</dict>
</plist>

1511
tool/Objective-C.tmLanguage Normal file

File diff suppressed because one or more lines are too long

View file

@ -82,7 +82,7 @@
}
.%cssClass% .ace_constant.ace_character, {
%constant%
%constant.character%
}
.%cssClass% .ace_constant.ace_character.ace_escape, {

60
tool/mode.tmpl.js Normal file
View file

@ -0,0 +1,60 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* Contributor(s):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var %language%HighlightRules = require("./%languageHighlightFilename%_highlight_rules").%language%HighlightRules;
var Mode = function() {
var highlighter = new %language%HighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
// Extra logic goes here. (see below)
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -1,7 +1,7 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* Copyright (c) 2012, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -33,6 +33,24 @@
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js
IT MIGHT NOT BE PERFECT, PARTICULARLY:
IN DECIDING STATES TO TRANSITION TO,
IGNORING WHITESPACE,
EXTENDING EXISTING MODES,
GATHERING KEYWORDS, OR
RULE PREFERENCE ORDER.
...But it's a good start from an existing *.tmlanguage file.
*/
define(function(require, exports, module) {
"use strict";

89
tool/tmlanguage.js Executable file → Normal file
View file

@ -4,11 +4,16 @@ var util = require("util");
// for tracking token states
var startState = { start: [] }, statesObj = { };
var args = process.argv.splice(2);
var tmLanguageFile = args[0];
var devMode = args[1];
var parseString = require("plist").parseString;
function parseLanguage(languageXml, callback) {
parseString(languageXml, function(_, language) {
callback(language[0])
});
parseString(languageXml, function(_, language) {
callback(language[0])
});
}
function logDebug(string, obj) {
@ -80,12 +85,12 @@ function checkForLookBehind(str) {
function assembleStateObjs(strState, pattern) {
var patterns = pattern.patterns;
var stateObj = {};
var tokenElem = [];
if (patterns) {
for (var p in patterns) {
stateObj = {}; // this is apparently necessary
if (patterns[p].include) {
stateObj.include = patterns[p].include;
}
@ -123,7 +128,7 @@ function extractPatterns(patterns) {
state++;
var i = 1;
var tokenArray = [];
var tokenObj = {};
var tokenObj = { token: [] };
var stateObj = {};
if (pattern.comment) {
@ -134,13 +139,24 @@ function extractPatterns(patterns) {
if (pattern.begin && pattern.end) {
var strState = "state_" + state;
if ( pattern.beginCaptures === undefined && pattern.endCaptures === undefined) {
tokenObj.token = pattern.captures;
tokenObj.token.push(pattern.captures);
}
else if (pattern.beginCaptures) {
tokenObj.token = pattern.beginCaptures;
tokenObj.token.push(pattern.beginCaptures);
}
else if (pattern.endCaptures) {
tokenObj.token = pattern.endCaptures;
tokenObj.token.push(pattern.endCaptures);
}
if (tokenObj.token === undefined) {
if (pattern.name)
tokenObj.token.push(pattern.name);
else
logDebug("There's no token name for this state transition", pattern)
}
if (tokenObj.token === undefined) {
tokenObj.token.push(pattern.name);
}
statesObj[strState] = [ ];
@ -155,18 +171,27 @@ function extractPatterns(patterns) {
}
else if (pattern.captures) {
tokenObj.token = pattern.captures;
tokenObj.token.push([]);
tokenObj.token.push(pattern.captures);
tokenObj.regex = checkForLookBehind(pattern.match);
startState.start.push(tokenObj);
}
else if (pattern.match) {
tokenObj.token = pattern.name;
tokenObj.token.push(pattern.name);
tokenObj.regex = checkForLookBehind(pattern.match);
startState.start.push(tokenObj);
}
else if (pattern.include) {
tokenObj.token.push(pattern.include);
tokenObj.regex = "";
startState.start.push(tokenObj);
}
else {
logDebug("I've gone through every choice, and have no clue what this is:", pattern);
}
@ -187,28 +212,44 @@ function fillTemplate(template, replacements) {
});
}
var modeTemplate = fs.readFileSync(__dirname + "/theme_mode.tmpl.js", "utf8");
var modeTemplate = fs.readFileSync(__dirname + "/mode.tmpl.js", "utf8");
var modeHighlightTemplate = fs.readFileSync(__dirname + "/mode_highlight_rules.tmpl.js", "utf8");
function convertLanguage(name) {
var tmLanguage = fs.readFileSync(__dirname + "/" + name, "utf8");
parseLanguage(tmLanguage, function(language) {
var outFile = __dirname + "/../lib/ace/mode/" + language.name.replace(/-/g, "_").toLowerCase() + "_highlight_rules.js";
console.log("Converting " + name + " to " + outFile);
//console.log(util.inspect(language.patterns, false, 4));
var languageHighlightFilename = language.name.replace(/[-_]/g, "").toLowerCase();
var languageNameSanitized = language.name.replace(/-/g, "");
var languageHighlightFile = __dirname + "/../lib/ace/mode/" + languageHighlightFilename + "_highlight_rules.js";
var languageModeFile = __dirname + "/../lib/ace/mode/" + languageHighlightFilename + ".js";
console.log("Converting " + name + " to " + languageHighlightFile);
if (devMode)
console.log(util.inspect(language.patterns, false, 4));
var patterns = extractPatterns(language.patterns);
var lang = fillTemplate(modeTemplate, {
language: language.name.replace(/-/g, ""),
languageTokens: patterns
});
var patterns = extractPatterns(language.patterns);
var languageHighlightRules = fillTemplate(modeHighlightTemplate, {
language: languageNameSanitized,
languageTokens: patterns
});
fs.writeFileSync(outFile, lang);
var languageMode = fillTemplate(modeTemplate, {
language: languageNameSanitized,
languageHighlightFilename: languageHighlightFilename
});
if (devMode) {
console.log("Not writing, 'cause we're in dev mode, baby.");
}
else {
fs.writeFileSync(languageHighlightFile, languageHighlightRules);
fs.writeFileSync(languageModeFile, languageMode);
}
});
}
var tmLanguageFile = process.argv.splice(2)[0];
if (tmLanguageFile === undefined) {
console.error("Please pass in a language file via the command line.");
process.exit(1);

View file

@ -3,7 +3,6 @@ var fs = require("fs");
var parseString = require("plist").parseString;
function parseTheme(themeXml, callback) {
parseString(themeXml, function(_, theme) {
console.log(theme)
callback(theme[0])
});
}