[Newcompiler] SmaCCError reported at the wrong place
Mathieu Suen
mathieusuen at yahoo.fr
Mon Oct 9 16:33:24 UTC 2006
Marcus Denker a écrit :
>
> On 03.10.2006, at 19:49, Mathieu Suen wrote:
>
>> Hi,
>>
>> I have noticed that SmaCCError wasn't notify at the right place in th
>> Workspace and whenever you do
>> a doIt or inspectIt...
>>
>> So I propose a patch. See attached file
>>
>> Do you want me to report the bug to mantis?
>>
>> The patch is not really pretty but unless it solve the problem.
>>
>
>
> There is one problem. Imagine a Workspace with this content:
>
> 1 + 3333
> 1 +
>
>
> now select the second "1 + "--> doit. Now it, even after the fix, will
> show the error to be after the first "1 +", as this is what you found
> when searching...
>
> So the question is: why does the "location" encode the location
> relative to the selection, not relative to the whole workspace?
Yes you are right
I haven't investigate to find out a way to encode the location relative to the selection.
I don't know the impact of having the whole workspace in source.
I will investigate it. Thanks for point out the problem.
>
> When you turn off the newcompiler and use the old one, then
> this is the case: Parser>>notify: string at: location has the
> "location" as the offsett to the complete workspace string...
Yes I saw it.
>
>> Math
>> 'From Squeak3.9gamma of ''23 July 2006'' [latest update: #7061] on 3
>> October 2006 at 7:39:39 pm'!
>>
>> !Parser2 methodsFor: 'error handling' stamp: 'ms 10/3/2006 19:39'!
>> notify: string at: location
>>
>> | startLocation |
>> requestor isNil
>> ifTrue: [SyntaxError
>> errorInClass: (self classEncoding ifNil:
>> [FakeClassPool])
>> withCode:
>> (source contents
>> copyReplaceFrom: location
>> to: location - 1
>> with: string , ' ->')
>> doitFlag: doitFlag]
>> ifFalse: [startLocation := requestor text asString findString:
>> source contents.
>> requestor
>> notify: string , ' ->'
>> at: location + startLocation - 1
>> in: source].
>> ^self fail! !
>
>
___________________________________________________________________________
Découvrez un nouveau moyen de poser toutes vos questions quel que soit le sujet !
Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences.
http://fr.answers.yahoo.com
More information about the Newcompiler
mailing list