Levente Uzonyi uploaded a new version of Compiler to project The Trunk: http://source.squeak.org/trunk/Compiler-ul.202.mcz
==================== Summary ====================
Name: Compiler-ul.202 Author: ul Time: 2 April 2011, 12:44:12.796 am UUID: e7e9151c-c2e9-b14a-bb57-68e6ea8daea5 Ancestors: Compiler-nice.201
- reject literals with superfluous # at the beginning, like #$a #123 ##foo ##(1 2 3), etc - introduced #character type for characters instead of #number (part 1)
=============== Diff against Compiler-nice.201 ===============
Item was changed: ----- Method: Parser>>pragmaLiteral: (in category 'pragmas') ----- pragmaLiteral: selectorSoFar "Read a pragma literal. As a nicety we allow a variable name (rather than a literal string) as the second argument to primitive:error:"
+ (hereType == #string or: [ hereType == #literal or: [ hereType == #number or: [ hereType == #character ] ] ]) - (hereType == #string or: [ hereType == #literal or: [ hereType == #number ] ]) ifTrue: [ ^ self advance ]. (here == $# and: [ tokenType == #word ]) ifTrue: [ ^ self advance ]. (here == #- and: [ tokenType == #number ]) ifTrue: [ ^ (self advance; advance) negated ]. (here = 'true' or: [ here = 'false' or: [ here = 'nil' ] ]) ifTrue: [ ^ Compiler evaluate: self advance ]. "This nicety allows one to supply a primitive error temp as a variable name, rather than a string." ((selectorSoFar beginsWith: 'primitive:') and: [(selectorSoFar endsWith: 'error:') and: [hereType == #word]]) ifTrue: [^self advance]. ^self expected: 'Literal constant'!
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 or: [hereType == #character]]]) - (hereType == #string or: [hereType == #number or: [hereType == #literal]]) ifTrue: [parseNode := encoder encodeLiteral: self advance. ^true]. (here == #- and: [tokenType == #number and: [1 + hereEnd = mark]]) ifTrue: [self advance. parseNode := encoder encodeLiteral: self advance negated. ^true]. ^false!
Item was changed: ----- Method: Scanner>>xLitQuote (in category 'multi-character scans') ----- xLitQuote "Symbols and vectors: #(1 (4 5) 2 3) #ifTrue:ifFalse: #'abc'." | start | start := mark. self step. "litQuote" self scanToken. tokenType == #leftParenthesis ifTrue: [self scanToken; scanLitVec. mark := start + 1. tokenType == #doIt ifTrue: [self offEnd: 'Unmatched parenthesis']] ifFalse: [tokenType == #leftBracket ifTrue: [self scanToken; scanLitByteVec. mark := start + 1. tokenType == #doIt ifTrue: [self offEnd: 'Unmatched bracket']] ifFalse: [(tokenType == #word or: [tokenType == #keyword or: [tokenType == #colon]]) ifTrue: [self scanLitWord] + ifFalse: [tokenType == #string + ifTrue: [token := token asSymbol] + ifFalse: [(tokenType == #binary or: [ tokenType == #verticalBar ]) + ifFalse: [self notify: 'Invalid literal character' at: start + 1]]]]]. - ifFalse: ["tokenType == #literal - ifTrue: [token isSymbol - ifTrue: [""##word"" - token := token - ""May want to move toward ANSI - here ""]] - ifFalse: ["tokenType == #string - ifTrue: [token := token asSymbol]"]"]]]. mark := start. tokenType := #literal
"#(Pen) #Pen #'Pen' ##Pen ###Pen "!
packages@lists.squeakfoundation.org