1
0
Fork 0

Removed unused `chr` argument from internal parse funcs

master
rxi 2015-08-19 21:15:32 +01:00
parent 2547923431
commit 83164fb45c
1 changed files with 8 additions and 8 deletions

View File

@ -190,7 +190,7 @@ local function parse_unicode_escape(s)
end end
local function parse_string(str, i, chr) local function parse_string(str, i)
local has_unicode_escape = false local has_unicode_escape = false
local has_surrogate_escape = false local has_surrogate_escape = false
local has_escape = false local has_escape = false
@ -243,7 +243,7 @@ local function parse_string(str, i, chr)
end end
local function parse_number(str, i, chr) local function parse_number(str, i)
local x = next_char(str, i, delim_chars) local x = next_char(str, i, delim_chars)
local s = str:sub(i, x - 1) local s = str:sub(i, x - 1)
local n = tonumber(s) local n = tonumber(s)
@ -254,7 +254,7 @@ local function parse_number(str, i, chr)
end end
local function parse_keyword(str, i, chr) local function parse_keyword(str, i)
local x = next_char(str, i, delim_chars) local x = next_char(str, i, delim_chars)
local word = str:sub(i, x - 1) local word = str:sub(i, x - 1)
if not keywords[word] then if not keywords[word] then
@ -264,7 +264,7 @@ local function parse_keyword(str, i, chr)
end end
local function parse_array(str, i, chr) local function parse_array(str, i)
local res = {} local res = {}
local n = 1 local n = 1
i = i + 1 i = i + 1
@ -282,7 +282,7 @@ local function parse_array(str, i, chr)
n = n + 1 n = n + 1
-- Next token -- Next token
i = next_char(str, i, space_chars, true) i = next_char(str, i, space_chars, true)
chr = str:sub(i, i) local chr = str:sub(i, i)
i = i + 1 i = i + 1
if chr == "]" then break end if chr == "]" then break end
if chr ~= "," then decode_error(str, i, "expected ']' or ','") end if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
@ -291,7 +291,7 @@ local function parse_array(str, i, chr)
end end
local function parse_object(str, i, chr) local function parse_object(str, i)
local res = {} local res = {}
i = i + 1 i = i + 1
while 1 do while 1 do
@ -319,7 +319,7 @@ local function parse_object(str, i, chr)
res[key] = val res[key] = val
-- Next token -- Next token
i = next_char(str, i, space_chars, true) i = next_char(str, i, space_chars, true)
chr = str:sub(i, i) local chr = str:sub(i, i)
i = i + 1 i = i + 1
if chr == "}" then break end if chr == "}" then break end
if chr ~= "," then decode_error(str, i, "expected '}' or ','") end if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
@ -353,7 +353,7 @@ parse = function(str, idx)
local chr = str:sub(idx, idx) local chr = str:sub(idx, idx)
local f = char_func_map[chr] local f = char_func_map[chr]
if f then if f then
return f(str, idx, chr) return f(str, idx)
end end
decode_error(str, idx, "unexpected character '" .. chr .. "'") decode_error(str, idx, "unexpected character '" .. chr .. "'")
end end