debug print formatting
[henge/apc.git] / src / lexer.rl
index c7600ae..920d62d 100644 (file)
@@ -141,18 +141,11 @@ int lexer_lexstring
 { uint8_t* p, * ts, * pe, * eof;
   int cs, ntok;
   YYSTYPE lval;
-
   ntok = 0;
   p = ts = str;
   pe = eof =  p + size + 1;
-
-  dprintf("\n|---Begin lexstring on p = %U, pe = %p.---|\n",p, pe);
-
   %%write init;
   %%write exec;
-
-  dprintf("\n|---Ending lexstring of file %U, pushed %d tokens.---|\n",str, ntok);
-
   return ntok;
 }
 
@@ -177,6 +170,7 @@ int lexer_lexfile
   // Mark the end of the filename
   filename_end = iter;
   // Lex from either the last period, if present, or filename end
+  dprintf("%U\n\t",filename);
   ntok = (last_period) ?
     lexer_lexstring(filename, (int)(last_period - filename))
   : lexer_lexstring(filename, (int)(iter - filename));
@@ -185,6 +179,7 @@ int lexer_lexfile
     if (*iter == '\0')
       *iter = '_';
   PUSHPATH(filename);
+  dprintf("\n\t[%i Token%s]\n", ntok, (ntok > 1) ? "s" : "");
   return ntok + 1;
 }
 
@@ -192,14 +187,18 @@ int lexer_lexdir
 ( uint8_t* dirname )
 { int ntok;
   ntok = 0;
+  if (DEBUG) putchar('\t');
   PUSHNAME(dirname);
   PUSHOP(CLOPEN);
+  if (DEBUG) putchar('\n');
   return ntok;
 }
 
 int lexer_closedir
 ( void )
 { int ntok = 0;
+  if (DEBUG) putchar('\t');
   PUSHOP(CLCLOSE);
+  if (DEBUG) putchar('\n');
   return ntok;
 }