Skip to content

Commit 9200003

Browse files
authored
[Bug Fix] Refactoring of Mark and Span, and bug fix (#183)
* Split mark and span from `src/tokens.jl` * Add iteration and indexing to `Span`. * Add methods to get start mark and end mark from tokens. * Replace `token.span.start_mark` and `token.span.end_mark` to `firstmark(token)` and `lastmark(token)`. * Fix existing bugs about getting marks from tokens. * Replace remained expressions. * Remove methods for `Span`.
1 parent 2daef25 commit 9200003

File tree

5 files changed

+78
-79
lines changed

5 files changed

+78
-79
lines changed

src/YAML.jl

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ using StringEncodings
3030
include("versions.jl")
3131
include("queue.jl")
3232
include("buffered_input.jl")
33+
include("mark.jl")
34+
include("span.jl")
3335
include("tokens.jl")
3436
include("scanner.jl")
3537
include("events.jl")

src/mark.jl

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Position within the document being parsed
2+
struct Mark
3+
index::UInt64
4+
line::UInt64
5+
column::UInt64
6+
end
7+
8+
function show(io::IO, mark::Mark)
9+
@printf(io, "line %d, column %d", mark.line, mark.column)
10+
end

0 commit comments

Comments
 (0)