Explorar o código

added comment support

Noah %!s(int64=4) %!d(string=hai) anos
pai
achega
2dd3afa1f1
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      src/tibasic.cpp

+ 8 - 0
src/tibasic.cpp

@@ -56,8 +56,16 @@ bool Compiler::compile(string inFile, string outFile)
     {
         getline(f, tmpLine, '\n');
 
+        // ignore comments
+        tmpLine = tmpLine.substr(0, tmpLine.find("#", 0));
+
+        // ignore empty lines
         if(!tmpLine.length())
+        {
+            //log(Debug, "Line with only whitespaces / comments detected!");
             continue;
+        }
+
 
         // Parse.
         token_t token;