Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / src / main.cpp
diff options
context:
space:
mode:
Commit202194341e3697d77077aa50652acf1042350997 (patch)
Author
 Martin Dobrev <martindobrev0@gmail.com>
2018-10-15 09:00:16 +0300
Committer
 GitHub <noreply@github.com>
2018-10-15 09:00:16 +0300
Filesd530d0243407e86be9e9116e3853bf7992757ebd /JSImpl/src/main.cpp
IPL-202194341e3697d77077aa50652acf1042350997.tar
IPL-202194341e3697d77077aa50652acf1042350997.tar.gz
IPL-202194341e3697d77077aa50652acf1042350997.zip
Parent6c7fc844cebe201408017602ff54bf442df0da25 (diff)
Parentf671c0492871418a7b6fed235196b85f79236cff (diff)
Merge branch 'master' into lexer-errors-handling
1 files changed, 15 insertions, 12 deletions
-rw-r--r--JSImpl/src/main.cpp27
diff --git a/JSImpl/src/main.cpp b/JSImpl/src/main.cpp
index 655ee17..bd57ce7 100644
--- a/JSImpl/src/main.cpp
+++ b/JSImpl/src/main.cpp
@@ -1,9 +1,11 @@
#include "Lexer.h"
#include "Parser.h"
+#include "ASTPrinter.h"
#include <iostream>
#define LOG(msg) std::cout << msg << std::endl
#define EXECUTE_TEST(test) std::cout << #test << " "; test();
-#define CHECK(cond) cond ? LOG("PASS") : LOG("FAIL")
+
+#define CHECK(cond) if (cond) {LOG("PASS");} else {LOG(#cond " FAIL");}
// Lexer Tests
void TestLess()
@@ -96,22 +98,23 @@ void TestParseUnaryExpr()
// TODO make actual test :D
auto expr = Parse(tokens);
+ ASTPrinter p(std::cout);
+ expr->Accept(p);
}
int main()
{
- EXECUTE_TEST(TestLess);
- EXECUTE_TEST(TestNumber);
- EXECUTE_TEST(TestNumberStartWithNine);
- EXECUTE_TEST(TestNumberStartWithZero);
- EXECUTE_TEST(TestString);
- EXECUTE_TEST(TestSpaceNewLineSpace);
- EXECUTE_TEST(TestStringSingleQuotedStrings);
- EXECUTE_TEST(TestKeyWord);
- EXECUTE_TEST(TestVariableDeclaration);
- EXECUTE_TEST(TestStringError);
+ //EXECUTE_TEST(TestLess);
+ //EXECUTE_TEST(TestNumber);
+ //EXECUTE_TEST(TestNumberStartWithNine);
+ //EXECUTE_TEST(TestNumberStartWithZero);
+ //EXECUTE_TEST(TestString);
+ //EXECUTE_TEST(TestSpaceNewLineSpace);
+ //EXECUTE_TEST(TestStringSingleQuotedStrings);
+ //EXECUTE_TEST(TestKeyWord);
+ //EXECUTE_TEST(TestVariableDeclaration);
- //EXECUTE_TEST(TestParseUnaryExpr);
+ TestParseUnaryExpr();
#if defined(_WIN32)
std::system("pause");
#endif