Skip to content

Commit

Permalink
Make each_match iteration a little more idiomatic. Still cant use ful…
Browse files Browse the repository at this point in the history
…l comprehensions due to #1457
  • Loading branch information
aviks committed Nov 14, 2012
1 parent cf7ee6c commit ba5dd04
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions extras/json.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ function parse(strng::String)
# String delimiters and escape characters are identified beforehand to improve speed
len_esc::Int = 0
index_esc::Int = 1
esc_locations::Array{Int64,1} = Array(Int, 0)
for m in each_match(r"[\"\\\\]", strng)
len_esc = len_esc+1
push(esc_locations, m.offset)
end
# esc = regexp(str, "[\"\\\\]"); index_esc = 1; len_esc = length(esc); #TODO Enable for speed

esc_locations::Array{Int64,1} = map(x->x.offset, [each_match(r"[\"\\\\]", strng)...])
len_esc=length(esc_locations)


function parse_object()
parse_char('{')
Expand Down

0 comments on commit ba5dd04

Please sign in to comment.