On Fri, Mar 02, 2007 at 02:43:19PM +0100, [EMAIL PROTECTED] wrote: > On Friday 02 March 2007 13:39, Edsko de Vries wrote: > > On Fri, Mar 02, 2007 at 01:17:04PM +0100, [EMAIL PROTECTED] wrote: > > > On Friday 02 March 2007 13:01, Edsko de Vries wrote: > > > > Well, no, that's the point. Blank lines should be recorded as NOPs > > > > where possible, so that we know where they are and unparse them. > > > > > > Can you reveal some details regarding what you are trying to do ? > > > > I am working on the front end of phc, an open source framework for > > working on PHP scripts (and hopefully ultimately compiling PHP to native > > machine code-we're getting there). > thanks for explaining this. > > One such program is an unparser that takes a PHP script in our abstract > > representation, and dumps it back to PHP syntax (a pretty printer). This > > is useful because after transforming your PHP script (for example, doing > > some refactoring), you may want to output it again and run it. > in this case you should try to look at location tracking features for each > token. > I think this will solve your problems, and further will not clutter up your > grammar file with white-space handling.
Yes, proper location tracking would solve this problem. I had been working on that, but found it quite difficult to get working. The bison end is not so hard, as it has built-in support for location tracking, but modifying the lexer (generated by flex) to generate the right location information in the first place is non-trivial. If you have a good solution for that, I'd be very interested to hear it! Thanks, Edsko _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison