removed trailing whitespace
[xboard.git] / parser.c
index c4330d1..e0b4ff4 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1,7 +1,7 @@
 /*
  * parser.c --
  *
- * Copyright 2011, 2012 Free Software Foundation, Inc.
+ * Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
  * ------------------------------------------------------------------------
  *
  * GNU XBoard is free software: you can redistribute it and/or modify
@@ -151,10 +151,10 @@ PromoSuffix (char **p)
 {
     char *start = *p;
     if(**p == 'e' && (Match("ep", p) || Match("e.p.", p))) { *p = start; return NULLCHAR; } // non-compliant e.p. suffix is no promoChar!
-    if(**p == '+' && gameInfo.variant == VariantShogi) { (*p)++; return '+'; } 
+    if(**p == '+' && gameInfo.variant == VariantShogi) { (*p)++; return '+'; }
     if(**p == '=' || (gameInfo.variant == VariantSChess) && **p == '/') (*p)++; // optional = (or / for Seirawan gating)
-    if(**p == '(' && (*p)[2] == ')' && isalpha( (*p)[1] )) { (*p) += 3; return (*p)[-2]; }
-    if(isalpha(**p)) return *(*p)++;
+    if(**p == '(' && (*p)[2] == ')' && isalpha( (*p)[1] )) { (*p) += 3; return ToLower((*p)[-2]); }
+    if(isalpha(**p)) return ToLower(*(*p)++);
     if(*p != start) return '='; // must be the optional =
     return NULLCHAR; // no suffix detected
 }
@@ -220,10 +220,9 @@ NextUnit (char **p)
            type[1] = NOTHING; // disambiguator goes in first two positions
            n = 4;
        }
-if(appData.debugMode)fprintf(debugFP, "trial %d,%d,%d,%d  type %d%d%d%d\n", coord[0], coord[1], coord[2], coord[3], type[0], type[1], type[2], type[3]);
        // we always get here; move must be completely read now, with to-square coord(s) at end
        if(n == 3) { // incomplete to-square. Could be Xiangqi traditional, or stuff like fxg
-           if(piece && type[1] == NOTHING && type[0] == NUMERIC && type[2] == NUMERIC && 
+           if(piece && type[1] == NOTHING && type[0] == NUMERIC && type[2] == NUMERIC &&
                (separator == '+' || separator == '=' || separator == '-')) {
                     // Xiangqi traditional
 
@@ -335,7 +334,7 @@ badMove:// we failed to find algebraic move
        if(**p == '[') {
            oldp = ++(*p);
            if(Match("--", p)) { // "[--" could be start of position diagram
-               if(!Scan(']', p) && (*p)[-3] == '-' && (*p)[-2] == '-') return PositionDiagram; 
+               if(!Scan(']', p) && (*p)[-3] == '-' && (*p)[-2] == '-') return PositionDiagram;
                *p = oldp;
            }
            SkipWhite(p);
@@ -356,7 +355,7 @@ badMove:// we failed to find algebraic move
        // ********* SAN Castings *************************************
        if(**p == 'O' || **p == 'o' || **p == '0') {
            int castlingType = 0;
-           if(Match("O-O-O", p) || Match("o-o-o", p) || Match("0-0-0", p) || 
+           if(Match("O-O-O", p) || Match("o-o-o", p) || Match("0-0-0", p) ||
               Match("OOO", p) || Match("ooo", p) || Match("000", p)) castlingType = 2;
            else if(Match("O-O", p) || Match("o-o", p) || Match("0-0", p) ||
                    Match("OO", p) || Match("oo", p) || Match("00", p)) castlingType = 1;