23 lines
431 B
C++
23 lines
431 B
C++
#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;
|
|
};
|
|
} |