Skip to content

Commit

Permalink
Add show function to spans (#222)
Browse files Browse the repository at this point in the history
* 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`.

* Add a show function to spans.
  • Loading branch information
Paalon authored Jul 1, 2024
1 parent 783b7c8 commit a440b9a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/span.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ struct Span
start_mark::Mark
end_mark::Mark
end

show(io::IO, span::Span) = print(io, "(line, column) ∈ (", span.start_mark.line, ", ", span.start_mark.column, ")...(", span.end_mark.line, ", ", span.end_mark.column, ")")

0 comments on commit a440b9a

Please sign in to comment.