aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/lex.c
blob: af3bbf33459063a084ec4d9f2edc873d780244ed (plain)
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
34
35
36
37
38
#include "cc.h"

static
void
errorat(Pos x, byte *fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    printf("error %d:", x.line);
    vprintf(fmt, args);
    va_end(args);
}

static
byte
getbyte(struct Lexer *lex)
{
    return bufio·getbyte(&lex->buf);
}

static
error
ungetbyte(struct Lexer *lex, byte b)
{
    return bufio·ungetbyte(&lex->buf, b);
}

void
lex(struct Lexer *lex)
{
    int b;

    b = getbyte(lex);
TOP:
    switch (b) {

    }
}