release of version 4.4.2
[xboard.git] / parser.l
index 82957eb..d96b95a 100755 (executable)
--- a/parser.l
+++ b/parser.l
@@ -706,7 +706,10 @@ extern void CopyBoard P((Board to, Board from));
             ff = initialRights[5];\r
             ft = initialRights[4];\r
         }\r
-        fprintf(debugFP, "Parser FRC long %d %d\n", ff, ft);\r
+        if (appData.debugMode) \r
+        {\r
+          fprintf(debugFP, "Parser FRC long %d %d\n", ff, ft);\r
+        };\r
         if(ff < 0 || ft < 0) return 0;\r
     }\r
     sprintf(currentMoveString, "%c%c%c%c",ff+AAA,rf+ONE,ft+AAA,rt+ONE);\r
@@ -846,11 +849,11 @@ extern void CopyBoard P((Board to, Board from));
     return (int) GameIsDrawn;\r
 }\r
 \r
-(([Ww](hite)?)|([Bb](lack)?))" "([Mm]ate(s|ed)?)|([Ww][io]n(s)?.*)  {\r
+(([Ww](hite)?)|([Bb](lack)?))" "(([Mm]ates)|([Ww][io]n(s)?)) { \r
     return (int) (ToUpper(yytext[0]) == 'W' ? WhiteWins : BlackWins);\r
 }\r
 \r
-(([Ww](hite)?)|([Bb](lack)?))" "([Mm]ate(s|ed)?)|([Ll]os[tes]+.*)  {\r
+(([Ww](hite)?)|([Bb](lack)?))" "(([Mm]ated)|([Ll]os[tes]+)) { \r
     return (int) (ToUpper(yytext[0]) == 'W' ? BlackWins : WhiteWins);\r
 }\r
 \r
@@ -919,7 +922,7 @@ extern void CopyBoard P((Board to, Board from));
     return (int) Comment; \r
 }\r
 \r
-\([^()]*(\([^()]*\)[^()]*)+[^()]*\)  {                 /* nested () */\r
+\([^()]*(\([^()]*(\([^()]*(\([^()]*\)[^()]*)*\)[^()]*)*\)[^()]*)+[^()]*\)  { /* very nested () */\r
     return (int) Comment; \r
 }\r
 \r
@@ -985,7 +988,7 @@ int yyoffset()
 static void output(ch)\r
      int ch;\r
 {\r
-    fprintf(stderr, "PARSER BUG: unmatched character '%c' (0%o)\n",\r
+    if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unmatched character '%c' (0%o)\n",\r
            ch, ch);\r
 }\r
 \r
@@ -997,7 +1000,7 @@ static void unput(ch)
        StringToLex--;\r
     } else {\r
        if (unputCount >= UNPUT_BUF_SIZE)\r
-         fprintf(stderr, "PARSER BUG: unput buffer overflow '%c' (0%o)\n",\r
+         if(appData.debugMode) fprintf(debugFP, "PARSER BUG: unput buffer overflow '%c' (0%o)\n",\r
                  ch, ch);\r
        unputBuffer[unputCount++] = ch;\r
     }\r