1: ================================================================================
  2: 
  3: Smalltalk defineClass: #SynapseTokenStream
  4:     superclass: #{Core.Object}
  5:     indexedType: #none
  6:     private: false
  7:     instanceVariableNames: 'tokenCollection currentIndex '
  8:     classInstanceVariableNames: ''
  9:     imports: ''
 10:     category: ''
 11: 
 12: ================================================================================
 13: 
 14: SynapseTokenStream method for 'accessing'
 15: 
 16: currentIndex
 17: 
 18:     currentIndex ifNil: [currentIndex := 1].
 19:     ^currentIndex
 20: 
 21: ------------------------------------------------------------
 22: 
 23: SynapseTokenStream method for 'accessing'
 24: 
 25: currentIndex: anInteger
 26: 
 27:     currentIndex := anInteger
 28: 
 29: ------------------------------------------------------------
 30: 
 31: SynapseTokenStream method for 'stream operation'
 32: 
 33: next
 34: 
 35:     self currentIndex: self currentIndex + 1
 36: 
 37: ------------------------------------------------------------
 38: 
 39: SynapseTokenStream method for 'accessing-stream'
 40: 
 41: nextToken
 42: 
 43:     | aToken |
 44:     self currentIndex > self tokenCollection size ifTrue: [^nil].
 45:     aToken := self tokenCollection at: self currentIndex.
 46:     self next.
 47:     ^aToken
 48: 
 49: ------------------------------------------------------------
 50: 
 51: SynapseTokenStream method for 'accessing-stream'
 52: 
 53: peekToken
 54: 
 55:     self currentIndex > self tokenCollection size ifTrue: [^nil].
 56:     ^self tokenCollection at: self currentIndex
 57: 
 58: ------------------------------------------------------------
 59: 
 60: SynapseTokenStream method for 'stream operation'
 61: 
 62: reset
 63: 
 64:     self currentIndex: 1
 65: 
 66: ------------------------------------------------------------
 67: 
 68: SynapseTokenStream method for 'accessing'
 69: 
 70: tokenCollection
 71: 
 72:     tokenCollection ifNil: [tokenCollection := OrderedCollection new].
 73:     ^tokenCollection
 74: 
 75: ------------------------------------------------------------
 76: 
 77: SynapseTokenStream method for 'accessing'
 78: 
 79: tokenCollection: aCollection
 80: 
 81:     tokenCollection := aCollection
 82: 
 83: ------------------------------------------------------------
 84: 
 85: SynapseTokenStream method for 'initialize-release'
 86: 
 87: tokens: aTokenCollection
 88: 
 89:     aTokenCollection addLast: self class defaultTokenClass acceptanceToken.
 90:     self tokenCollection: aTokenCollection
 91: 
 92: ================================================================================
 93: 
 94: Smalltalk.SynapseTokenStream class
 95:     instanceVariableNames: ''
 96: 
 97: ================================================================================
 98: 
 99: SynapseTokenStream class method for 'defaults'
100: 
101: defaultTokenClass
102: 
103:     ^KSU.SynapseToken
104: 
105: ------------------------------------------------------------
106: 
107: SynapseTokenStream class method for 'instance creation'
108: 
109: new
110: 
111:     ^(super new)
112:         initialize;
113:         yourself
114: 
115: ------------------------------------------------------------
116: 
117: SynapseTokenStream class method for 'instance creation'
118: 
119: tokens: tokenCollection
120: 
121:     ^(self new)
122:         tokens: tokenCollection;
123:         yourself
124: 
125: ================================================================================

This document was generated by KSU.TextDoclet on 2013/02/22 at 01:01:17.