Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ macro htl_str(expr::String)
args = Any[]
start = idx = 1
strlen = lastindex(expr)
DOLLAR_NOESCAPE = r"(^\$)|([^\\](\\\\)*\$)"
while true
idx = findnext(isequal('$'), expr, start)
if idx == nothing
chunk = expr[start:strlen]
if match(DOLLAR_NOESCAPE,expr[start:strlen]) === nothing
push!(args, expr[start:strlen])
break
end
idx = last(findnext(DOLLAR_NOESCAPE, expr, start)) # last char of match is "$"
push!(args, expr[start:prevind(expr, idx)])
start = nextind(expr, idx)
if length(expr) >= start && expr[start] == '$'
Expand All @@ -74,7 +74,7 @@ macro htl_str(expr::String)
continue
end
(nest, tail) = Meta.parse(expr, start; greedy=false)
if nest == nothing
if nest === nothing
throw("missing expression at $idx: $(expr[start:end])")
end
if !(expr[start] == '(' || nest isa Symbol)
Expand Down