minor changes
This commit is contained in:
@@ -1,2 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace lexer {
|
||||||
|
// controlled character stream access
|
||||||
|
class Cursor {
|
||||||
|
private:
|
||||||
|
const std::string &source;
|
||||||
|
int position; // current index in string
|
||||||
|
int line; // current index of line
|
||||||
|
int column; //
|
||||||
|
|
||||||
|
public:
|
||||||
|
char current(); // returns current symbol
|
||||||
|
|
||||||
|
char peek(int offset); //
|
||||||
|
void advance();
|
||||||
|
|
||||||
|
bool eol() const;
|
||||||
|
bool eof() const;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
namespace lexer {
|
namespace lexer {
|
||||||
struct Token {
|
struct Token {
|
||||||
TokenKind kind;
|
TokenKind kind;
|
||||||
std::string lexeme;
|
std::string value;
|
||||||
|
|
||||||
int line;
|
int line;
|
||||||
int column;
|
int column;
|
||||||
|
|||||||
Reference in New Issue
Block a user