refactor inputstream to make it more easily testable
This commit is contained in:
parent
444a5590cd
commit
119da5673d
|
@ -53,7 +53,7 @@ end
|
|||
|
||||
|
||||
function CoreHelpers.parseToken(state: Environment): string
|
||||
local chr = state.activeInputStream:readCurrentCharacter()
|
||||
local chr = ""
|
||||
local token = ""
|
||||
while(not CoreHelpers.isWhitespace(chr)) do
|
||||
token = token..chr
|
||||
|
|
|
@ -62,9 +62,10 @@ function InputStream:readCurrentCharacter(): string
|
|||
end
|
||||
|
||||
function InputStream:advanceOffset(): string
|
||||
local current_char = self.str:sub(self.offset, self.offset)
|
||||
self.offset = self.offset + 1
|
||||
self:_manageBuffer()
|
||||
return self.str:sub(self.offset, self.offset)
|
||||
return current_char
|
||||
end
|
||||
|
||||
return InputStream
|
||||
|
|
Loading…
Reference in New Issue