mirror of https://github.com/mpastell/Weave.jl
Merge pull request #8 from dmbates/master
Memory map the document file as an array of bytes then split.pull/9/head
commit
f0ac1189d7
|
@ -1,5 +1,8 @@
|
||||||
function read_noweb(document)
|
function read_noweb(document)
|
||||||
doctext = readall(open(document))
|
#doctext = readall(open(document))
|
||||||
|
lines = split(bytestring(open(document) do io
|
||||||
|
mmap_array(Uint8,(filesize(document),),io)
|
||||||
|
end), "\n")
|
||||||
#doctext = document #Replace with file...
|
#doctext = document #Replace with file...
|
||||||
codestart = r"^<<(.*?)>>="
|
codestart = r"^<<(.*?)>>="
|
||||||
codeend = r"^@(\s*)$"
|
codeend = r"^@(\s*)$"
|
||||||
|
@ -14,8 +17,8 @@ function read_noweb(document)
|
||||||
options = Dict()
|
options = Dict()
|
||||||
optionstring = ""
|
optionstring = ""
|
||||||
parsed = Dict[]
|
parsed = Dict[]
|
||||||
for (lineno, line) in enumerate(split(doctext, "\n"))
|
for lineno in 1:length(lines)
|
||||||
|
line = lines[lineno]
|
||||||
if ismatch(codestart, line) && state=="doc"
|
if ismatch(codestart, line) && state=="doc"
|
||||||
state = "code"
|
state = "code"
|
||||||
m = match(codestart, line)
|
m = match(codestart, line)
|
||||||
|
|
Loading…
Reference in New Issue