blob: 1066d215b5618bb6668aaaefa71323ae1d1b3512 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
fn read-cell in: (addr gap-buffer), out: (addr handle cell), trace: (addr trace) {
# eagerly tokenize everything so that the phases are easier to see in the trace
var tokens-storage: (stream token 0x400)
var tokens/edx: (addr stream token) <- address tokens-storage
tokenize in, tokens, trace
var error?/eax: boolean <- has-errors? trace
compare error?, 0/false
{
break-if-=
return
}
# insert more parens based on indentation
var parenthesized-tokens-storage: (stream token 0x400)
var parenthesized-tokens/ecx: (addr stream token) <- address parenthesized-tokens-storage
parenthesize tokens, parenthesized-tokens, trace
var error?/eax: boolean <- has-errors? trace
compare error?, 0/false
{
break-if-=
return
}
parse-input parenthesized-tokens, out, trace
transform-infix out, trace
}
|