kopia lustrzana https://github.com/c9/core
update ace
rodzic
7952f64c05
commit
c0f9226078
|
@ -226,7 +226,7 @@ var Autocomplete = function() {
|
||||||
var pos = editor.getCursorPosition();
|
var pos = editor.getCursorPosition();
|
||||||
|
|
||||||
var line = session.getLine(pos.row);
|
var line = session.getLine(pos.row);
|
||||||
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
|
var prefix = util.getCompletionPrefix(editor);
|
||||||
|
|
||||||
this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
|
this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
|
||||||
this.base.$insertRight = true;
|
this.base.$insertRight = true;
|
||||||
|
@ -235,13 +235,13 @@ var Autocomplete = function() {
|
||||||
var total = editor.completers.length;
|
var total = editor.completers.length;
|
||||||
editor.completers.forEach(function(completer, i) {
|
editor.completers.forEach(function(completer, i) {
|
||||||
completer.getCompletions(editor, session, pos, prefix, function(err, results) {
|
completer.getCompletions(editor, session, pos, prefix, function(err, results) {
|
||||||
if (!err)
|
if (!err && results)
|
||||||
matches = matches.concat(results);
|
matches = matches.concat(results);
|
||||||
// Fetch prefix again, because they may have changed by now
|
// Fetch prefix again, because they may have changed by now
|
||||||
var pos = editor.getCursorPosition();
|
var pos = editor.getCursorPosition();
|
||||||
var line = session.getLine(pos.row);
|
var line = session.getLine(pos.row);
|
||||||
callback(null, {
|
callback(null, {
|
||||||
prefix: util.retrievePrecedingIdentifier(line, pos.column, results[0] && results[0].identifierRegex),
|
prefix: prefix,
|
||||||
matches: matches,
|
matches: matches,
|
||||||
finished: (--total === 0)
|
finished: (--total === 0)
|
||||||
});
|
});
|
||||||
|
|
|
@ -71,4 +71,19 @@ exports.retrieveFollowingIdentifier = function(text, pos, regex) {
|
||||||
return buf;
|
return buf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.getCompletionPrefix = function (editor) {
|
||||||
|
var pos = editor.getCursorPosition();
|
||||||
|
var line = editor.session.getLine(pos.row);
|
||||||
|
var prefix;
|
||||||
|
editor.completers.forEach(function(completer) {
|
||||||
|
if (completer.identifierRegexps) {
|
||||||
|
completer.identifierRegexps.forEach(function(identifierRegex) {
|
||||||
|
if (!prefix && identifierRegex)
|
||||||
|
prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
|
return prefix || this.retrievePrecedingIdentifier(line, pos.column);
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -137,33 +137,17 @@ var loadSnippetFile = function(id) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function getCompletionPrefix(editor) {
|
|
||||||
var pos = editor.getCursorPosition();
|
|
||||||
var line = editor.session.getLine(pos.row);
|
|
||||||
var prefix;
|
|
||||||
// Try to find custom prefixes on the completers
|
|
||||||
editor.completers.forEach(function(completer) {
|
|
||||||
if (completer.identifierRegexps) {
|
|
||||||
completer.identifierRegexps.forEach(function(identifierRegex) {
|
|
||||||
if (!prefix && identifierRegex)
|
|
||||||
prefix = util.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return prefix || util.retrievePrecedingIdentifier(line, pos.column);
|
|
||||||
}
|
|
||||||
|
|
||||||
var doLiveAutocomplete = function(e) {
|
var doLiveAutocomplete = function(e) {
|
||||||
var editor = e.editor;
|
var editor = e.editor;
|
||||||
var hasCompleter = editor.completer && editor.completer.activated;
|
var hasCompleter = editor.completer && editor.completer.activated;
|
||||||
|
|
||||||
// We don't want to autocomplete with no prefix
|
// We don't want to autocomplete with no prefix
|
||||||
if (e.command.name === "backspace") {
|
if (e.command.name === "backspace") {
|
||||||
if (hasCompleter && !getCompletionPrefix(editor))
|
if (hasCompleter && !util.getCompletionPrefix(editor))
|
||||||
editor.completer.detach();
|
editor.completer.detach();
|
||||||
}
|
}
|
||||||
else if (e.command.name === "insertstring") {
|
else if (e.command.name === "insertstring") {
|
||||||
var prefix = getCompletionPrefix(editor);
|
var prefix = util.getCompletionPrefix(editor);
|
||||||
// Only autocomplete if there's a prefix that can be matched
|
// Only autocomplete if there's a prefix that can be matched
|
||||||
if (prefix && !hasCompleter) {
|
if (prefix && !hasCompleter) {
|
||||||
if (!editor.completer) {
|
if (!editor.completer) {
|
||||||
|
|
|
@ -80,6 +80,7 @@ var supportedModes = {
|
||||||
Gherkin: ["feature"],
|
Gherkin: ["feature"],
|
||||||
Gitignore: ["^.gitignore"],
|
Gitignore: ["^.gitignore"],
|
||||||
Glsl: ["glsl|frag|vert"],
|
Glsl: ["glsl|frag|vert"],
|
||||||
|
Gobstones: ["gbs"],
|
||||||
golang: ["go"],
|
golang: ["go"],
|
||||||
Groovy: ["groovy"],
|
Groovy: ["groovy"],
|
||||||
HAML: ["haml"],
|
HAML: ["haml"],
|
||||||
|
@ -87,8 +88,8 @@ var supportedModes = {
|
||||||
Haskell: ["hs"],
|
Haskell: ["hs"],
|
||||||
haXe: ["hx"],
|
haXe: ["hx"],
|
||||||
HTML: ["html|htm|xhtml"],
|
HTML: ["html|htm|xhtml"],
|
||||||
HTML_Ruby: ["erb|rhtml|html.erb"],
|
|
||||||
HTML_Elixir: ["eex|html.eex"],
|
HTML_Elixir: ["eex|html.eex"],
|
||||||
|
HTML_Ruby: ["erb|rhtml|html.erb"],
|
||||||
INI: ["ini|conf|cfg|prefs"],
|
INI: ["ini|conf|cfg|prefs"],
|
||||||
Io: ["io"],
|
Io: ["io"],
|
||||||
Jack: ["jack"],
|
Jack: ["jack"],
|
||||||
|
@ -120,12 +121,13 @@ var supportedModes = {
|
||||||
MUSHCode: ["mc|mush"],
|
MUSHCode: ["mc|mush"],
|
||||||
MySQL: ["mysql"],
|
MySQL: ["mysql"],
|
||||||
Nix: ["nix"],
|
Nix: ["nix"],
|
||||||
|
NSIS: ["nsi|nsh"],
|
||||||
ObjectiveC: ["m|mm"],
|
ObjectiveC: ["m|mm"],
|
||||||
OCaml: ["ml|mli"],
|
OCaml: ["ml|mli"],
|
||||||
Pascal: ["pas|p"],
|
Pascal: ["pas|p"],
|
||||||
Perl: ["pl|pm"],
|
Perl: ["pl|pm"],
|
||||||
pgSQL: ["pgsql"],
|
pgSQL: ["pgsql"],
|
||||||
PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp"],
|
PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
|
||||||
Powershell: ["ps1"],
|
Powershell: ["ps1"],
|
||||||
Praat: ["praat|praatscript|psc|proc"],
|
Praat: ["praat|praatscript|psc|proc"],
|
||||||
Prolog: ["plg|prolog"],
|
Prolog: ["plg|prolog"],
|
||||||
|
@ -165,6 +167,7 @@ var supportedModes = {
|
||||||
Velocity: ["vm"],
|
Velocity: ["vm"],
|
||||||
Verilog: ["v|vh|sv|svh"],
|
Verilog: ["v|vh|sv|svh"],
|
||||||
VHDL: ["vhd|vhdl"],
|
VHDL: ["vhd|vhdl"],
|
||||||
|
Wollok: ["wlk|wpgm|wtest"],
|
||||||
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
|
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
|
||||||
XQuery: ["xq"],
|
XQuery: ["xq"],
|
||||||
YAML: ["yaml|yml"],
|
YAML: ["yaml|yml"],
|
||||||
|
|
|
@ -1091,12 +1091,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
||||||
// Keypress character binding of format "'a'"
|
// Keypress character binding of format "'a'"
|
||||||
return key.charAt(1);
|
return key.charAt(1);
|
||||||
}
|
}
|
||||||
var pieces = key.split('-');
|
var pieces = key.split(/-(?!$)/);
|
||||||
if (/-$/.test(key)) {
|
|
||||||
// If the - key was typed, split will result in 2 extra empty strings
|
|
||||||
// in the array. Replace them with 1 '-'.
|
|
||||||
pieces.splice(-2, 2, '-');
|
|
||||||
}
|
|
||||||
var lastPiece = pieces[pieces.length - 1];
|
var lastPiece = pieces[pieces.length - 1];
|
||||||
if (pieces.length == 1 && pieces[0].length == 1) {
|
if (pieces.length == 1 && pieces[0].length == 1) {
|
||||||
// No-modifier bindings use literal character bindings above. Skip.
|
// No-modifier bindings use literal character bindings above. Skip.
|
||||||
|
@ -2235,7 +2230,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (motionArgs.toJumplist) {
|
if (motionArgs.toJumplist) {
|
||||||
if (!operator)
|
if (!operator && cm.ace.curOp != null)
|
||||||
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace_patch
|
cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace_patch
|
||||||
var jumpList = vimGlobalState.jumpList;
|
var jumpList = vimGlobalState.jumpList;
|
||||||
// if the current motion is # or *, use cachedCursor
|
// if the current motion is # or *, use cachedCursor
|
||||||
|
@ -2787,13 +2782,21 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
||||||
text = text.slice(0, - match[0].length);
|
text = text.slice(0, - match[0].length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var wasLastLine = head.line - 1 == cm.lastLine();
|
var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE);
|
||||||
cm.replaceRange('', anchor, head);
|
var wasLastLine = cm.firstLine() == cm.lastLine();
|
||||||
if (args.linewise && !wasLastLine) {
|
if (head.line > cm.lastLine() && args.linewise && !wasLastLine) {
|
||||||
|
cm.replaceRange('', prevLineEnd, head);
|
||||||
|
} else {
|
||||||
|
cm.replaceRange('', anchor, head);
|
||||||
|
}
|
||||||
|
if (args.linewise) {
|
||||||
// Push the next line back down, if there is a next line.
|
// Push the next line back down, if there is a next line.
|
||||||
CodeMirror.commands.newlineAndIndent(cm);
|
if (!wasLastLine) {
|
||||||
// null ch so setCursor moves to end of line.
|
cm.setCursor(prevLineEnd);
|
||||||
anchor.ch = null;
|
CodeMirror.commands.newlineAndIndent(cm);
|
||||||
|
}
|
||||||
|
// make sure cursor ends up at the end of the line.
|
||||||
|
anchor.ch = Number.MAX_VALUE;
|
||||||
}
|
}
|
||||||
finalHead = anchor;
|
finalHead = anchor;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4037,7 +4040,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Returns the boundaries of the next word. If the cursor in the middle of
|
* Returns the boundaries of the next word. If the cursor in the middle of
|
||||||
* the word, then returns the boundaries of the current word, starting at
|
* the word, then returns the boundaries of the current word, starting at
|
||||||
* the cursor. If the cursor is at the start/end of a word, and we are going
|
* the cursor. If the cursor is at the start/end of a word, and we are going
|
||||||
|
@ -5135,7 +5138,7 @@ dom.importCssString(".normal-mode .ace_cursor{\
|
||||||
if (decimal + hex + octal > 1) { return 'Invalid arguments'; }
|
if (decimal + hex + octal > 1) { return 'Invalid arguments'; }
|
||||||
number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';
|
number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';
|
||||||
}
|
}
|
||||||
if (args.eatSpace() && args.match(/\/.*\//)) { 'patterns not supported'; }
|
if (args.match(/\/.*\//)) { return 'patterns not supported'; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var err = parseArgs();
|
var err = parseArgs();
|
||||||
|
|
|
@ -480,7 +480,6 @@ testVim('%_skip_string', function(cm, vim, helpers) {
|
||||||
helpers.doKeys(['%']);
|
helpers.doKeys(['%']);
|
||||||
helpers.assertCursorAt(0,0);
|
helpers.assertCursorAt(0,0);
|
||||||
}, {value:'(")")'});
|
}, {value:'(")")'});
|
||||||
(')')
|
|
||||||
testVim('%_skip_comment', function(cm, vim, helpers) {
|
testVim('%_skip_comment', function(cm, vim, helpers) {
|
||||||
cm.setCursor(0,0);
|
cm.setCursor(0,0);
|
||||||
helpers.doKeys(['%']);
|
helpers.doKeys(['%']);
|
||||||
|
@ -2239,9 +2238,18 @@ testVim('S_normal', function(cm, vim, helpers) {
|
||||||
cm.setCursor(0, 1);
|
cm.setCursor(0, 1);
|
||||||
helpers.doKeys('j', 'S');
|
helpers.doKeys('j', 'S');
|
||||||
helpers.doKeys('<Esc>');
|
helpers.doKeys('<Esc>');
|
||||||
helpers.assertCursorAt(1, 0);
|
helpers.assertCursorAt(1, 1);
|
||||||
eq('aa\n\ncc', cm.getValue());
|
eq('aa{\n \ncc', cm.getValue());
|
||||||
}, { value: 'aa\nbb\ncc'});
|
helpers.doKeys('j', 'S');
|
||||||
|
eq('aa{\n \n ', cm.getValue());
|
||||||
|
helpers.assertCursorAt(2, 2);
|
||||||
|
helpers.doKeys('<Esc>');
|
||||||
|
helpers.doKeys('d', 'd', 'd', 'd');
|
||||||
|
helpers.assertCursorAt(0, 0);
|
||||||
|
helpers.doKeys('S');
|
||||||
|
is(vim.insertMode);
|
||||||
|
eq('', cm.getValue());
|
||||||
|
}, { value: 'aa{\nbb\ncc'});
|
||||||
testVim('blockwise_paste', function(cm, vim, helpers) {
|
testVim('blockwise_paste', function(cm, vim, helpers) {
|
||||||
cm.setCursor(0, 0);
|
cm.setCursor(0, 0);
|
||||||
helpers.doKeys('<C-v>', '3', 'j', 'l', 'y');
|
helpers.doKeys('<C-v>', '3', 'j', 'l', 'y');
|
||||||
|
@ -3219,8 +3227,7 @@ testVim('zt==z<CR>', function(cm, vim, helpers){
|
||||||
});
|
});
|
||||||
|
|
||||||
var moveTillCharacterSandbox =
|
var moveTillCharacterSandbox =
|
||||||
'The quick brown fox \n'
|
'The quick brown fox \n';
|
||||||
'jumped over the lazy dog.'
|
|
||||||
testVim('moveTillCharacter', function(cm, vim, helpers){
|
testVim('moveTillCharacter', function(cm, vim, helpers){
|
||||||
cm.setCursor(0, 0);
|
cm.setCursor(0, 0);
|
||||||
// Search for the 'q'.
|
// Search for the 'q'.
|
||||||
|
@ -3267,9 +3274,6 @@ testVim('searchForPipe', function(cm, vim, helpers){
|
||||||
|
|
||||||
|
|
||||||
var scrollMotionSandbox =
|
var scrollMotionSandbox =
|
||||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'
|
|
||||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'
|
|
||||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'
|
|
||||||
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n';
|
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n';
|
||||||
testVim('scrollMotion', function(cm, vim, helpers){
|
testVim('scrollMotion', function(cm, vim, helpers){
|
||||||
var prevCursor, prevScrollInfo;
|
var prevCursor, prevScrollInfo;
|
||||||
|
@ -3490,6 +3494,14 @@ testVim('ex_sort_decimal_mixed_reverse', function(cm, vim, helpers) {
|
||||||
helpers.doEx('sort! d');
|
helpers.doEx('sort! d');
|
||||||
eq('a3\nb2\nc1\nz\ny', cm.getValue());
|
eq('a3\nb2\nc1\nz\ny', cm.getValue());
|
||||||
}, { value: 'a3\nz\nc1\ny\nb2'});
|
}, { value: 'a3\nz\nc1\ny\nb2'});
|
||||||
|
testVim('ex_sort_patterns_not_supported', function(cm, vim, helpers) {
|
||||||
|
var notified = false;
|
||||||
|
cm.openNotification = helpers.fakeOpenNotification(function(text) {
|
||||||
|
notified = /patterns not supported/.test(text);
|
||||||
|
});
|
||||||
|
helpers.doEx('sort /abc/');
|
||||||
|
is(notified, 'No notification.');
|
||||||
|
});
|
||||||
// test for :global command
|
// test for :global command
|
||||||
testVim('ex_global', function(cm, vim, helpers) {
|
testVim('ex_global', function(cm, vim, helpers) {
|
||||||
cm.setCursor(0, 0);
|
cm.setCursor(0, 0);
|
||||||
|
|
|
@ -74,7 +74,7 @@ function checkModes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateTestData() {
|
function generateTestData(names, force) {
|
||||||
var docRoot = root + "/demo/kitchen-sink/docs";
|
var docRoot = root + "/demo/kitchen-sink/docs";
|
||||||
var docs = fs.readdirSync(docRoot);
|
var docs = fs.readdirSync(docRoot);
|
||||||
var specialDocs = fs.readdirSync(cwd);
|
var specialDocs = fs.readdirSync(cwd);
|
||||||
|
@ -95,14 +95,32 @@ function generateTestData() {
|
||||||
else
|
else
|
||||||
modeName = {"txt": "text", cpp: "c_cpp"}[p[1]];
|
modeName = {"txt": "text", cpp: "c_cpp"}[p[1]];
|
||||||
|
|
||||||
var filePath = "text_" + modeName + ".txt";
|
if (names && names.length && names.indexOf(modeName) == -1)
|
||||||
if (specialDocs.indexOf(filePath) == -1) {
|
return;
|
||||||
filePath = docRoot + "/" + docName;
|
|
||||||
} else {
|
var outputPath = cwd + "tokens_" + modeName + ".json";
|
||||||
filePath = cwd + filePath;
|
try {
|
||||||
|
var oldOutput = require(outputPath);
|
||||||
|
} catch(e) {}
|
||||||
|
if (oldOutput && !force) {
|
||||||
|
var oldText = oldOutput.map(function(x) {
|
||||||
|
if (x.length > 1 && typeof x[x.length - 1] == "string")
|
||||||
|
return x[x.length - 1];
|
||||||
|
return x.slice(1).map(function(tok) {
|
||||||
|
return tok[1];
|
||||||
|
}).join("");
|
||||||
|
}).join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = fs.readFileSync(filePath, "utf8");
|
var filePath = "text_" + modeName + ".txt";
|
||||||
|
if (specialDocs.indexOf(filePath) !== -1) {
|
||||||
|
filePath = cwd + filePath;
|
||||||
|
} else {
|
||||||
|
filePath = docRoot + "/" + docName;
|
||||||
|
// oldText = "";
|
||||||
|
}
|
||||||
|
var text = oldText ||fs.readFileSync(filePath, "utf8");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var Mode = require("../" + modeName).Mode;
|
var Mode = require("../" + modeName).Mode;
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
@ -129,7 +147,11 @@ function generateTestData() {
|
||||||
});
|
});
|
||||||
|
|
||||||
var jsonStr = "[[\n " + data.join("\n],[\n ") + "\n]]";
|
var jsonStr = "[[\n " + data.join("\n],[\n ") + "\n]]";
|
||||||
fs.writeFileSync(cwd + "tokens_" + modeName + ".json", jsonStr, "utf8");
|
|
||||||
|
if (oldOutput && JSON.stringify(JSON.parse(jsonStr)) == JSON.stringify(oldOutput))
|
||||||
|
return;
|
||||||
|
|
||||||
|
fs.writeFileSync(outputPath, jsonStr, "utf8");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,9 @@ foo.d =function(a, b)
|
||||||
foo.d =function(a, /*****/ d"string"
|
foo.d =function(a, /*****/ d"string"
|
||||||
|
|
||||||
<div
|
<div
|
||||||
z=<div {...this.props} x={1 + 2} y="z{
|
z=<div {...this.props} x={1 + 2} y="z{a}b&" t={
|
||||||
1
|
1 + <a>{2}</a>
|
||||||
}e">
|
}>
|
||||||
1 <a> { ++x } </a>
|
1 <a> { ++x } </a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,10 @@
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["identifier","prints"],
|
["identifier","prints"],
|
||||||
["paren.lparen","("],
|
["paren.lparen","("],
|
||||||
["string","\"trace message\""],
|
["string.start","\""],
|
||||||
|
["string","trace message"],
|
||||||
|
["constant.language.escape","\\n"],
|
||||||
|
["string.end","\""],
|
||||||
["paren.rparen",")"],
|
["paren.rparen",")"],
|
||||||
["punctuation.operator",";"]
|
["punctuation.operator",";"]
|
||||||
],[
|
],[
|
||||||
|
|
|
@ -608,7 +608,7 @@
|
||||||
["keyword.operator","<"],
|
["keyword.operator","<"],
|
||||||
["identifier","div"]
|
["identifier","div"]
|
||||||
],[
|
],[
|
||||||
["start","jsx_attr_qq","jsx_attr_qq","jsxAttributes","jsxAttributes","jsx",1],
|
["start","jsxAttributes","jsxAttributes","jsx",1],
|
||||||
["identifier","z"],
|
["identifier","z"],
|
||||||
["keyword.operator","="],
|
["keyword.operator","="],
|
||||||
["meta.tag.punctuation.tag-open.xml","<"],
|
["meta.tag.punctuation.tag-open.xml","<"],
|
||||||
|
@ -633,17 +633,33 @@
|
||||||
["text.tag-whitespace.xml"," "],
|
["text.tag-whitespace.xml"," "],
|
||||||
["entity.other.attribute-name.xml","y"],
|
["entity.other.attribute-name.xml","y"],
|
||||||
["keyword.operator.attribute-equals.xml","="],
|
["keyword.operator.attribute-equals.xml","="],
|
||||||
["string.attribute-value.xml","\"z"],
|
["string.attribute-value.xml","\"z{a}b"],
|
||||||
|
["constant.language.escape.reference.xml","&"],
|
||||||
|
["string.attribute-value.xml","\""],
|
||||||
|
["text.tag-whitespace.xml"," "],
|
||||||
|
["entity.other.attribute-name.xml","t"],
|
||||||
|
["keyword.operator.attribute-equals.xml","="],
|
||||||
["paren.quasi.start","{"]
|
["paren.quasi.start","{"]
|
||||||
],[
|
],[
|
||||||
["#tmp","no_regex","start","jsx_attr_qq","jsx_attr_qq","jsxAttributes","jsxAttributes","jsx",1],
|
["start","jsxAttributes","jsxAttributes","jsx",1],
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["constant.numeric","1"]
|
["constant.numeric","1"],
|
||||||
|
["text"," "],
|
||||||
|
["keyword.operator","+"],
|
||||||
|
["text"," "],
|
||||||
|
["meta.tag.punctuation.tag-open.xml","<"],
|
||||||
|
["meta.tag.tag-name.xml","a"],
|
||||||
|
["meta.tag.punctuation.tag-close.xml",">"],
|
||||||
|
["paren.quasi.start","{"],
|
||||||
|
["constant.numeric","2"],
|
||||||
|
["paren.quasi.end","}"],
|
||||||
|
["meta.tag.punctuation.end-tag-open.xml","</"],
|
||||||
|
["meta.tag.tag-name.xml","a"],
|
||||||
|
["meta.tag.punctuation.tag-close.xml",">"]
|
||||||
],[
|
],[
|
||||||
["jsx",1],
|
["jsx",1],
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["paren.quasi.end","}"],
|
["paren.quasi.end","}"],
|
||||||
["string.attribute-value.xml","e\""],
|
|
||||||
["meta.tag.punctuation.tag-close.xml",">"]
|
["meta.tag.punctuation.tag-close.xml",">"]
|
||||||
],[
|
],[
|
||||||
["jsx",1],
|
["jsx",1],
|
||||||
|
|
|
@ -412,7 +412,9 @@
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["identifier","ProtocolFromString"],
|
["identifier","ProtocolFromString"],
|
||||||
["punctuation.operator",":"],
|
["punctuation.operator",":"],
|
||||||
["string","\"NSTableViewDelegate\""],
|
["string.start","\""],
|
||||||
|
["string","NSTableViewDelegate"],
|
||||||
|
["string.end","\""],
|
||||||
["paren.rparen","))"]
|
["paren.rparen","))"]
|
||||||
],[
|
],[
|
||||||
"start"
|
"start"
|
||||||
|
@ -469,7 +471,10 @@
|
||||||
["support.function.C99.c","printf"],
|
["support.function.C99.c","printf"],
|
||||||
["paren.lparen","("],
|
["paren.lparen","("],
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["string","\"hello world\\n\""],
|
["string.start","\""],
|
||||||
|
["string","hello world"],
|
||||||
|
["constant.language.escape","\\n"],
|
||||||
|
["string.end","\""],
|
||||||
["text"," "],
|
["text"," "],
|
||||||
["paren.rparen",")"],
|
["paren.rparen",")"],
|
||||||
["punctuation.operator",";"]
|
["punctuation.operator",";"]
|
||||||
|
|
|
@ -46,6 +46,7 @@ var c_cppHighlightRules = function() {
|
||||||
}, "identifier");
|
}, "identifier");
|
||||||
|
|
||||||
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
|
||||||
|
var escapeRe = /\\(?:['"?\\abfnrtv]|[0-7]{1,3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}U[a-fA-F\d]{8}|.)/.source;
|
||||||
|
|
||||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
@ -67,19 +68,27 @@ var c_cppHighlightRules = function() {
|
||||||
regex : "\\/\\*",
|
regex : "\\/\\*",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // single line
|
token : "string", // character
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : "'(?:" + escapeRe + "|.)'"
|
||||||
}, {
|
}, {
|
||||||
token : "string", // multi line string start
|
token : "string.start",
|
||||||
regex : '["].*\\\\$',
|
regex : '"',
|
||||||
next : "qqstring"
|
stateName: "qqstring",
|
||||||
|
next: [
|
||||||
|
{ token: "string", regex: /\\\s*$/, next: "qqstring" },
|
||||||
|
{ token: "constant.language.escape", regex: escapeRe },
|
||||||
|
{ token: "constant.language.escape", regex: /%[^'"\\]/ },
|
||||||
|
{ token: "string.end", regex: '"|$', next: "start" },
|
||||||
|
{ defaultToken: "string"}
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
token : "string", // single line
|
token : "string.start",
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : 'R"\\(',
|
||||||
}, {
|
stateName: "rawString",
|
||||||
token : "string", // multi line string start
|
next: [
|
||||||
regex : "['].*\\\\$",
|
{ token: "string.end", regex: '\\)"', next: "start" },
|
||||||
next : "qstring"
|
{ defaultToken: "string"}
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
||||||
|
@ -139,24 +148,6 @@ var c_cppHighlightRules = function() {
|
||||||
defaultToken: "comment"
|
defaultToken: "comment"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"qqstring" : [
|
|
||||||
{
|
|
||||||
token : "string",
|
|
||||||
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
|
||||||
next : "start"
|
|
||||||
}, {
|
|
||||||
defaultToken : "string"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"qstring" : [
|
|
||||||
{
|
|
||||||
token : "string",
|
|
||||||
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
|
||||||
next : "start"
|
|
||||||
}, {
|
|
||||||
defaultToken : "string"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directive" : [
|
"directive" : [
|
||||||
{
|
{
|
||||||
token : "constant.other.multiline",
|
token : "constant.other.multiline",
|
||||||
|
@ -192,6 +183,7 @@ var c_cppHighlightRules = function() {
|
||||||
|
|
||||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
[ DocCommentHighlightRules.getEndRule("start") ]);
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
this.normalizeRules();
|
||||||
};
|
};
|
||||||
|
|
||||||
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
||||||
|
|
|
@ -38,6 +38,12 @@ var CSharpHighlightRules = function() {
|
||||||
token : "string", start : '@"', end : '"', next:[
|
token : "string", start : '@"', end : '"', next:[
|
||||||
{token: "constant.language.escape", regex: '""'}
|
{token: "constant.language.escape", regex: '""'}
|
||||||
]
|
]
|
||||||
|
}, {
|
||||||
|
token : "string", start : /\$"/, end : '"|$', next: [
|
||||||
|
{token: "constant.language.escape", regex: /\\(:?$)|{{/},
|
||||||
|
{token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
|
||||||
|
{token: "invalid", regex: /\\./}
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var JavaScriptMode = require("./javascript").Mode;
|
||||||
|
var GobstonesHighlightRules = require("./gobstones_highlight_rules").GobstonesHighlightRules;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
JavaScriptMode.call(this);
|
||||||
|
this.HighlightRules = GobstonesHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, JavaScriptMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/gobstones";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var GobstonesHighlightRules = function() {
|
||||||
|
|
||||||
|
var keywords = (
|
||||||
|
"program|procedure|function|interactive|if|then|else|switch|repeat|while|foreach|in|not|div|mod|Skip|return"
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = (
|
||||||
|
"False|True"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
var langClasses = (
|
||||||
|
"Poner|Sacar|Mover|IrAlBorde|VaciarTablero|" +
|
||||||
|
"nroBolitas|hayBolitas|puedeMover|siguiente|previo|opuesto|minBool|maxBool|" +
|
||||||
|
"minDir|maxDir|minColor|maxColor"
|
||||||
|
);
|
||||||
|
|
||||||
|
var supportType = (
|
||||||
|
"Verde|Rojo|Azul|Negro|Norte|Sur|Este|Oeste"
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
"keyword": keywords,
|
||||||
|
"constant.language": buildinConstants,
|
||||||
|
"support.function": langClasses,
|
||||||
|
"support.type": supportType
|
||||||
|
}, "identifier");
|
||||||
|
|
||||||
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\-\\-.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "#.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/
|
||||||
|
}, {
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:True|False)\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : ":=|\\.\\.|,|;|\\|\\||\\/\\/|\\+|\\-|\\^|\\*|>|<|>=|=>|==|&&"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
// TODO: Unicode escape sequences
|
||||||
|
// TODO: Unicode identifiers
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(GobstonesHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.GobstonesHighlightRules = GobstonesHighlightRules;
|
||||||
|
});
|
|
@ -44,7 +44,7 @@ define(function(require, exports, module) {
|
||||||
regex : /"(?:[^"\\]|\\.)*?"/
|
regex : /"(?:[^"\\]|\\.)*?"/
|
||||||
}, {
|
}, {
|
||||||
token : "string", // raw
|
token : "string", // raw
|
||||||
regex : '[`](?:[^`]*)$',
|
regex : '`',
|
||||||
next : "bqstring"
|
next : "bqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // rune
|
token : "constant.numeric", // rune
|
||||||
|
|
|
@ -341,12 +341,12 @@ var HtmlCompletions = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
|
this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
|
||||||
var values = ['Á', 'á', 'Â', 'â', '´', 'Æ', 'æ', 'À', 'à', 'ℵ', 'Α', 'α', '&', '∧', '∠', 'Å', 'å', '≈', 'Ã', 'ã', 'Ä', 'ä', '„', 'Β', 'β', '¦', '•', '∩', 'Ç', 'ç', '¸', '¢', 'Χ', 'χ', 'ˆ', '♣', '≅', '©', '↵', '∪', '¤', '‡', '†', '⇓', '↓', '°', 'Δ', 'δ', '♦', '÷', 'É', 'é', 'Ê', 'ê', 'È', 'è', '∅', ' ', ' ', 'Ε', 'ε', '≡', 'Η', 'η', 'Ð', 'ð', 'Ë', 'ë', '€', '∃', 'ƒ', '∀', '½', '¼', '¾', '⁄', 'Γ', 'γ', '≥', '>', '⇔', '↔', '♥', '…', 'Í', 'í', 'Î', 'î', '¡', 'Ì', 'ì', 'ℑ', '∞', '∫', 'Ι', 'ι', '¿', '∈', 'Ï', 'ï', 'Κ', 'κ', 'Λ', 'λ', '⟨', '«', '⇐', '←', '⌈', '“', '≤', '⌊', '∗', '◊', '‎', '‹', '‘', '<', '¯', '—', 'µ', '·', '−', 'Μ', 'μ', '∇', ' ', '–', '≠', '∋', '¬', '∉', '⊄', 'Ñ', 'ñ', 'Ν', 'ν', 'Ó', 'ó', 'Ô', 'ô', 'Œ', 'œ', 'Ò', 'ò', '‾', 'Ω', 'ω', 'Ο', 'ο', '⊕', '∨', 'ª', 'º', 'Ø', 'ø', 'Õ', 'õ', '⊗', 'Ö', 'ö', '¶', '∂', '‰', '⊥', 'Φ', 'φ', 'Π', 'π', 'ϖ', '±', '£', '″', '′', '∏', '∝', 'Ψ', 'ψ', '"', '√', '⟩', '»', '⇒', '→', '⌉', '”', 'ℜ', '®', '⌋', 'Ρ', 'ρ', '‏', '›', '’', '‚', 'Š', 'š', '⋅', '§', '­', 'Σ', 'σ', 'ς', '∼', '♠', '⊂', '⊆', '∑', '⊃', '¹', '²', '³', '⊇', 'ß', 'Τ', 'τ', '∴', 'Θ', 'θ', 'ϑ', ' ', 'Þ', 'þ', '˜', '×', '™', 'Ú', 'ú', '⇑', '↑', 'Û', 'û', 'Ù', 'ù', '¨', 'ϒ', 'Υ', 'υ', 'Ü', 'ü', '℘', 'Ξ', 'ξ', 'Ý', 'ý', '¥', 'Ÿ', 'ÿ', 'Ζ', 'ζ', '‍', '‌'];
|
var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
|
||||||
|
|
||||||
return values.map(function(value){
|
return values.map(function(value){
|
||||||
return {
|
return {
|
||||||
caption: value,
|
caption: value,
|
||||||
snippet: value.substr(1),
|
snippet: value,
|
||||||
meta: "html entity",
|
meta: "html entity",
|
||||||
score: Number.MAX_VALUE
|
score: Number.MAX_VALUE
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,10 +80,6 @@ var JadeHighlightRules = function() {
|
||||||
token: "keyword.other.doctype.jade",
|
token: "keyword.other.doctype.jade",
|
||||||
regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
|
regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
token : "punctuation.section.comment",
|
|
||||||
regex : "^\\s*\/\/(?:\\s*[^-\\s]|\\s+\\S)(?:.*$)"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
onMatch: function(value, currentState, stack) {
|
onMatch: function(value, currentState, stack) {
|
||||||
stack.unshift(this.next, value.length - 2, currentState);
|
stack.unshift(this.next, value.length - 2, currentState);
|
||||||
|
@ -156,8 +152,13 @@ var JadeHighlightRules = function() {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"comment_block": [
|
"comment_block": [
|
||||||
{regex: /^\s*/, onMatch: function(value, currentState, stack) {
|
{regex: /^\s*(?:\/\/)?/, onMatch: function(value, currentState, stack) {
|
||||||
if (value.length <= stack[1]) {
|
if (value.length <= stack[1]) {
|
||||||
|
if (value.slice(-1) == "/") {
|
||||||
|
stack[1] = value.length - 2;
|
||||||
|
this.next = "";
|
||||||
|
return "comment";
|
||||||
|
}
|
||||||
stack.shift();
|
stack.shift();
|
||||||
stack.shift();
|
stack.shift();
|
||||||
this.next = stack.shift();
|
this.next = stack.shift();
|
||||||
|
|
|
@ -475,7 +475,6 @@ function JSX() {
|
||||||
stateName : "jsx_attr_q",
|
stateName : "jsx_attr_q",
|
||||||
push : [
|
push : [
|
||||||
{token : "string.attribute-value.xml", regex: "'", next: "pop"},
|
{token : "string.attribute-value.xml", regex: "'", next: "pop"},
|
||||||
jsxJsRule,
|
|
||||||
{include : "reference"},
|
{include : "reference"},
|
||||||
{defaultToken : "string.attribute-value.xml"}
|
{defaultToken : "string.attribute-value.xml"}
|
||||||
]
|
]
|
||||||
|
@ -484,7 +483,6 @@ function JSX() {
|
||||||
regex : '"',
|
regex : '"',
|
||||||
stateName : "jsx_attr_qq",
|
stateName : "jsx_attr_qq",
|
||||||
push : [
|
push : [
|
||||||
jsxJsRule,
|
|
||||||
{token : "string.attribute-value.xml", regex: '"', next: "pop"},
|
{token : "string.attribute-value.xml", regex: '"', next: "pop"},
|
||||||
{include : "reference"},
|
{include : "reference"},
|
||||||
{defaultToken : "string.attribute-value.xml"}
|
{defaultToken : "string.attribute-value.xml"}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/* ***** 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.
|
||||||
|
*
|
||||||
|
* ***** 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 NSISHighlightRules = require("./nsis_highlight_rules").NSISHighlightRules;
|
||||||
|
// TODO: pick appropriate fold mode
|
||||||
|
var FoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = NSISHighlightRules;
|
||||||
|
this.foldingRules = new FoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
this.lineCommentStart = [";", "#"];
|
||||||
|
this.blockComment = {start: "/*", end: "*/"};
|
||||||
|
this.$id = "ace/mode/nsis";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
|
@ -0,0 +1,173 @@
|
||||||
|
/* ***** 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.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var NSISHighlightRules = function() {
|
||||||
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
start: [{
|
||||||
|
token: "keyword.compiler.nsis",
|
||||||
|
regex: /(?:\b|^\s*)\!(?:include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|finalize|getdllversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace)\b/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "keyword.command.nsis",
|
||||||
|
regex: /(?:\b|^\s*)(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|IntCmp|IntCmpU|IntFmt|IntOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetPluginUnload|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegStr|WriteUninstaller|XPStyle)\b/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "keyword.control.nsis",
|
||||||
|
regex: /(?:\b|^\s*)\!(?:ifdef|ifndef|if|ifmacrodef|ifmacrondef|else|endif)\b/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "keyword.plugin.nsis",
|
||||||
|
regex: /(?:\b|^\s*)\w+\:\:\w+/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "keyword.operator.comparison.nsis",
|
||||||
|
regex: /[!<>]?=|<>|<|>/
|
||||||
|
}, {
|
||||||
|
token: "support.function.nsis",
|
||||||
|
regex: /(?:\b|^\s*)(?:Function|FunctionEnd|Section|SectionEnd|SectionGroup|SectionGroupEnd|SubSection|SubSectionEnd|PageEx|PageExEnd)\b/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "support.library.nsis",
|
||||||
|
regex: /\${[\w]+}/
|
||||||
|
}, {
|
||||||
|
token: "constant.nsis",
|
||||||
|
regex: /(?:\b|^\s*)(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "constant.library.nsis",
|
||||||
|
regex: /\${(?:AtLeastServicePack|AtLeastWin7|AtLeastWin8|AtLeastWin10|AtLeastWin95|AtLeastWin98|AtLeastWin2000|AtLeastWin2003|AtLeastWin2008|AtLeastWin2008R2|AtLeastWinME|AtLeastWinNT4|AtLeastWinVista|AtLeastWinXP|AtMostServicePack|AtMostWin7|AtMostWin8|AtMostWin10|AtMostWin95|AtMostWin98|AtMostWin2000|AtMostWin2003|AtMostWin2008|AtMostWin2008R2|AtMostWinME|AtMostWinNT4|AtMostWinVista|AtMostWinXP|IsNT|IsServer|IsServicePack|IsWin7|IsWin8|IsWin10|IsWin95|IsWin98|IsWin2000|IsWin2003|IsWin2008|IsWin2008R2|IsWinME|IsWinNT4|IsWinVista|IsWinXP)}/
|
||||||
|
}, {
|
||||||
|
token: "constant.language.boolean.true.nsis",
|
||||||
|
regex: /\b(?:true|on)\b/
|
||||||
|
}, {
|
||||||
|
token: "constant.language.boolean.false.nsis",
|
||||||
|
regex: /\b(?:false|off)\b/
|
||||||
|
}, {
|
||||||
|
token: "constant.language.option.nsis",
|
||||||
|
regex: /(?:\b|^\s*)(?:(?:un\.)?components|(?:un\.)?custom|(?:un\.)?directory|(?:un\.)?instfiles|(?:un\.)?license|uninstConfirm|admin|all|auto|both|bottom|bzip2|current|force|hide|highest|ifdiff|ifnewer|lastused|leave|left|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|user|Win10|Win7|Win8|WinVista|zlib)\b/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "constant.language.slash-option.nsis",
|
||||||
|
regex: /\/(?:a|BRANDING|CENTER|COMPONENTSONLYONCUSTOM|CUSTOMSTRING\=|date|e|ENABLECANCEL|FILESONLY|file|FINAL|GLOBAL|gray|ifempty|ifndef|ignorecase|IMGID\=|ITALIC|LANG\=|NOCUSTOM|noerrors|NONFATAL|nonfatal|oname\=|o|REBOOTOK|redef|RESIZETOFIT|r|SHORT|SILENT|SOLID|STRIKE|TRIM|UNDERLINE|utcdate|windows|x)\b/,
|
||||||
|
caseInsensitive: true
|
||||||
|
}, {
|
||||||
|
token: "constant.numeric.nsis",
|
||||||
|
regex: /\b(?:0(?:x|X)[0-9a-fA-F]+|[0-9]+(?:\.[0-9]+)?)\b/
|
||||||
|
}, {
|
||||||
|
token: "entity.name.function.nsis",
|
||||||
|
regex: /\${[\w]+}/
|
||||||
|
}, {
|
||||||
|
token: "storage.type.function.nsis",
|
||||||
|
regex: /\$[\w]+/
|
||||||
|
}, {
|
||||||
|
token: "punctuation.definition.string.begin.nsis",
|
||||||
|
regex: /`/,
|
||||||
|
push: [{
|
||||||
|
token: "punctuation.definition.string.end.nsis",
|
||||||
|
regex: /`/,
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
token: "constant.character.escape.nsis",
|
||||||
|
regex: /\$\\./
|
||||||
|
}, {
|
||||||
|
defaultToken: "string.quoted.back.nsis"
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token: "punctuation.definition.string.begin.nsis",
|
||||||
|
regex: /"/,
|
||||||
|
push: [{
|
||||||
|
token: "punctuation.definition.string.end.nsis",
|
||||||
|
regex: /"/,
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
token: "constant.character.escape.nsis",
|
||||||
|
regex: /\$\\./
|
||||||
|
}, {
|
||||||
|
defaultToken: "string.quoted.double.nsis"
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token: "punctuation.definition.string.begin.nsis",
|
||||||
|
regex: /'/,
|
||||||
|
push: [{
|
||||||
|
token: "punctuation.definition.string.end.nsis",
|
||||||
|
regex: /'/,
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
token: "constant.character.escape.nsis",
|
||||||
|
regex: /\$\\./
|
||||||
|
}, {
|
||||||
|
defaultToken: "string.quoted.single.nsis"
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token: [
|
||||||
|
"punctuation.definition.comment.nsis",
|
||||||
|
"comment.line.nsis"
|
||||||
|
],
|
||||||
|
regex: /(;|#)(.*$)/
|
||||||
|
}, {
|
||||||
|
token: "punctuation.definition.comment.nsis",
|
||||||
|
regex: /\/\*/,
|
||||||
|
push: [{
|
||||||
|
token: "punctuation.definition.comment.nsis",
|
||||||
|
regex: /\*\//,
|
||||||
|
next: "pop"
|
||||||
|
}, {
|
||||||
|
defaultToken: "comment.block.nsis"
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
token: "text",
|
||||||
|
regex: /(?:\!include|\!insertmacro)\b/
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.normalizeRules();
|
||||||
|
};
|
||||||
|
|
||||||
|
NSISHighlightRules.metaData = {
|
||||||
|
comment: "\n\ttodo: - highlight functions\n\t",
|
||||||
|
fileTypes: ["nsi", "nsh"],
|
||||||
|
name: "NSIS",
|
||||||
|
scopeName: "source.nsis"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
oop.inherits(NSISHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.NSISHighlightRules = NSISHighlightRules;
|
||||||
|
});
|
|
@ -0,0 +1,25 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var JavaScriptMode = require("./javascript").Mode;
|
||||||
|
var WollokHighlightRules = require("./wollok_highlight_rules").WollokHighlightRules;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
JavaScriptMode.call(this);
|
||||||
|
this.HighlightRules = WollokHighlightRules;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, JavaScriptMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.createWorker = function(session) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/wollok";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var WollokHighlightRules = function() {
|
||||||
|
|
||||||
|
// taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html
|
||||||
|
var keywords = (
|
||||||
|
"test|package|inherits|false|import|else|or|class|and|not|native|override|program|this|try|val|var|catch|object|super|throw|if|null|return|true|new|method"
|
||||||
|
);
|
||||||
|
|
||||||
|
var buildinConstants = ("null|assert|console");
|
||||||
|
|
||||||
|
|
||||||
|
var langClasses = (
|
||||||
|
"Object|Pair|String|Boolean|Number|Integer|Double|Collection|Set|List|Exception|Range" +
|
||||||
|
"|StackTraceElement"
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex
|
||||||
|
regex : /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // float
|
||||||
|
regex : /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/
|
||||||
|
}, {
|
||||||
|
token : "constant.language.boolean",
|
||||||
|
regex : "(?:true|false)\\b"
|
||||||
|
}, {
|
||||||
|
token : keywordMapper,
|
||||||
|
// TODO: Unicode escape sequences
|
||||||
|
// TODO: Unicode identifiers
|
||||||
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "===|&&|\\*=|\\.\\.|\\*\\*|#|!|%|\\*|\\?:|\\+|\\/|,|\\+=|\\-|\\.\\.<|!==|:|\\/=|\\?\\.|\\+\\+|>|=|<|>=|=>|==|\\]|\\[|\\-=|\\->|\\||\\-\\-|<>|!=|%=|\\|"
|
||||||
|
}, {
|
||||||
|
token : "lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(WollokHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.WollokHighlightRules = WollokHighlightRules;
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.snippetText = require("../requirejs/text!./gobstones.snippets");
|
||||||
|
exports.scope = "gobstones";
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Procedure
|
||||||
|
snippet proc
|
||||||
|
procedure ${1?:name}(${2:argument}) {
|
||||||
|
${3:// body...}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function
|
||||||
|
snippet fun
|
||||||
|
function ${1?:name}(${2:argument}) {
|
||||||
|
return ${3:// body...}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Repeat
|
||||||
|
snippet rep
|
||||||
|
repeat ${1?:times} {
|
||||||
|
${2:// body...}
|
||||||
|
}
|
||||||
|
|
||||||
|
# For
|
||||||
|
snippet for
|
||||||
|
foreach ${1?:e} in ${2?:list} {
|
||||||
|
${3:// body...}
|
||||||
|
}
|
||||||
|
|
||||||
|
# If
|
||||||
|
snippet if
|
||||||
|
if (${1?:condition}) {
|
||||||
|
${3:// body...}
|
||||||
|
}
|
||||||
|
|
||||||
|
# While
|
||||||
|
while (${1?:condition}) {
|
||||||
|
${2:// body...}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.snippetText = require("../requirejs/text!./html_elixir.snippets");
|
||||||
|
exports.scope = "html_elixir";
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
define(function (require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.snippetText = require("../requirejs/text!./mask.snippets");
|
||||||
|
exports.scope = "mask";
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.snippetText = require("../requirejs/text!./.snippets");
|
||||||
|
exports.scope = "";
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
define(function (require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.snippetText = require("../requirejs/text!./swift.snippets");
|
||||||
|
exports.scope = "swift";
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
define(function (require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.snippetText = require("../requirejs/text!./swig.snippets");
|
||||||
|
exports.scope = "swig";
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
define(function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
exports.snippetText = require("../requirejs/text!./wollok.snippets");
|
||||||
|
exports.scope = "wollok";
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,85 @@
|
||||||
|
##
|
||||||
|
## Basic Java packages and import
|
||||||
|
snippet im
|
||||||
|
import
|
||||||
|
snippet w.l
|
||||||
|
wollok.lang
|
||||||
|
snippet w.i
|
||||||
|
wollok.lib
|
||||||
|
|
||||||
|
## Class and object
|
||||||
|
snippet cl
|
||||||
|
class ${1:`Filename("", "untitled")`} ${2}
|
||||||
|
snippet obj
|
||||||
|
object ${1:`Filename("", "untitled")`} ${2:inherits Parent}${3}
|
||||||
|
snippet te
|
||||||
|
test ${1:`Filename("", "untitled")`}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Enhancements
|
||||||
|
snippet inh
|
||||||
|
inherits
|
||||||
|
|
||||||
|
##
|
||||||
|
## Comments
|
||||||
|
snippet /*
|
||||||
|
/*
|
||||||
|
* ${1}
|
||||||
|
*/
|
||||||
|
|
||||||
|
##
|
||||||
|
## Control Statements
|
||||||
|
snippet el
|
||||||
|
else
|
||||||
|
snippet if
|
||||||
|
if (${1}) ${2}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Create a Method
|
||||||
|
snippet m
|
||||||
|
method ${1:method}(${2}) ${5}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Tests
|
||||||
|
snippet as
|
||||||
|
assert.equals(${1:expected}, ${2:actual})
|
||||||
|
|
||||||
|
##
|
||||||
|
## Exceptions
|
||||||
|
snippet ca
|
||||||
|
catch ${1:e} : (${2:Exception} ) ${3}
|
||||||
|
snippet thr
|
||||||
|
throw
|
||||||
|
snippet try
|
||||||
|
try {
|
||||||
|
${3}
|
||||||
|
} catch ${1:e} : ${2:Exception} {
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Javadocs
|
||||||
|
snippet /**
|
||||||
|
/**
|
||||||
|
* ${1}
|
||||||
|
*/
|
||||||
|
|
||||||
|
##
|
||||||
|
## Print Methods
|
||||||
|
snippet print
|
||||||
|
console.println("${1:Message}")
|
||||||
|
|
||||||
|
##
|
||||||
|
## Setter and Getter Methods
|
||||||
|
snippet set
|
||||||
|
method set${1:}(${2:}) {
|
||||||
|
$1 = $2
|
||||||
|
}
|
||||||
|
snippet get
|
||||||
|
method get${1:}() {
|
||||||
|
return ${1:};
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
## Terminate Methods or Loops
|
||||||
|
snippet re
|
||||||
|
return
|
Ładowanie…
Reference in New Issue