Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#206 syntax validation / error marking is not greedy enough

open
nobody
None
5
2005-09-28
2005-09-28
Anonymous
No

With the new epic version 0.3.12 some errors are not
reported anymore in the "problems" view and also not
marked in the "editor" view.

Culprit for these missing errors is a too weak pattern
for parsing the "perl -c" output.

With a test file like this:
----
#!/usr/bin/perl

use strict;

# no my - reported
$test;

# bad syntax error - not reported
if {}
----

perl -c would give the following output:
...
Global symbol "$test" requires explicit package name at
poe.pl line 6.
syntax error at poe.pl line 9, near "if {"
poe.pl had compilation errors.
...

But in eclipse/epic only the first error is reported.

Looking at the class ParsedErrorLine shows that the
pattern

private static final Pattern errorLineNoPattern =
Pattern.compile("^(.*) at (\\S+) line
(\\d+)\\.$");

is used for error report matching. This matches the
first report of the "perl -c" output, but not the
second report.

So the pattern must be changed or a new case must be
added so that the second error report is also
matched/found and reported/marked.

Discussion

  • Jan Ploski
    Jan Ploski
    2005-09-29

    Logged In: YES
    user_id=86907

    Well observed. I committed a partial fix for CVS: changed the regexp to

    private static final Pattern errorLineNoPattern =
    Pattern.compile("^(.*) at (\\S+) line
    (\\d+)[\\.,]");

    It is still not perfect because it discards the ", near "if {"" part of the error
    message. Still better than ignoring the error altogether. Maybe you know if
    there is a specification of the Perl error messages' format anywhere? EPIC's
    current parser was written by trial and error.

     
  • Logged In: NO

    Hello and thank you for the fast response!

    Regarding the question if there is a specification of the
    error messages of perl:

    I searched a bit, but found nothing really precise.

    Only piece of information I gathered was by grepping through
    the perl source code.

    In file toke.c (lexer for perl) there is a function
    Perl_yyerror that generated messages that resembles error
    messages as I know them.

    But this is mainly guessing as I do not really understand
    what the code is doing.