src/lexer_scanner.cc

changeset 82
841562f5a32f
parent 79
2425fa6a4f21
child 85
264a61e9eba0
--- a/src/lexer_scanner.cc	Sat Jan 18 02:11:45 2014 +0200
+++ b/src/lexer_scanner.cc	Sun Jan 19 20:16:00 2014 +0200
@@ -77,7 +77,9 @@
 	"do",
 	"else",
 	"event",
+	"eventdef",
 	"for",
+	"funcdef",
 	"goto",
 	"if",
 	"int",
@@ -194,7 +196,7 @@
 		while (*m_ptr != '\"')
 		{
 			if (!*m_ptr)
-				return false;
+				error ("unterminated string");
 
 			if (check_string ("\\n"))
 			{
@@ -216,7 +218,7 @@
 		}
 
 		m_token_type = tk_string;
-		m_ptr++; // skip the final quote
+		skip(); // skip the final quote
 		return true;
 	}
 
@@ -233,13 +235,13 @@
 	{
 		m_token_type = tk_symbol;
 
-		while (m_ptr != '\0')
+		do
 		{
 			if (!is_symbol_char (*m_ptr, true))
 				break;
 
 			m_token_text += *m_ptr++;
-		}
+		} while (*m_ptr != '\0');
 
 		return true;
 	}
@@ -276,3 +278,15 @@
 	assert ((int) a <= tk_last_named_token);
 	return g_token_strings[a];
 }
+
+// =============================================================================
+//
+string lexer_scanner::read_line()
+{
+	string line;
+
+	while (*m_ptr != '\n')
+		line += *(m_ptr++);
+
+	return line;
+}
\ No newline at end of file

mercurial