Assemble kernel on the client #1
19
asm.js
19
asm.js
@@ -560,18 +560,15 @@ class Parser {
|
|||||||
this.state = State.TOP;
|
this.state = State.TOP;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const value = this.integer(token);
|
|
||||||
if (value == null) {
|
|
||||||
console.error(
|
|
||||||
`ERROR: Unexpected token ${token}, expected value`);
|
|
||||||
this.def_name = undefined;
|
|
||||||
this.state = State.TOP;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const action = {
|
const action = {
|
||||||
type: Action.DEF,
|
type: Action.DEF,
|
||||||
def: { name: this.def_name, value },
|
def: { name: this.def_name },
|
||||||
};
|
};
|
||||||
|
const value = this.integer(token);
|
||||||
|
if (value != null)
|
||||||
|
action.def.value = value;
|
||||||
|
else
|
||||||
|
action.def.symbol = token;
|
||||||
this.def_name = undefined;
|
this.def_name = undefined;
|
||||||
this.state = State.TOP;
|
this.state = State.TOP;
|
||||||
return action;
|
return action;
|
||||||
@@ -742,7 +739,9 @@ export class Assembler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
action_def(action) {
|
action_def(action) {
|
||||||
this.defs[action.def.name] = action.def.value;
|
const value = action.def.value
|
||||||
|
?? this.lookup_def(action.def.symbol);
|
||||||
|
this.defs[action.def.name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
action_label(action) {
|
action_label(action) {
|
||||||
|
|||||||
Reference in New Issue
Block a user