> Hugs (Version 971118) chokes on Sort with
> 
>   Reading file "Sort.hs":
>   Parsing........................................................................
>   ERROR "Sort.hs" (line 3): Improperly terminated string
> 
> Even with the string commented out, anything that follows seems to be ignored.

Thanks for the report.  Your program, boils down to:

x = "\377" 

where \377 is a single character with ascii code 255.
This was being confused with the EOF marker whoase value is -1.

The attached patch seems to solve this problem.

> PS: Directory.hs?

Will be part of the merged GHC-Hugs system.
In the meantime, you could implement it yourself using GreenCard
 (which I put in the hugs/ALPHA directory last night)

Alastair

*** /home/reid/dev/C/winnt/Profiles/Administrator/hugs/src/input.c      Fri 
Nov  7 04:26:22 1997
--- input.c     Thu Nov 20 11:19:20 1997
***************
*** 241,245 ****
  static  String currentLine;            /* editline or GNU readline         */
  static  String nextChar;
! #define nextConsoleChar()   (*nextChar=='\0' ? '\n' : *nextChar++)
  extern  Void add_history    Args((String));
  extern  String readline     Args((String));
--- 241,245 ----
  static  String currentLine;            /* editline or GNU readline         */
  static  String nextChar;
! #define nextConsoleChar()   (unsigned char)(*nextChar=='\0' ? '\n' : 
*nextChar++)
  extern  Void add_history    Args((String));
  extern  String readline     Args((String));
***************
*** 512,516 ****
          } 
          else if (reading==STRING) {
!           c1 = *nextStringChar++;
            if (c1 == '\0')
                c1 = EOF;
--- 512,516 ----
          } 
          else if (reading==STRING) {
!           c1 = (unsigned char) *nextStringChar++;
            if (c1 == '\0')
                c1 = EOF;
***************
*** 524,541 ****
                  else {
                      linePtr = 0;
!                     c1 = lineBuffer[linePtr++];
                  }
              }
              else {
!                 c1 = lineBuffer[linePtr++];
              }
        }
  
      }
-     /* Coercing a non-ASCII (>= 128) character to an int produces a -ve
-      * number so we have to patch it up a little. ADR
-      */
-     if (c1 != EOF)
-         c1 &= CHAR_MASK;
  }
  
--- 524,536 ----
                  else {
                      linePtr = 0;
!                     c1 = (unsigned char)lineBuffer[linePtr++];
                  }
              }
              else {
!                 c1 = (unsigned char)lineBuffer[linePtr++];
              }
        }
  
      }
  }


Reply via email to