-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save tokens position and print in on errors
- Loading branch information
1 parent
fc18363
commit 95cd114
Showing
6 changed files
with
155 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
|
||
#include "Token.h" | ||
|
||
namespace em { | ||
|
||
class Lexer { | ||
public: | ||
explicit Lexer(std::wstring mProgram); | ||
class Lexer { | ||
public: | ||
explicit Lexer(std::wstring mProgram); | ||
|
||
std::vector<Token> scanTokens(); | ||
|
||
std::vector<Token> scanTokens(); | ||
private: | ||
Token scanNumber(); | ||
|
||
private: | ||
Token scanNumber(); | ||
Token scanIdentifier(); | ||
|
||
Token scanIdentifier(); | ||
unsigned int updatePosition(int offset = 1); | ||
|
||
static bool isValidForIdentifier(wchar_t character); | ||
static bool isValidForIdentifier(wchar_t character); | ||
|
||
std::wstring mProgram; | ||
unsigned int mPosition{0}; | ||
}; | ||
std::wstring mProgram; | ||
unsigned int mPosition{0}; | ||
Token::Location mLocation{1, 1}; | ||
}; | ||
|
||
} // namespace em |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.