[Flex-help] accurate location tracing
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Edsko de V. <dev...@cs...> - 2006-08-12 11:12:25
|
Hi, I have been trying to modify the (Flex generated) scanner of phc (www.phpcompiler.org) to provide accurate location information to the (Bison generated) parser, but so far no luck. For every every token that I return to Bison, I need the exact location (line and column number) of the first character of the token and the exact location (again, line and column number, tokens may span multiple lines) of the last character in the token. The scanner definition itself is reasonably complicated, with a dozen or so exclusive start condition and use of unput etc., so I'd prefer if I can do this centrally somewhere rather than having the logic of maintaining location information spread throughout the scanner definition. Perhaps the easiest way to do this would be to modify Flex itself so support this automatically? If so, I'd appreciate a few pointers where to start looking in the Flex source. Thanks, Edsko |