Assemble kernel on the client #1
19
asm.js
19
asm.js
@@ -754,9 +754,15 @@ class Parser {
|
||||
*handle(src) {
|
||||
let action;
|
||||
for (const token of this.tokenizer.handle(src)) {
|
||||
if (action = this.handlers[this.state](token)) {
|
||||
yield action;
|
||||
const handler = this.handlers[this.state];
|
||||
if (handler == undefined) {
|
||||
console.error(`ERROR: Unhandled state ${this.state}`);
|
||||
this.state = State.TOP;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (action = handler(token))
|
||||
yield action;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -955,8 +961,13 @@ export class Assembler {
|
||||
|
||||
push(chunk) {
|
||||
const text = this.decoder.decode(chunk, { stream: true });
|
||||
for (const action of this.parser.handle(text))
|
||||
this.handlers[action.type](action);
|
||||
for (const action of this.parser.handle(text)) {
|
||||
const handler = this.handlers[action.type];
|
||||
if (handler == undefined)
|
||||
console.error("ERROR: Unhandled action", action);
|
||||
else
|
||||
handler(action);
|
||||
}
|
||||
}
|
||||
|
||||
lookup_block(symbol) {
|
||||
|
||||
Reference in New Issue
Block a user