refactor inputstream to make it more easily testable

This commit is contained in:
Starfflame 2021-05-18 23:46:50 -05:00
parent 444a5590cd
commit 119da5673d
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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