Skip to content

Commit cb10f94

Browse files
committed
progress?
1 parent 77682b7 commit cb10f94

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

mcparser.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,40 +33,39 @@ namespace microcode {
3333
i = i + 4
3434
continue
3535
}
36-
const line = lines[0].split(" ")
37-
if (line[0] == "Page") {
36+
const tokens = lines[i].split(" ")
37+
if (tokens[0] == "Page") {
3838
currPage = new PageDefn()
39-
} else if (line[0] == "EOP") {
39+
} else if (tokens[0] == "EOP") {
4040
prog.pages.push(currPage)
4141
currPage = undefined
42-
} else if (line[0] == "EOR") {
42+
} else if (tokens[0] == "EOR") {
4343
currPage.rules.push(currRule)
4444
currRule = undefined
4545
} else {
4646
if (!currRule) {
4747
currRule = new RuleDefn()
48-
currRule.sensors.push(token2tile(line[0]) as number)
49-
line.shift()
48+
currRule.sensors.push(token2tile(tokens[0]) as number)
49+
tokens.shift()
5050
}
51-
let tok = line.shift()
51+
let tok = tokens.shift()
5252
while (tok) {
5353
if (!currTile) {
5454
currTile = token2tile(tok)
5555
placeTile(currTile, currRule)
56-
tok = line.shift()
5756
} else if (currTile instanceof IconEditor) {
5857
break
5958
} else if (currTile instanceof DigitEditor) {
6059
currTile.field = currTile.fieldEditor.fromString(tok)
6160
currTile = undefined
62-
tok = line.shift()
6361
} else if (currTile instanceof MelodyEditor) {
6462
currTile.field = currTile.fieldEditor.fromString(
65-
tok + line.join(" ")
63+
tok + tokens.join(" ")
6664
)
6765
currTile = undefined
6866
break
6967
}
68+
tok = tokens.shift()
7069
}
7170
}
7271
}

0 commit comments

Comments
 (0)