Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / src / Lexer.h
diff options
context:
space:
mode:
Commit6c7fc844cebe201408017602ff54bf442df0da25 (patch)
Author
 Ognyan <omalinov1994@gmail.com>
2018-10-14 22:01:06 +0300
Committer
 Ognyan <omalinov1994@gmail.com>
2018-10-14 22:01:09 +0300
Filesf6b359b40eecff54695f258f4a21d8a91ec38f73 /JSImpl/src/Lexer.h
IPL-6c7fc844cebe201408017602ff54bf442df0da25.tar
IPL-6c7fc844cebe201408017602ff54bf442df0da25.tar.gz
IPL-6c7fc844cebe201408017602ff54bf442df0da25.zip
Parent2621d30da58795a19fa2c90978f766e173a8ca2f (diff)
"Lexer string errors implemented."
1 files changed, 8 insertions, 4 deletions
-rw-r--r--JSImpl/src/Lexer.h12
diff --git a/JSImpl/src/Lexer.h b/JSImpl/src/Lexer.h
index 914b6ed..fb3e0a1 100644
--- a/JSImpl/src/Lexer.h
+++ b/JSImpl/src/Lexer.h
@@ -1,9 +1,8 @@
#pragma once
#include "CommonTypes.h"
-#include <functional>
-enum TokenType
+enum class TokenType
{
// Single-character tokens.
LeftParen,
@@ -98,7 +97,6 @@ enum TokenType
True,
False,
-
Eof,
Invalid
};
@@ -111,4 +109,10 @@ struct Token
double Number;
};
-IPLVector<Token> Tokenize(const char* code, const std::function<void()>& onError = {});
+struct LexerResult
+{
+ bool IsSuccessful;
+ IPLError Error;
+};
+
+LexerResult Tokenize(const char* code, IPLVector<Token>& tokens);