Compare commits
2 Commits
5e39024f6d
...
3a103c46d1
| Author | SHA1 | Date | |
|---|---|---|---|
|
3a103c46d1
|
|||
|
8d4c53ca92
|
28
asm.js
28
asm.js
@@ -58,7 +58,8 @@ class Tokenizer {
|
||||
this.buffer.push(...src);
|
||||
let token;
|
||||
while (token = this.next()) {
|
||||
if (token == this.comment_start)
|
||||
if (token.string == undefined
|
||||
&& token.startsWith(this.comment_start))
|
||||
this.comment = true;
|
||||
else if (this.comment && token == LINE_END)
|
||||
this.comment = false;
|
||||
@@ -522,26 +523,21 @@ class Parser {
|
||||
|
||||
token_global_init(token) {
|
||||
if (token == LINE_END) {
|
||||
console.error(
|
||||
"ERROR: Unexpected newline in .global: expected"
|
||||
+ " initial value");
|
||||
this.global = undefined;
|
||||
this.global_name = undefined;
|
||||
this.state = State.TOP;
|
||||
this.global.init = 0;
|
||||
} else {
|
||||
const value = this.integer(token) ?? console.error(
|
||||
`ERROR: Unexpected token ${token} in .global: expected`
|
||||
+ " initial value");
|
||||
this.global.init = value;
|
||||
const action = {
|
||||
type: Action.GLOBAL,
|
||||
global: { [this.global_name]: this.global }
|
||||
};
|
||||
this.global = undefined;
|
||||
this.global_name = undefined;
|
||||
this.state = State.TOP;
|
||||
return action;
|
||||
}
|
||||
}
|
||||
const action = {
|
||||
type: Action.GLOBAL,
|
||||
global: { [this.global_name]: this.global }
|
||||
};
|
||||
this.global = undefined;
|
||||
this.global_name = undefined;
|
||||
this.state = State.TOP;
|
||||
return action;
|
||||
}
|
||||
|
||||
token_at_mem(token) {
|
||||
|
||||
Reference in New Issue
Block a user