diff trunk/src/Lexer.d @ 17:9bd0bac79479

- Removed Whitespace from enum list. - Added code to count current number of lines.
author aziz
date Sat, 23 Jun 2007 20:12:03 +0000
parents 476e8e55c1d4
children c48d2125f1e2
line wrap: on
line diff
--- a/trunk/src/Lexer.d	Sat Jun 23 14:23:01 2007 +0000
+++ b/trunk/src/Lexer.d	Sat Jun 23 20:12:03 2007 +0000
@@ -89,6 +89,8 @@
   char* p;
   char* end;
 
+  uint loc = 1; /// line of code
+
   this(char[] text)
   {
     this.text = text;
@@ -111,11 +113,26 @@
 
       if (c == 0)
       {
+        ++p;
         t.type = TOK.EOF;
-        t.end = p+1;
+        t.end = p;
         return;
       }
 
+      if (c == '\n')
+      {
+        c = *++p;
+        ++loc;
+        continue;
+      }
+      else if (c == '\r')
+      {
+        c = *++p;
+        if (c != '\n')
+          ++loc;
+        continue;
+      }
+
       if (isidbeg(c))
       {
       Lidentifier: