mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-01 20:41:36 +00:00
ecs: highlighting changes
This commit is contained in:
parent
73ab50f9b6
commit
d61e2391ce
|
@ -31,14 +31,15 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
var directives = new Map();
|
var directives = new Map();
|
||||||
directives_list.forEach(function (s) { directives.set(s, 'def'); });
|
directives_list.forEach(function (s) { directives.set(s, 'keyword'); });
|
||||||
keywords_list.forEach(function (s) { directives.set(s, 'keyword'); });
|
keywords_list.forEach(function (s) { directives.set(s, 'def'); });
|
||||||
|
|
||||||
var opcodes = /^\s[a-z][a-z][a-z]\s/i;
|
var opcodes = /^\s[a-z][a-z][a-z]\s/i;
|
||||||
var numbers = /^(0x[\da-f]+|[\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i;
|
var numbers = /^(0x[\da-f]+|[$][\da-f]+|[\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i;
|
||||||
var tags = /^\{\{.*\}\}/;
|
var tags = /^\{\{.*\}\}/;
|
||||||
var comment = /\/\/.*/;
|
var comment = /^\/\/.*$/;
|
||||||
var mlcomment = /\/\*.*?\*\//s; // TODO
|
var mlcomment = /^\/\*.*?\*\//s; // TODO
|
||||||
|
var codedelim = /^---/;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
startState: function () {
|
startState: function () {
|
||||||
|
@ -59,6 +60,10 @@
|
||||||
if (stream.match(mlcomment)) {
|
if (stream.match(mlcomment)) {
|
||||||
return 'comment';
|
return 'comment';
|
||||||
}
|
}
|
||||||
|
if (stream.match(codedelim)) {
|
||||||
|
state.context = state.context ^ 1;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var w;
|
var w;
|
||||||
if (stream.eatWhile(/\w/)) {
|
if (stream.eatWhile(/\w/)) {
|
||||||
|
@ -68,13 +73,13 @@
|
||||||
if (style)
|
if (style)
|
||||||
return style;
|
return style;
|
||||||
|
|
||||||
if (opcodes.test(w)) {
|
if (numbers.test(w)) {
|
||||||
return 'keyword';
|
|
||||||
} else if (numbers.test(w)) {
|
|
||||||
return 'number';
|
return 'number';
|
||||||
} else if (w == 'comment') {
|
} else if (w == 'comment') {
|
||||||
stream.match(mlcomment);
|
stream.match(mlcomment);
|
||||||
return 'comment';
|
return 'comment';
|
||||||
|
} else {
|
||||||
|
return state.context ? 'variable-2' : null;
|
||||||
}
|
}
|
||||||
} else if (stream.eat(';')) {
|
} else if (stream.eat(';')) {
|
||||||
stream.skipToEnd();
|
stream.skipToEnd();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user