'From Squeak3.9 of 7 November 2006 [latest update: #7067] on 27 August 2007 at 10:46:53 am'! !Scanner methodsFor: 'multi-character scans' stamp: 'vb 8/26/2007 16:46'! xColon "Allow := for assignment by converting to #_ " aheadChar = $= ifTrue: [self step. tokenType _ #leftArrow. self step. ^ token _ #'_']. aheadChar = $> ifTrue: [self step. tokenType := #pipe. self step. ^ token := #':>']. "Otherwise, just do what normal scan of colon would do" tokenType _ #colon. ^ token _ self step asSymbol! ! !Scanner methodsFor: 'multi-character scans' stamp: 'vb 8/26/2007 16:07'! xSemicolon "Recognize ;; as a single token." aheadChar = $; ifTrue: [self step. tokenType := #pipe. self step. ^ token := #';;']. tokenType _ #semicolon. ^ token _ self step asSymbol! ! !Parser methodsFor: 'expression types' stamp: 'vb 8/26/2007 16:08'! expression (hereType == #word and: [tokenType == #leftArrow]) ifTrue: [^ self assignment: self variable]. hereType == #leftBrace ifTrue: [self braceExpression] ifFalse: [self primaryExpression ifFalse: [^ false]]. (self messagePart: 3 repeat: true) ifTrue: [hereType == #semicolon ifTrue: [self cascade. ^true]. hereType == #pipe ifTrue: [self pipe. ^true]]. ^ true! ! !Parser methodsFor: 'expression types' stamp: 'vb 8/27/2007 10:44'! pipe " {;; message} => MessageNode." self match: #pipe. (self messagePart: 3 repeat: false) ifFalse: [^self expected: 'Pipe']. (hereType == #pipe) ifTrue: [self pipe]. ^true! ! !Scanner class methodsFor: 'class initialization' stamp: 'vb 8/26/2007 15:16'! initialize | newTable | 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: #xSemicolon. 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!!" "Scanner initialize"! ! Scanner initialize!