Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #39905] [TODO] TGE - line number reporting.

6 views
Skip to first unread message

Will Coleda

unread,
Jul 21, 2006, 6:03:07 PM7/21/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Will Coleda
# Please include the string: [perl #39905]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=39905 >


Once a .tg file is compiled to a .pir file, any errors in the
embedded PIR are reported against the line number
of the generated PIR file.

Instead, the line numbers should be reported against the original .tg
file.


--
Will "Coke" Coleda
wi...@coleda.com


Patrick R. Michaud

unread,
Aug 3, 2006, 11:30:08 AM8/3/06
to perl6-i...@perl.org

Is there an imcc pragma for setting the line number to be reported
for an error? Or what's the general approach to getting the generated
PIR file to report the correct line number?

Pm

Will Coleda

unread,
Aug 3, 2006, 11:36:25 AM8/3/06
to Patrick R. Michaud, perl6-i...@perl.org
From docs/compiler_faq.pod:

=head2 How do I embed source locations in my code for debugging?

You can do this using either the C<setfile> and C<setline> opcodes or
with C-like C<#line> comments:

#line 27 "my_source.file"

Simply set the source file name or line number whenever it changes.
But note that currently (Parrot 0.3.0) both are ignored in the lexer.

--
Will "Coke" Coleda
wi...@coleda.com


Patrick R. Michaud via RT

unread,
Jan 8, 2007, 6:03:44 PM1/8/07
to perl6-i...@perl.org
Now resolved in r16509.

Kudos to Jonathan for implementing RT#40806, which enabled the
#line <nnn> "file" directive needed for this to work.

TGE now reports errors relative to the original .tg file. Thus

error:imcc:The opcode 'say_ic' (say<1>) was not found. Check the type
and number of the arguments
in file 'src/PASTGrammar.tg' line 124

instead of

error:imcc:The opcode 'say_ic' (say<1>) was not found. Check the type
and number of the arguments
in file 'src/PASTGrammar_gen.pir' line 152

I'll note that the line number reported is off-by-one from where it
actually occurs in the file, but that's because Parrot reports PIR
errors as off-by-one, not because of this patch. (When Parrot reports
the correct line number, this will work here also.)

Marking this ticket as "resolved".

Pm


0 new messages