Org.jl
Org.jl copied to clipboard
BoundsError: attempt to access 0-element Vector
I tried to parse my personal notes file (approx 15,000 lines) and got this error. The first 1500 lines are OK but 1800 lines fail. Can you give a hint on what triggers this error?
julia> @time parse(OrgDoc, read("org/my.org", String))
┌ Warning: The following line is being coerced to a paragraph:
│
… (cut out private data from ~ 18 warnings)
│
│ This is unusual, and likely caused by a malformed Org document.
└ @ Org ~/.julia/packages/Org/ziv28/src/parse/consumers.jl:333
ERROR: BoundsError: attempt to access 0-element Vector{Org.OrgComponent} at index [1]
Stacktrace:
[1] getindex
@ ./array.jl:861 [inlined]
[2] consume(#unused#::Type{Org.AffiliatedKeywordsWrapper}, text::SubString{String})
@ Org ~/.julia/packages/Org/ziv28/src/parse/consumers.jl:139
[3] parseorg(content::SubString{String}, typematchers::Dict{Char, Vector{<:Type}}, typefallbacks::Vector{DataType}; debug::Bool, partial::Bool, maxobj::Int64)
@ Org ~/.julia/packages/Org/ziv28/src/parse/parser.jl:49
[4] parseorg
@ ~/.julia/packages/Org/ziv28/src/parse/parser.jl:25 [inlined]
[5] Org.Section(components::Vector{Union{Nothing, SubString{String}}})
@ Org ~/.julia/packages/Org/ziv28/src/parse/interpret.jl:102
[6] consume
@ ~/.julia/packages/Org/ziv28/src/parse/consumers.jl:10 [inlined]
[7] parse(component::Type{Org.Section}, content::SubString{String})
@ Org ~/.julia/packages/Org/ziv28/src/parse/interpret.jl:42
[8] Org.Heading(components::Vector{Union{Nothing, SubString{String}}})
@ Org ~/.julia/packages/Org/ziv28/src/parse/interpret.jl:82
[9] consume(component::Type{Org.Heading}, text::SubString{String})
@ Org ~/.julia/packages/Org/ziv28/src/parse/consumers.jl:10
[10] parseorg(content::SubString{String}, typematchers::Dict{Char, Vector{DataType}}, typefallbacks::Vector{DataType}; debug::Bool, partial::Bool, maxobj::Int64)
@ Org ~/.julia/packages/Org/ziv28/src/parse/parser.jl:59
[11] #parseorg#30
@ ~/.julia/packages/Org/ziv28/src/parse/parser.jl:106 [inlined]
[12] parseorg
@ ~/.julia/packages/Org/ziv28/src/parse/parser.jl:106 [inlined]
[13] parse(#unused#::Type{OrgDoc}, content::String)
@ Org ~/.julia/packages/Org/ziv28/src/parse/interpret.jl:66
[14] top-level scope
@ REPL[3]:1
I found the org code that is producing the error, it's the #+name
line:
#+NAME: lilypond
#+BEGIN_SRC lilypond
foo
#+END_SRC
Hmmm. I thought I got affiliated keywords working. Thanks for raising this.
Fixed in 170a1d3f757e60a0a64f0cdc41634ef6ce3ccfca and 349157e1924c4593aef8c898e0c9b628a5647d5a.