basic: optional labels setting
This commit is contained in:
parent
14524726e6
commit
bbae87269f
|
@ -521,8 +521,4 @@ Don't grab cursor focus when trap occurs (how do we know?)
|
||||||
Use tick() and refresh(), not callbacks
|
Use tick() and refresh(), not callbacks
|
||||||
Show current datum when using READ
|
Show current datum when using READ
|
||||||
Use https://codemirror.net/doc/manual.html#markText
|
Use https://codemirror.net/doc/manual.html#markText
|
||||||
|
Reset doesn't break @ start unless debugging tools expanded
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,7 @@ function stripQuotes(s: string) {
|
||||||
// TODO: implement these
|
// TODO: implement these
|
||||||
export interface BASICOptions {
|
export interface BASICOptions {
|
||||||
uppercaseOnly : boolean; // convert everything to uppercase?
|
uppercaseOnly : boolean; // convert everything to uppercase?
|
||||||
|
optionalLabels : boolean; // can omit line numbers and use labels?
|
||||||
strictVarNames : boolean; // only allow A0-9 for numerics, single letter for arrays/strings
|
strictVarNames : boolean; // only allow A0-9 for numerics, single letter for arrays/strings
|
||||||
sharedArrayNamespace : boolean; // arrays and variables have same namespace? (conflict)
|
sharedArrayNamespace : boolean; // arrays and variables have same namespace? (conflict)
|
||||||
defaultArrayBase : number; // arrays start at this number (0 or 1)
|
defaultArrayBase : number; // arrays start at this number (0 or 1)
|
||||||
|
@ -290,9 +291,13 @@ export class BASICParser {
|
||||||
line.label = tok.str;
|
line.label = tok.str;
|
||||||
this.curlabel = tok.str;
|
this.curlabel = tok.str;
|
||||||
break;
|
break;
|
||||||
|
case TokenType.Float1:
|
||||||
|
case TokenType.Float2:
|
||||||
|
this.compileError(`Line numbers must be positive integers.`);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO
|
if (this.opts.optionalLabels) this.pushbackToken(tok);
|
||||||
this.pushbackToken(tok);
|
else this.dialectError(`optional line numbers`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,8 +345,10 @@ export class BASICParser {
|
||||||
// not empty line?
|
// not empty line?
|
||||||
if (this.tokens.length) {
|
if (this.tokens.length) {
|
||||||
this.parseOptLabel(line);
|
this.parseOptLabel(line);
|
||||||
line.stmts = this.parseCompoundStatement();
|
if (this.tokens.length) {
|
||||||
this.curlabel = null;
|
line.stmts = this.parseCompoundStatement();
|
||||||
|
this.curlabel = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
@ -637,6 +644,7 @@ export class BASICParser {
|
||||||
if (isEOS(tok)) break;
|
if (isEOS(tok)) break;
|
||||||
list.push(tok.str);
|
list.push(tok.str);
|
||||||
} while (true);
|
} while (true);
|
||||||
|
this.pushbackToken(tok);
|
||||||
var stmt : OPTION_Statement = { command:'OPTION', optname:tokname.str, optargs:list };
|
var stmt : OPTION_Statement = { command:'OPTION', optname:tokname.str, optargs:list };
|
||||||
this.parseOptions(stmt);
|
this.parseOptions(stmt);
|
||||||
return stmt;
|
return stmt;
|
||||||
|
@ -700,6 +708,7 @@ export class BASICParser {
|
||||||
|
|
||||||
export const ECMA55_MINIMAL : BASICOptions = {
|
export const ECMA55_MINIMAL : BASICOptions = {
|
||||||
uppercaseOnly : true,
|
uppercaseOnly : true,
|
||||||
|
optionalLabels : false,
|
||||||
strictVarNames : true,
|
strictVarNames : true,
|
||||||
sharedArrayNamespace : true,
|
sharedArrayNamespace : true,
|
||||||
defaultArrayBase : 0,
|
defaultArrayBase : 0,
|
||||||
|
@ -725,6 +734,7 @@ export const ECMA55_MINIMAL : BASICOptions = {
|
||||||
|
|
||||||
export const ALTAIR_BASIC40 : BASICOptions = {
|
export const ALTAIR_BASIC40 : BASICOptions = {
|
||||||
uppercaseOnly : true,
|
uppercaseOnly : true,
|
||||||
|
optionalLabels : false,
|
||||||
strictVarNames : true,
|
strictVarNames : true,
|
||||||
sharedArrayNamespace : true,
|
sharedArrayNamespace : true,
|
||||||
defaultArrayBase : 0,
|
defaultArrayBase : 0,
|
||||||
|
|
|
@ -256,6 +256,7 @@ class BASICPlatform implements Platform {
|
||||||
tty: TeleTypeWithKeyboard;
|
tty: TeleTypeWithKeyboard;
|
||||||
ips: number = 500;
|
ips: number = 500;
|
||||||
clock: number = 0;
|
clock: number = 0;
|
||||||
|
hotReload: boolean = false;
|
||||||
|
|
||||||
constructor(mainElement: HTMLElement) {
|
constructor(mainElement: HTMLElement) {
|
||||||
//super();
|
//super();
|
||||||
|
@ -331,7 +332,7 @@ class BASICPlatform implements Platform {
|
||||||
this.program = data;
|
this.program = data;
|
||||||
this.runtime.load(data);
|
this.runtime.load(data);
|
||||||
// only reset if we exited, otherwise we try to resume
|
// only reset if we exited, otherwise we try to resume
|
||||||
if (didExit) this.reset();
|
if (!this.hotReload || didExit) this.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
getROMExtension() {
|
getROMExtension() {
|
||||||
|
|
Loading…
Reference in New Issue