Class Parser


back
readInteger  | value divisor |
tokenType isDigit ifFalse: [ self error: 'integer expected' ].
value <- 0.
token do: [:c |
c isDigit ifTrue: [ value <- value * 10 + (c value - 48).
divisor notNil ifTrue: [ divisor <- divisor * 10]].
c = $. ifTrue: [ divisor <- 1]].
divisor notNil ifTrue: [ value <- value asFloat / divisor ].
self nextLex.
^ value