aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/io.h
blob: 8a96b5975e1ac293e1b3287158537d7a1b1b36ca (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
#ifndef DUCC_IO_H
#define DUCC_IO_H

#include "std.h"

struct SourceLocation {
    const char* filename;
    int line;
};
typedef struct SourceLocation SourceLocation;

struct InFile {
    const char* buf;
    int pos;
    SourceLocation loc;
};
typedef struct InFile InFile;

InFile* infile_open(const char* filename);
BOOL infile_eof(InFile* f);
char infile_peek_char(InFile* f);
char infile_next_char(InFile* f);
BOOL infile_consume_if(InFile* f, char expected);

#endif