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
|
function CoreHelpers.parseToken(state: Environment): string
|
||||||
local chr = state.activeInputStream:readCurrentCharacter()
|
local chr = ""
|
||||||
local token = ""
|
local token = ""
|
||||||
while(not CoreHelpers.isWhitespace(chr)) do
|
while(not CoreHelpers.isWhitespace(chr)) do
|
||||||
token = token..chr
|
token = token..chr
|
||||||
|
|
|
@ -62,9 +62,10 @@ function InputStream:readCurrentCharacter(): string
|
||||||
end
|
end
|
||||||
|
|
||||||
function InputStream:advanceOffset(): string
|
function InputStream:advanceOffset(): string
|
||||||
|
local current_char = self.str:sub(self.offset, self.offset)
|
||||||
self.offset = self.offset + 1
|
self.offset = self.offset + 1
|
||||||
self:_manageBuffer()
|
self:_manageBuffer()
|
||||||
return self.str:sub(self.offset, self.offset)
|
return current_char
|
||||||
end
|
end
|
||||||
|
|
||||||
return InputStream
|
return InputStream
|
||||||
|
|
Loading…
Reference in New Issue