help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Regarding EOF while reading from a file


From: Robins_Lazer
Subject: Regarding EOF while reading from a file
Date: Tue, 7 May 2002 21:09:58 +0530

Hi ,

I am facing a peculiar problem. The lexer is getting EOF character well before the actual EOF while reading from the input file during the lexer-parser communication for parsing.

This is leading to incorrect behavior of the parser.
This happens only when the test cases are submitted in through the regression suites. But the same thing does not happen when the test cases are submitted individually.

Does anybody have any idea about this problem??

I have defined YY_INPUT as follows:

#define YY_INPUT(buf,result,max_size) \
{ \
    int  nc = 0;                                     \
    long cp = 0;                                     \
    int c = fgetc(yyin);                             \
    if (c != EOF)   {                                \
       if (c == CARRIAGE_RETURN_CHAR) {              \
           cp = ftell(yyin);                         \
           nc = fgetc(yyin);                         \
           if (nc == NEW_LINE_CHAR)                  \
                c = nc;                              \
           else {                                    \
               if (nc == EOF)                        \
                   c = EOF;                          \
               else {                                \
                   c = NEW_LINE_CHAR;                \
                   fseek(yyin, cp, SEEK_SET);        \
                   fflush(yyin);                     \
              }                                      \
          }                                          \
      }                                              \
    }                                                \
    result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
}

Regards
Robins
**************************************************************************
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.

**************************************************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]