1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-01 05:41:31 +00:00

try to get bbasic listings, fixed highlighting

This commit is contained in:
Steven Hugg 2018-11-21 07:21:07 -05:00
parent eb01bdcea0
commit a7b1fb4f57
5 changed files with 65 additions and 64 deletions

View File

@ -46,7 +46,7 @@ CodeMirror.defineMode('bataribasic', function(_config, parserConfig) {
for (var s of directives_list)
directives[s] = 'keyword';
var numbers = /^([$][0-9a-f]+|[%][01]+|[0-9.]+)\b/i;
var numbers = /^([$][0-9a-f]+|[%][01]+|[0-9.]+)/i;
return {
startState: function() {
@ -68,7 +68,7 @@ CodeMirror.defineMode('bataribasic', function(_config, parserConfig) {
return null;
var w;
if (stream.eatWhile(/\w/)) {
if (stream.eatWhile(/[$%A-Z0-9]/i)) {
w = stream.current();
var cur = w.toLowerCase();
var style = directives[cur];
@ -79,9 +79,8 @@ CodeMirror.defineMode('bataribasic', function(_config, parserConfig) {
if (style)
return style;
if (state.context == 4 && numbers.test(w)) {
return 'number';
} else if (stream.match(numbers)) {
console.log(w, numbers.test(w));
if (numbers.test(w)) {
return 'number';
} else {
return null;

View File

@ -290,4 +290,3 @@ export class CodeProject {
}
}
}

View File

@ -155,8 +155,8 @@ function refreshWindowList() {
var lst = listings[lstfn];
// TODO: add assembly listings? (lines, macrolines, sourcefile)
if (lst.assemblyfile) {
addWindowItem(lstfn, getFilenameForPath(lstfn), function(path) {
return new Views.ListingView(lstfn);
addWindowItem(lstfn, getFilenameForPath(lstfn), (path) => {
return new Views.ListingView(path);
});
}
}

View File

@ -702,4 +702,3 @@ export class MemoryView implements ProjectView {
return i;
}
}

View File

@ -693,6 +693,13 @@ function assembleDASM(step:BuildStep) {
symbolmap[toks[0]] = parseInt(toks[1], 16);
}
}
// for bataribasic (TODO)
if (step['bblines']) {
let lst = listings[lstpath];
lst.asmlines = lst.lines;
lst.text = alst;
lst.lines = [];
}
return {
output:aout.slice(2),
listings:listings,
@ -1587,7 +1594,8 @@ function compileBatariBasic(step:BuildStep) {
nexttool:"dasm",
path:destpath,
args:[destpath],
files:[destpath, "2600basic.h", "2600basic_variable_redefs.h"]
files:[destpath, "2600basic.h", "2600basic_variable_redefs.h"],
bblines:true,
};
}
@ -1689,13 +1697,9 @@ function executeBuildSteps() {
}
// process with another tool?
if (step.result.nexttool) {
var asmstep = {
tool:step.result.nexttool,
platform:platform,
files:step.result.files,
path:step.result.path,
args:step.result.args
};
var asmstep = step.result;
asmstep.tool = step.result.nexttool;
asmstep.platform = platform;
buildsteps.push(asmstep); // TODO: unshift changes order
step.generated = asmstep.files;
}