Bravo!<br><br><div class="gmail_quote">On Wed, Feb 22, 2012 at 5:57 AM, <span dir="ltr"><<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Nicolas Cellier uploaded a new version of Compiler to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Compiler-nice.225.mcz" target="_blank">http://source.squeak.org/trunk/Compiler-nice.225.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Compiler-nice.225<br>
Author: nice<br>
Time: 22 February 2012, 2:57:07.872 pm<br>
UUID: 77bbb3ac-e939-4975-a139-f785dc94c17a<br>
Ancestors: Compiler-nice.224<br>
<br>
Remove the ugly hack in Parser>>expected: which was modifying the error message insertion mark depending on the fact that we were at end of token stream a,d/or end of source character stream.<br>
<br>
Replace it with a proper mark in Scanner>>scanToken that correctly take into account the two step of advance handled by the Scanner (stateful is harmful and require high precision surgery).<br>
<br>
While at it, set the error insertion mark after the $ character when offended by Scanner>>xDollar.<br>
<br>
This efficiently reduce the number of failures reported by CompilerNotifyngTest in its Tests-nice.144 version.<br>
<br>
=============== Diff against Compiler-nice.224 ===============<br>
<br>
Item was changed:<br>
----- Method: Parser>>expected: (in category 'error handling') -----<br>
expected: aString<br>
"Notify a problem at token 'here'."<br>
<br>
- tokenType == #doIt ifTrue: [hereMark := hereMark + 1].<br>
- hereType == #doIt ifTrue: [hereMark := hereMark + 1].<br>
^ self notify: aString , ' expected' at: hereMark + requestorOffset!<br>
<br>
Item was changed:<br>
----- Method: Scanner>>scanToken (in category 'expression types') -----<br>
scanToken<br>
<br>
[(tokenType := self typeTableAt: hereChar) == #xDelimiter]<br>
whileTrue: [self step]. "Skip delimiters fast, there almost always is one."<br>
mark := aheadChar == DoItCharacter<br>
+ ifTrue: [hereChar == DoItCharacter<br>
+ ifTrue: [source position + 1]<br>
+ ifFalse: [source position]]<br>
- ifTrue: [source position]<br>
ifFalse: [source position - 1].<br>
(tokenType at: 1) == $x "x as first letter"<br>
ifTrue: [self perform: tokenType "means perform to compute token & type"]<br>
ifFalse: [token := self step asSymbol "else just unique the first char"].<br>
^token!<br>
<br>
Item was changed:<br>
----- Method: Scanner>>xDollar (in category 'multi-character scans') -----<br>
xDollar<br>
"Form a Character literal."<br>
<br>
+ aheadChar == DoItCharacter<br>
+ ifTrue:<br>
+ [mark := mark + 1. "Let the notification lie behind the dollar"<br>
+ ^self offEnd: 'A Character was expected'].<br>
- aheadChar == DoItCharacter ifTrue: [^self offEnd: 'A Character was expected'].<br>
self step. "pass over $"<br>
token := self step.<br>
tokenType := #character!<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>