Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 19:12 Go to next message
Charles Doucette is currently offline Charles DoucetteFriend
Messages: 125
Registered: July 2009
Senior Member
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 04:28 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
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 14:29 Go to previous messageGo to next message
Charles Doucette is currently offline Charles DoucetteFriend
Messages: 125
Registered: July 2009
Senior Member
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 16:39 Go to previous message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
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: Fri Apr 12 19:06:14 GMT 2024

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

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

Back to the top