[Newcompiler] SmaCCError reported at the wrong place

Marcus Denker denker at iam.unibe.ch
Mon Oct 9 11:35:33 UTC 2006


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?

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...

> 	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! !



More information about the Newcompiler mailing list