about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--read.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/read.lua b/read.lua index c3f3f64..9561d9f 100644 --- a/read.lua +++ b/read.lua
@@ -124,13 +124,13 @@ read.readtable = {
124 ["."] = function(chars) return pop(chars), "dot", chars end, 124 ["."] = function(chars) return pop(chars), "dot", chars end,
125 ["\""] = consume_string, 125 ["\""] = consume_string,
126 [";"] = consume_comment, 126 [";"] = consume_comment,
127 -- ["#"] = 127 -- ["#"] = ...,
128} 128}
129 129
130function read.scan (chars) 130function read.scan (chars)
131 local chars = chars 131 local chars = chars
132 return function() 132 return function ()
133 if #chars == 0 then return nil end 133 if not next(chars) then return nil end
134 local token, toktype = "", nil 134 local token, toktype = "", nil
135 while true do 135 while true do
136 if read.readtable[chars[1]] then 136 if read.readtable[chars[1]] then
@@ -139,7 +139,7 @@ function read.scan (chars)
139 return token, toktype 139 return token, toktype
140 elseif chars[1]:match("%s") then 140 elseif chars[1]:match("%s") then
141 chars = consume_whitespace(chars) 141 chars = consume_whitespace(chars)
142 elseif chars[1]:match("%d") then 142 elseif chars[1]:match("[%d-]") then
143 token, chars = consume_number(chars) 143 token, chars = consume_number(chars)
144 return token, "number" 144 return token, "number"
145 else 145 else