|
|
Re: problem line numbers are always 1 [message #29328 is a reply to message #29290] |
Mon, 28 July 2008 14:29 |
Charles Doucette 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 |
Alex Panchenko 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
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02316 seconds