[Top][All Lists]

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

Re: #line %foo

From: Paul Eggert
Subject: Re: #line %foo
Date: Thu, 7 Nov 2002 22:04:03 -0800 (PST)

I have some qualms about that patch, for the following reasons:

 * #line isn't documented.

 * The other Bison directives all begin with "%", but "#line" begins with "#".

 * The other Bison directives are all free format, but "#line" has a
   rigid format: it must start in column 1, it must have exactly one
   space after the "line", etc.

 * #line affects the output file name.  For example, if the last #line
   directive is `#line 100 "foo"', then the output of is placed into and  I don't think this is desirable.

Smaller points:

 * flex -p -p complains about the regex used for #line, saying that
   "^" slows things down a bit.

 * There is no way for #line to represent a file name containing a
   double-quote character.  The usual escapes for file names (used in
   the C-langauge #line directive) do not work.

 * There is no overflow checking if the line number is too large.

 * The output sometimes uses the line number of #line combined with
   the original input file name.  E.g. if the input file foo.y contains

      #line 89 "bar.y"

   then the output looks like this:
      #line 89 "foo.y"
      typedef union {

   The "foo.y" is bogus; it should be "bar.y".

That patch looks like a quick hack that was intended for a specific
purpose.  Can you say what the purpose was?  Perhaps there's a
different way to do it that doesn't involve adding #line support
specifically to Bison.

reply via email to

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