On Mon, May 05 2014, Denis Excoffier wrote:
>>> However, i would prefer that you remove one of the blank lines
>>> *after* this #line directive. That way, the linenum variable
>>> is left unchanged.
>>
>> Could you elaborate? Where is this blank line being emitted?
>
> Take a flex-2.5.39 with no patch, feed it with the following foo.lex:
> % cat foo.lex
> /* myline 1 */
> %%
> /* myline 3 */
> %%
> /* myline 5 */ int main() {
> yylex();
> fprintf(stdout, "%s %u\n", __FILE__, __LINE__);
> return(0);
> }
> /* myline 10 */
> %
>
> In the output, you get 2 empty lines just before ‘/* myline 5 */‘. If
> you remove one of these, you get the same effect as with --linenum. I
> think this is preferable to ‘--linenum’ (because you don’t have any
> reason to have 2 empty lines at the first place). Currently, i was not
> able to understand how to make this line disappear.
Wll, with the latest versopn in unstable, I get only one blank
line, which is still off by one lex.yy.c:
--8<---------------cut here---------------start------------->8---
#define YYTABLES_NAME "yytables"
#line 4 "foo.lex"
/* myline 5 */ int main() {
yylex();
fprintf(stdout, "%s %u\n", __FILE__, __LINE__);
return(0);
}
/* myline 10 */
--8<---------------cut here---------------end--------------->8---
> By the way, you also get an unexpected extra empty line after ‘/* myline 10
> */‘. To
> omit this one, the easiest way is to replace ‘OUT_END_CODE ()’ in gen.c with
> outc(‘]’); outc(‘]’); outc(‘)’)
> The drawback is that you don’t get an extra newline in case foo.lex does
> not end with a newline, but you don’t have any source files not ending
> with newline do you?
Well, no extra line here either.
Unfortunately, I do not know how to get rid of any extra lines
either. I shall apply that patch, to see if I can get it to say
manoj
#line 3 "foo.lex"
/* myline 5 */ int main() {
--
Make love, not war.-Hell, do both, get married! Women's restroom, The
Filling Station. Bozeman, Montana.
Manoj Srivastava <[email protected]> <http://www.golden-gryphon.com/>
4096R/C5779A1C E37E 5EC5 2A01 DA25 AD20 05B6 CF48 9438 C577 9A1C
signature.asc
Description: PGP signature

