hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/lexer.h
blob: eb7a4d36a2c8089edd9cff3a72f7577cc3aaf32a (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
#pragma once

#include <stdbool.h>
#include <stdio.h>

// single characters stand for themselves
// so the named tokens start past them
enum Token
{
    TOK_END = 0,
    TOK_COLONCOLON = 256,
    TOK_EMIT,
    TOK_COMMIT,
    TOK_DECLTYPE,
    TOK_DIFFERENCE,
    TOK_CHAR
};

// provided by flex
// the input
// the current line
// and the scanner itself
extern FILE* yyin;
extern int yylineno;
int yylex(void);

// true once the lexer has refused something
bool lexer_failed(void);
// the character inside the most recent TOK_CHAR
char lexer_character(void);