chiark / gitweb /
Parser fixes:
[userv.git] / parser.c
index 5700c3daef099a8b377b87cb3a33102e28e968a2..a5b5fb5fd66de0b10d504a7238c6883efae7190c 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -6,7 +6,7 @@
  * about m4 quoting &c., but we have to #include it so that the C
  * objects from the lexer are available.
  *
- * Copyright (C)1996-1999 Ian Jackson
+ * Copyright (C)1996-1999,2001,2006,2012 Ian Jackson
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -148,7 +148,7 @@ static int dequote(char *inplace) {
   int v;
 
   p=q=inplace;
-  assert(*p++ = '"');
+  assert(*p=='"');  p++;
   while (*p && *p != '"') {
     if (*p != '\\') { *q++= *p++; continue; }
     switch (*++p) {
@@ -183,7 +183,7 @@ static int dequote(char *inplace) {
       }
     }
   }
-  assert(*p); assert(!*++p);
+  assert(*p); p++; assert(!*p);
   *q++= 0;
   return tokv_quotedstring;
 }
@@ -205,6 +205,8 @@ const char *printtoken(int token) {
     return buf;
   } else if (token & tokt_number) {
     snyprintf(buf,sizeof(buf),"number %d",lr_min); return buf;
+  } else if (token & tokt_fdrange && token & tokr_word) {
+    snyprintf(buf,sizeof(buf),"fd %s",buf); return buf;
   } else if (token & tokt_fdrange && lr_max==-1) {
     snyprintf(buf,sizeof(buf),"fdrange %d-",lr_min); return buf;
   } else if (token & tokt_fdrange) {
@@ -422,7 +424,7 @@ static int skip(int allowce) {
 
   for (;;) { /* loop over lines */
     cstate->reportlineno= cstate->lineno;
-    do { token= yylex(); } while (token == tokv_lwsp);
+    do { token= yylex(); } while (token == tokv_lwsp || token == tokv_newline);
     if (token & tokt_exception) {
       return token;
     } else if (token & tokt_controlend) {