Patch by Matt McCutchen to find levels in current directory when selected from comman...
[supertux.git] / src / lisp / lexer.cpp
index 451cb9a..90f4aa2 100644 (file)
@@ -22,6 +22,7 @@
 #include <cstring>
 #include <stdexcept>
 #include <iostream>
+#include <stdio.h>
 
 #include "lexer.hpp"
 
@@ -102,8 +103,8 @@ Lexer::getNextToken()
       return TOKEN_CLOSE_PAREN;
     case '"': {  // string
       int startline = linenumber;
-      nextChar();
       while(1) {
+        nextChar();
         switch(c) {
         case '"':
           nextChar();
@@ -132,7 +133,8 @@ Lexer::getNextToken()
         default:
           break;
         }
-        addChar();
+        if(token_length < MAX_TOKEN_LENGTH)
+          token_string[token_length++] = c;
       }
 string_finished:
       token_string[token_length] = 0;