Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.225.mcz ==================== Summary ==================== Name: Compiler-nice.225 Author: nice Time: 22 February 2012, 2:57:07.872 pm UUID: 77bbb3ac-e939-4975-a139-f785dc94c17a Ancestors: Compiler-nice.224 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. 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). While at it, set the error insertion mark after the $ character when offended by Scanner>>xDollar. This efficiently reduce the number of failures reported by CompilerNotifyngTest in its Tests-nice.144 version. =============== Diff against Compiler-nice.224 =============== Item was changed: ----- Method: Parser>>expected: (in category 'error handling') ----- expected: aString "Notify a problem at token 'here'." - tokenType == #doIt ifTrue: [hereMark := hereMark + 1]. - hereType == #doIt ifTrue: [hereMark := hereMark + 1]. ^ self notify: aString , ' expected' at: hereMark + requestorOffset! Item was changed: ----- Method: Scanner>>scanToken (in category 'expression types') ----- scanToken [(tokenType := self typeTableAt: hereChar) == #xDelimiter] whileTrue: [self step]. "Skip delimiters fast, there almost always is one." mark := aheadChar == DoItCharacter + ifTrue: [hereChar == DoItCharacter + ifTrue: [source position + 1] + ifFalse: [source position]] - ifTrue: [source position] ifFalse: [source position - 1]. (tokenType at: 1) == $x "x as first letter" ifTrue: [self perform: tokenType "means perform to compute token & type"] ifFalse: [token := self step asSymbol "else just unique the first char"]. ^token! Item was changed: ----- Method: Scanner>>xDollar (in category 'multi-character scans') ----- xDollar "Form a Character literal." + aheadChar == DoItCharacter + ifTrue: + [mark := mark + 1. "Let the notification lie behind the dollar" + ^self offEnd: 'A Character was expected']. - aheadChar == DoItCharacter ifTrue: [^self offEnd: 'A Character was expected']. self step. "pass over $" token := self step. tokenType := #character! |
Bravo!
On Wed, Feb 22, 2012 at 5:57 AM, <[hidden email]> wrote: Nicolas Cellier uploaded a new version of Compiler to project The Trunk: best, Eliot |
Free forum by Nabble | Edit this page |