Skip to main content



      Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » problem line numbers are always 1
problem line numbers are always 1 [message #29252] Fri, 25 July 2008 15:12 Go to next message
Eclipse UserFriend
The issue is that all problem line #s are always 1.

The problem is that
a) nobody calls DLTKToken.setLine (that can be fixed in a particular parser)
b) there is no method DLTKToken.getLine
c) There are line accessor methods in ASTNode, i.e. setLine and getLine
d) Therefore, there is no line number data available to call
IProblem.setSourceLineNumber and/or
to set the IMarker attribute LINE_NUMBER.

Chuck
Re: problem line numbers are always 1 [message #29290 is a reply to message #29252] Mon, 28 July 2008 00:28 Go to previous messageGo to next message
Eclipse UserFriend
Hi Chuck,

- DLTKToken is deprecated and will be removed at some point.

- abstract ASTNode contains no line/column numbers, only offsets - since
offsets are the most essential information when parsing source code.
Additional fields would increase memory usage, but add only the minimal
utility value.

- line number can be easy calculated from offset using standard
org.eclipse.jface.text.DefaultLineTracker, also there is similar class
org.eclipse.dltk.tcl.core.TclParseUtil$CodeModel

Regards,
Alex

Chuck Doucette wrote:
> The issue is that all problem line #s are always 1.
>
> The problem is that
> a) nobody calls DLTKToken.setLine (that can be fixed in a particular parser)
> b) there is no method DLTKToken.getLine
> c) There are line accessor methods in ASTNode, i.e. setLine and getLine
> d) Therefore, there is no line number data available to call
> IProblem.setSourceLineNumber and/or
> to set the IMarker attribute LINE_NUMBER.
>
> Chuck
Re: problem line numbers are always 1 [message #29328 is a reply to message #29290] Mon, 28 July 2008 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Well - the problem is that in the default Problems view, every
problem/marker appears to be on line number 1. If you don't want to maintain
line numbers in the AST Node and/or DLTKToken, then perhaps the code that
creates the problem markers could be changed to recalculate the line
numbers.

Chuck

"Alex Panchenko" <alex@xored.com> wrote in message
news:g6jhq6$gff$1@build.eclipse.org...
> Hi Chuck,
>
> - DLTKToken is deprecated and will be removed at some point.
>
> - abstract ASTNode contains no line/column numbers, only offsets - since
> offsets are the most essential information when parsing source code.
> Additional fields would increase memory usage, but add only the minimal
> utility value.
>
> - line number can be easy calculated from offset using standard
> org.eclipse.jface.text.DefaultLineTracker, also there is similar class
> org.eclipse.dltk.tcl.core.TclParseUtil$CodeModel
>
> Regards,
> Alex
>
> Chuck Doucette wrote:
>> The issue is that all problem line #s are always 1.
>>
>> The problem is that
>> a) nobody calls DLTKToken.setLine (that can be fixed in a particular
>> parser)
>> b) there is no method DLTKToken.getLine
>> c) There are line accessor methods in ASTNode, i.e. setLine and getLine
>> d) Therefore, there is no line number data available to call
>> IProblem.setSourceLineNumber and/or
>> to set the IMarker attribute LINE_NUMBER.
>>
>> Chuck
Re: problem line numbers are always 1 [message #29366 is a reply to message #29328] Mon, 28 July 2008 12:39 Go to previous message
Eclipse UserFriend
DLTK collects problems via IProblemReporter.

IProblemReporter accepts IProblem instances.

IProblem instance should be created by the language developer and should
contain offsets and correct line number. IMHO it is the language
developer responsibility to provide correct line numbers.

Please see how it is implemented in Ruby or TCL.

Regards,
Alex

Chuck Doucette wrote:
> Well - the problem is that in the default Problems view, every
> problem/marker appears to be on line number 1. If you don't want to maintain
> line numbers in the AST Node and/or DLTKToken, then perhaps the code that
> creates the problem markers could be changed to recalculate the line
> numbers.
>
> Chuck
>
> "Alex Panchenko" <alex@xored.com> wrote in message
> news:g6jhq6$gff$1@build.eclipse.org...
>> Hi Chuck,
>>
>> - DLTKToken is deprecated and will be removed at some point.
>>
>> - abstract ASTNode contains no line/column numbers, only offsets - since
>> offsets are the most essential information when parsing source code.
>> Additional fields would increase memory usage, but add only the minimal
>> utility value.
>>
>> - line number can be easy calculated from offset using standard
>> org.eclipse.jface.text.DefaultLineTracker, also there is similar class
>> org.eclipse.dltk.tcl.core.TclParseUtil$CodeModel
>>
>> Regards,
>> Alex
>>
>> Chuck Doucette wrote:
>>> The issue is that all problem line #s are always 1.
>>>
>>> The problem is that
>>> a) nobody calls DLTKToken.setLine (that can be fixed in a particular
>>> parser)
>>> b) there is no method DLTKToken.getLine
>>> c) There are line accessor methods in ASTNode, i.e. setLine and getLine
>>> d) Therefore, there is no line number data available to call
>>> IProblem.setSourceLineNumber and/or
>>> to set the IMarker attribute LINE_NUMBER.
>>>
>>> Chuck
>
>
Previous Topic:[BUILD] R1.0-I
Next Topic:[BUILD] R1.0-I
Goto Forum:
  


Current Time: Sat Jul 05 20:56:45 EDT 2025

Powered by FUDForum. Page generated in 0.04535 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top