Beispiel #1
0
Datei: tok.c Projekt: 8l/myrddin
static Tok *toknext()
{
    Tok *t;
    int c;

    eatspace();
    c = peek();
    if (c == End) {
        t =  mktok(0);
    } else if (c == '\n') {
        curloc.line++;
        next();
        t =  mktok(Tendln);
    } else if (isalpha(c) || c == '_' || c == '$') {
        t =  kwident();
    } else if (c == '"') {
        t =  strlit();
    } else if (c == '\'') {
        t = charlit();
    } else if (isdigit(c)) {
        t =  numlit();
    } else if (c == '@') {
        t = typaram();
    } else {
        t = oper();
    }

    if (!t || t->type == Terror)
        lfatal(curloc, "Unable to parse token starting with %c", c);
    return t;
}
Beispiel #2
0
int file_op ( )
{
    curr_file_num = fetch (pc ++).ival;
    curr_file_name = *strlit (curr_file_num);
    d_printf ("file\t%s\n", curr_file_name);
    return 0;
}