CPP and parsing it with the correct line numbers.

Tim Perry <tperry@blinksoft.com>
3 Sep 1997 01:04:39 -0400

          From comp.compilers

Related articles
CPP and parsing it with the correct line numbers. tperry@blinksoft.com (Tim Perry) (1997-09-03)
| List of all articles for this month |

From: Tim Perry <tperry@blinksoft.com>
Newsgroups: comp.compilers
Date: 3 Sep 1997 01:04:39 -0400
Organization: Compilers Central
Keywords: C, question

How can I get the correct line number to return an error message to the
user after I have sent a file through CPP? I am not sure what the # 100
include <asdfasf> 1 3, etc stand for and how to handle them in a
lex/bison parser. Any pointers in the right direction would be greatly


Tim Perry
[Different C preprocessors do different things, but the # 100 lines usually
mean that the following line in the preprocessed file was line 100 in the
source file. Do a few experiments with your local CPP and it's not hard
to figure out. Re how to handle them, recognize them in the lexer, not the
parser since they can occur anywhere in the token stream. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.