diff options
Diffstat (limited to 'parser.lua')
-rw-r--r-- | parser.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/parser.lua b/parser.lua index beb944e..0cd2853 100644 --- a/parser.lua +++ b/parser.lua @@ -72,7 +72,7 @@ local function get_next_common(state, in_pos, token) end local function get_next_table(state, in_pos) - if state[DATA] == nil or #state[DATA] == 0 then return in_pos, state end + if state[DATA] == nil or #state[DATA] == 0 then return in_pos, state end -- TODO end-of-stream handling in_pos = in_pos + 1 local token = state[DATA][in_pos - state[OFFDATA]] if token == nil then @@ -84,10 +84,10 @@ local function get_next_table(state, in_pos) end local function get_next_string(state, in_pos) - if state[DATA] == nil or #state[DATA] == 0 then return in_pos, state end + if state[DATA] == nil or #state[DATA] == 0 then return in_pos, state end -- TODO end-of-stream handling in_pos = in_pos + 1 - local token = optimize_lookups[string.byte(state[DATA], in_pos - state[OFFDATA], in_pos - state[OFFDATA])] or "" - if token == "" then + local token = optimize_lookups[string.byte(state[DATA], in_pos - state[OFFDATA], in_pos - state[OFFDATA])] + if token == nil then state[OFFDATA] = in_pos - 1 state[DATA] = state[GEN]() return get_next_string(state, state[OFFDATA]) |