diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user
new file mode 100644
index 0000000..0c47ec8
--- /dev/null
+++ b/CMakeLists.txt.user
@@ -0,0 +1,480 @@
+
+
+
+
+
+ EnvironmentId
+ {3fb93d8a-9d4c-46aa-821b-80ac79602a86}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+ true
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.6.1 MinGW 32bit
+ Desktop Qt 5.6.1 MinGW 32bit
+ qt.56.win32_mingw49_kit
+ 0
+ 0
+ 2
+
+
+ CMAKE_CXX_COMPILER:FILEPATH=C:/Dev/mingw32/bin/g++.exe
+
+ C:/Users/Yoann/Documents/Informatique/GitHub/Blang-build
+
+
+
+
+ all
+
+ true
+ Make
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+
+
+ clean
+
+ true
+ Make
+
+ CMakeProjectManager.MakeStep
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Default
+ Default
+ CMakeProjectManager.CMakeBuildConfiguration
+
+ 1
+
+
+ 0
+ Deploy
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy locally
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ PreBlang
+
+
+ C:/Users/Yoann/Documents/Informatique/GitHub/Blang-build/tools/PreBlang
+ -1
+
+ PreBlang
+
+ CMakeProjectManager.CMakeRunConfiguration.PreBlang
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ Lex
+
+
+ C:/Users/Yoann/Documents/Informatique/GitHub/Blang-build/tools/lex
+ -1
+
+ Lex
+
+ CMakeProjectManager.CMakeRunConfiguration.Lex
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ Blang
+
+
+ C:/Users/Yoann/Documents/Informatique/GitHub/Blang-build/src
+ 2
+
+ Blang
+
+ CMakeProjectManager.CMakeRunConfiguration.Blang
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ LibBlangTests
+
+
+ C:/Users/Yoann/Documents/Informatique/GitHub/Blang-build/unittests/libblang
+ -1
+
+ LibBlangTests (disabled)
+
+ CMakeProjectManager.CMakeRunConfiguration.LibBlangTests
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ lexTest
+
+
+ C:/Users/Yoann/Documents/Informatique/GitHub/Blang-build/unittests/lex
+ -1
+
+ lexTest (disabled)
+
+ CMakeProjectManager.CMakeRunConfiguration.lexTest
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ MustacheTest
+
+
+ C:/Users/Yoann/Documents/Informatique/GitHub/Blang-build/unittests/Mustache
+ -1
+
+ MustacheTest (disabled)
+
+ CMakeProjectManager.CMakeRunConfiguration.MustacheTest
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 6
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 18
+
+
+ Version
+ 18
+
+
diff --git a/src/include/Lexer.hpp b/src/include/Lexer.hpp
index 7409144..67b3f5b 100644
--- a/src/include/Lexer.hpp
+++ b/src/include/Lexer.hpp
@@ -8,16 +8,25 @@
#include "TokenList.hpp"
namespace Blang{
- class Lexer
- {
- public:
- TokenList tokenize(std::string);
- TokenList tokenizeFile(std::string);
- private:
- static std::map _tokenRegexMap;
+class Buffer{
+public:
+ Buffer(const std::string& text);
- };
+ char nextChar();
+ std::string nextChars(int n);
+
+private:
+ std::string _text;
+};
+
+class Lexer
+{
+public:
+ TokenList tokenize(const std::string& text);
+ TokenList tokenizeFile(const std::string& filename);
+
+};
}
#endif
diff --git a/src/include/Token.hpp b/src/include/Token.hpp
index 4094b2e..a410317 100644
--- a/src/include/Token.hpp
+++ b/src/include/Token.hpp
@@ -6,40 +6,42 @@
#include "SourceLocation.hpp"
namespace Blang{
- class Token{
- public:
+class Token{
+public:
- enum TokenKind{
- Token_StringLiteral,
- Token_NumberLiteral,
- Token_Operator,
- Token_Keyword,
- Token_Identifier,
- Token_EndOfStatement,
- Token_Unknown,
- Token_Whitespace,
- Token_LeftDelimiter,
- Token_RightDelimiter
- };
+ enum TokenKind{
+ Token_StringLiteral,
+ Token_NumberLiteral,
+ Token_Operator,
+ Token_Keyword,
+ Token_Identifier,
+ Token_EndOfStatement,
+ Token_Unknown,
+ Token_Whitespace,
+ Token_LeftDelimiter,
+ Token_RightDelimiter
+ };
- void setText(std::string);
- std::string text();
+ Token(TokenKind kind, const std::string& txt);
- void setKind(TokenKind);
- TokenKind kind();
+ void setText(std::string);
+ std::string text();
- const Token& operator=(Token const & second) const;
+ void setKind(TokenKind);
+ TokenKind kind();
- bool operator==(Token const & second) const;
+ const Token& operator=(Token const & second) const;
- private:
- SourceLocation _loc;
+ bool operator==(Token const & second) const;
- std::string _text;
+private:
+ SourceLocation _loc;
- TokenKind _kind;
+ std::string _text;
- };
+ TokenKind _kind;
+
+};
}
#endif
diff --git a/src/lib/Lexer.cpp b/src/lib/Lexer.cpp
index 95ed68d..307afc4 100644
--- a/src/lib/Lexer.cpp
+++ b/src/lib/Lexer.cpp
@@ -1,9 +1,46 @@
#include "Lexer.hpp"
+#include "TokenList.hpp"
-Blang::Lexer::tokenize(std::string text){
+#include
+#include
+#include