aboutsummaryrefslogtreecommitdiff
path: root/utils.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-03-22 13:56:31 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-03-22 13:56:35 -0700
commit9109a090eb7063b7e90f5c6507ec6cb8e6a499e0 (patch)
treef4a9a23ff5db9fa4b8fb670ef3d4f25fc3bf7a6a /utils.lua
parent972de38421d14882de192ddbd51afd89c4ffb06c (diff)
Better repr.
Diffstat (limited to 'utils.lua')
-rw-r--r--utils.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/utils.lua b/utils.lua
index 6b802d2..3374e4a 100644
--- a/utils.lua
+++ b/utils.lua
@@ -30,6 +30,8 @@ local max = math.max
local _quote_patt = re.compile("(({'\n' / '\"' / \"'\" / '\\'}->mark_char) / (']' ({'='*}->mark_eq) (']' / !.)) / .)*",
{mark_char=function(q)
if q == "\n" or q == "\\" then
+ _quote_state["'"] = false
+ _quote_state['"'] = false
if _quote_state.min_eq == nil then
_quote_state.min_eq = 0
end
@@ -74,9 +76,9 @@ local function repr(x, depth)
end
_quote_state = {}
_quote_patt:match(x)
- if _quote_state["'"] ~= false and _quote_state.min_eq == nil then
+ if _quote_state["'"] ~= false then
return "\'" .. x .. "\'"
- elseif _quote_state['"'] ~= false and _quote_state.min_eq == nil then
+ elseif _quote_state['"'] ~= false then
return "\"" .. x .. "\""
else
local eq = ("="):rep(_quote_state.min_eq or 0)