aboutsummaryrefslogtreecommitdiff
path: root/src/comp/fe/parser.rs
blob: 02de22a7a57383aa2e63fc3feac829369f00d1e0 (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
25
26
27
28
29
30
31
32
33
import std._io;

state type parser =
    state obj {
          state fn peek() -> token.token;
          state fn bump();
    };

fn new_parser(str path) -> parser {
    state obj stdio_parser(mutable token.token tok,
                           _io.stdio_reader rdr)
        {
            state fn peek() -> token.token {
                ret tok;
            }
            state fn bump() {
                tok = lexer.next_token(rdr);
            }
        }
    auto rdr = _io.new_stdio_reader(path);
    ret stdio_parser(lexer.next_token(rdr), rdr);
}

//
// Local Variables:
// mode: rust
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
//