23 lines
511 B
C++
23 lines
511 B
C++
#pragma once
|
|
|
|
#include "token.hh"
|
|
#include <cstddef>
|
|
#include <vector>
|
|
|
|
struct Scanner {
|
|
Scanner(const std::string &code) : code{code}, tokens{}, start{0}, current{0}, line{1} {};
|
|
std::vector<Token> scan_tokens();
|
|
bool is_at_end();
|
|
void scan_token();
|
|
char advance();
|
|
bool match(char expected);
|
|
char peek();
|
|
void add_token(TokenType type);
|
|
void add_token(TokenType type, Object literal);
|
|
void string();
|
|
|
|
std::string code;
|
|
std::vector<Token> tokens;
|
|
std::size_t start, current, line;
|
|
};
|