Browse Source

working on error emitting bug

Nicolas Winkler 6 years ago
parent
commit
fef00d272e
3 changed files with 11 additions and 11 deletions
  1. 2 2
      src/Logging.h
  2. 1 1
      src/ast/AstVisitor.cpp
  3. 8 8
      src/ast/lexer.l

+ 2 - 2
src/Logging.h

@@ -62,7 +62,7 @@ private:
 #ifdef DEBUGGING
     LogLevel logLevel = LogLevel::DEBUG;
 #else
-    LogLevel logLevel = LogLevel::DEBUG;
+    LogLevel logLevel = LogLevel::WARNING;
 #endif
 
     static Logger instance;
@@ -82,7 +82,7 @@ public:
 
     inline std::ostream& operator()(LogLevel ll)
     {
-        if (logLevel >= ll) {
+        if (logLevel <= ll) {
             return *this;
         }
         else {

+ 1 - 1
src/ast/AstVisitor.cpp

@@ -387,7 +387,7 @@ std::unique_ptr<sem::SemanticObject> StructureVisitor::visit(ast::BinaryOperatio
     auto leftEval = unique_dynamic_cast<sem::Expression>(ast.left->accept(*this, scope));
     auto rightEval = unique_dynamic_cast<sem::Expression>(ast.right->accept(*this, scope));
     
-    throw "TODO implement";
+    throw SemanticError(SemanticError::OPERATOR_NOT_FOUND, "TODO implement", ast.pos);
     /*
     sem::Method* operationMethod = leftEval->type->getScope().resolveMethod(
         ast.opString, { rightEval->type }

+ 8 - 8
src/ast/lexer.l

@@ -40,14 +40,14 @@
 extern "C" int qlow_parser_wrap(yyscan_t s);
 
 // TODO rewrite
-#define YY_USER_ACTION                          \
-  do {                                          \
-    yylloc_param->first_line = yylineno;     \
-    yylloc_param->first_column = yyg->yyextra_r;     \
-    yyg->yyextra_r += yyleng;                           \
-    yylloc_param->last_line = yylineno;      \
-    yylloc_param->last_column = yyg->yyextra_r;      \
-    yylloc_param->filename = nullptr; \
+#define YY_USER_ACTION                                \
+  do {                                                \
+    yylloc_param->first_line = yylineno;              \
+    yylloc_param->first_column = yyg->yyextra_r;      \
+    yyg->yyextra_r += yyleng;                         \
+    yylloc_param->last_line = yylineno;               \
+    yylloc_param->last_column = yyg->yyextra_r;       \
+    yylloc_param->filename = nullptr;                 \
   } while(0);
 %}