aboutsummaryrefslogtreecommitdiff
path: root/src/lexer.h
blob: 563dc60f6ef0a848e4c19cb09ea57629114f2e7a (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
#ifndef INCLUDED_LEXER_H
#define INCLUDED_LEXER_H

#include <stddef.h>
#include "utils.h"
#include "lexeme.h"

struct string_view_table {
  struct string_view *items;
  uint32_t            count;
  uint32_t            capacity;
};

struct lexer {
  struct string_view sv;
  const char *cursor;
  const char *beginning_of_line;
  size_t      line;
  struct string_view_table constant_string_table;
  struct string_view_table      identifier_table;
};

extern struct lexer  lexer_create      (const char *string, size_t len);
extern struct lexeme lexer_next_lexeme (struct lexer *);

#endif