This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: EOF character in parser


Gagneet Singh wrote:
I am working on a compiler implementation and wish to check if the end
of file has been reached. I know that this can be done using the
yywrap() function in the lex file, but the requirement is that we want
if the EOF is explicitly defined as in the hex value 0x1a, then how do
we reference that.

This sounds like a C library problem. The C library should indicate end-of-file when it sees a 0x1a character. Gcc should not need to check for end-of-file characters, as it uses system calls like read that do it for us.


If you have a broken system, then you could treat 0x1a as whitespace which should give the right result, as then the 0x1a character will be ignored.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]