Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.122.mcz ==================== Summary ==================== Name: Compiler-nice.122 Author: nice Time: 24 February 2010, 2:02:09.348 am UUID: 74bd56ce-6d06-c446-bd8b-eac2908c4b0b Ancestors: Compiler-nice.121 Forbid the construction (- 1) The minus sign now MUST NOT be separated from the literal number. RATIONALE: this syntax is not Smalltalk, not portable, not documented, not the same inside #(- 1) and is just adding confusion to the -1 rule, especially since the binary selectors can now embed a $- at any place. WARNING: THIS MIGHT INTRODUCE INCOMPATIBILITY IN PACKAGES we might introduce a Preferences if the case shows up. I did a Compiler recompileAll, which works fine in trunk. In order to achieve this, I had to first correct the hereEnd and mark instance variables near end of stream. The scanner scans two letters ahead, so it clearly has to test both aheadChar then hereChar. Previously, it did decide on source atEnd and hereChar only, which was a bogus for example in case of a trailing separator in source. WARNING: hope this won't break any obscure workaround in Debugger selection. =============== Diff against Compiler-nice.121 =============== Item was changed: ----- Method: Parser>>advance (in category 'scanning') ----- advance | this | prevMark := hereMark. prevEnd := hereEnd. this := here. here := token. hereType := tokenType. hereMark := mark. + hereEnd := source position - ((aheadChar == 30 asCharacter and: [source atEnd]) + ifTrue: [hereChar == 30 asCharacter + ifTrue: [0] + ifFalse: [1]] + ifFalse: [2]). - hereEnd := source position - (source atEnd ifTrue: [hereChar == 30 asCharacter ifTrue: [0] ifFalse: [1]] ifFalse: [2]). self scanToken. "Transcript show: 'here: ', here printString, ' mark: ', hereMark printString, ' end: ', hereEnd printString; cr." ^this! Item was changed: ----- Method: Parser>>primaryExpression (in category 'expression types') ----- primaryExpression hereType == #word ifTrue: [parseNode := self variable. (parseNode isUndefTemp and: [self interactive]) ifTrue: [self queryUndefined]. parseNode nowHasRef. ^ true]. hereType == #leftBracket ifTrue: [self advance. self blockExpression. ^true]. hereType == #leftBrace ifTrue: [self braceExpression. ^true]. hereType == #leftParenthesis ifTrue: [self advance. self expression ifFalse: [^self expected: 'expression']. (self match: #rightParenthesis) ifFalse: [^self expected: 'right parenthesis']. ^true]. (hereType == #string or: [hereType == #number or: [hereType == #literal]]) ifTrue: [parseNode := encoder encodeLiteral: self advance. ^true]. + (here == #- and: [tokenType == #number and: [1 + hereEnd = mark]]) - (here == #- and: [tokenType == #number]) ifTrue: [self advance. parseNode := encoder encodeLiteral: self advance negated. ^true]. ^false! 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 == 30 asCharacter and: [source atEnd]) + ifTrue: [source position] + ifFalse: [source position - 1]. - mark := 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! |
Free forum by Nabble | Edit this page |