Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.98.mcz ==================== Summary ==================== Name: Compiler-nice.98 Author: nice Time: 27 November 2009, 12:54:16 pm UUID: 4853aa4f-5bcb-e242-a130-f41f2c4d09ae Ancestors: Compiler-cwp.97 Add support for literal ByteArray #[1 2 3] =============== Diff against Compiler-cwp.97 =============== Item was added: + ----- Method: Scanner>>scanLitByte (in category 'expression types') ----- + scanLitByte + | stream | + stream := (ByteArray new: 16) writeStream. + [ tokenType = #rightBracket or: [ tokenType = #doIt ] ] whileFalse: [ + tokenType = #word + ifTrue: [ self scanLitWord ]. + (token isInteger and: [ token between: 0 and: 255 ]) + ifFalse: [ ^ self offEnd: '8-bit integer or right bracket expected' ]. + stream nextPut: token. + self scanToken ]. + token := stream contents! Item was changed: + ----- Method: Scanner class>>initialize (in category 'initialization') ----- - ----- Method: Scanner class>>initialize (in category 'class initialization') ----- initialize | newTable | + newTable := Array new: 256 withAll: #xBinary. "default" - newTable _ Array new: 256 withAll: #xBinary. "default" newTable atAll: #(9 10 12 13 32 ) put: #xDelimiter. "tab lf ff cr space" newTable atAll: ($0 asciiValue to: $9 asciiValue) put: #xDigit. 1 to: 255 do: [:index | (Character value: index) isLetter ifTrue: [newTable at: index put: #xLetter]]. newTable at: 30 put: #doIt. newTable at: $" asciiValue put: #xDoubleQuote. newTable at: $# asciiValue put: #xLitQuote. newTable at: $$ asciiValue put: #xDollar. newTable at: $' asciiValue put: #xSingleQuote. newTable at: $: asciiValue put: #xColon. newTable at: $( asciiValue put: #leftParenthesis. newTable at: $) asciiValue put: #rightParenthesis. newTable at: $. asciiValue put: #period. newTable at: $; asciiValue put: #semicolon. newTable at: $[ asciiValue put: #leftBracket. newTable at: $] asciiValue put: #rightBracket. newTable at: ${ asciiValue put: #leftBrace. newTable at: $} asciiValue put: #rightBrace. newTable at: $^ asciiValue put: #upArrow. newTable at: $_ asciiValue put: #leftArrow. newTable at: $| asciiValue put: #verticalBar. + TypeTable := newTable "bon voyage!!" - TypeTable _ newTable "bon voyage!!" "Scanner initialize"! 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. - ifTrue: - [self scanToken; scanLitVec. - mark := start+1. tokenType == #doIt ifTrue: [self offEnd: 'Unmatched parenthesis']] + ifFalse: [tokenType = #leftBracket + ifTrue: [self scanToken; scanLitByte. + mark := start + 1. + tokenType == #doIt + ifTrue: [self offEnd: 'Unmatched bracket']] + ifFalse: [(#(#word #keyword #colon ) includes: tokenType) + ifTrue: [self scanLitWord] + ifFalse: [tokenType == #literal + ifTrue: [token isSymbol + ifTrue: ["##word" + token := token + "May want to move toward ANSI + here "]] + ifFalse: [tokenType == #string + ifTrue: [token := token asSymbol]]]]]. - ifFalse: - [(#(word keyword colon ) includes: tokenType) - ifTrue: - [self scanLitWord] - 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 ###Pen + "! - "! |
Hi Nicholas,
how about renaming scanLitByte to scanLitByteVec?
On Fri, Nov 27, 2009 at 3:54 AM, <[hidden email]> wrote: Nicolas Cellier uploaded a new version of Compiler to project The Trunk: |
Free forum by Nabble | Edit this page |