[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: Line numbers
- From: Denis Barbier <nospam@thanx>
- Date: Wed, 10 Oct 2001 11:23:58 +0200
On Wed, Oct 10, 2001 at 10:52:13AM +0200, Ghislaine Labouret wrote:
> On Sat, 6 Oct 2001 00:04:37 +0200, Denis Barbier wrote:
>
> > > Also, I noticed that error lines given by WML do not correspond to
> > > "real" lines (vim's line count for exemple) when using \ at the end of
> > > lines: a lines ending with \ and the following one is counted as a
> > > single line. This makes debugging more difficult...
> >
> > You are right :(
> > But I did not find exactly where does this problem come from, I am not
> > sure it is caused by escaped newlines.
>
> I guess the line count is performed after regrouping lines ending with \
> and stripping comment lines. Here are exemples of what I was refering
> to:
>
> Input:
> 1.
> 2. \
> 3. Source line number for mp4h: <__line__>
>
> Output:
> 1.
> 2. 3. Source line number for mp4h: 2
>
> But the line in the source is 3 if not taking the \ into account.
> Same for the line number given when issuing a warning:
>
> Input:
> 1.
> 2. \
> 3. Error: <ifeq
>
> Output:
> /usr/local/lib/wml/exec/wml_p2_mp4h: ERROR:toto.wml:2: EOF when reading
> argument of the `ifeq' tag
> ** WML:Break: Error in Pass 2 (rc=1).
>
> Also, comment lines are not counted:
>
> Input:
> 1.
> #2.
> 3. Source line number for mp4h: <__line__>
>
> Output:
> 1.
> 3. Source line number for mp4h: 2
Oh yes I see now. There is indeed a line number mismatch; note that
it should be fixed after including files via #use or #include, because
these directives add proper <__line__> tags to let pass 2 know where
these lines are in input file. There is unfortunately no general
solution to this problem, maybe I could acknowledge line numbers are
not accurate in documentation.
In order to debug, you may preprocess your file with a filter which
replaces vomments and trailing backslashes by <dnl>, e.g. fixline.pl
#!/usr/bin/perl
while (<>) {
chomp;
s/^\s*#(?!use|include|depends).*$/<dnl>/;
s/\\\s*$/<dnl>/;
print $_."\n";
}
and run wml -P ./fixline.pl
--
Denis Barbier
WML Maintainer
______________________________________________________________________
Website META Language (WML) www.engelschall.com/sw/wml/
Official Support Mailing List sw-wml@engelschall.com
Automated List Manager majordomo@engelschall.com