From a440b9a0e69471fb2a5ed6bad4277322934b7616 Mon Sep 17 00:00:00 2001 From: Koki Fushimi Date: Mon, 1 Jul 2024 23:37:46 +0900 Subject: [PATCH] Add show function to spans (#222) * 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. --- src/span.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/span.jl b/src/span.jl index 0be0017..23063e2 100644 --- a/src/span.jl +++ b/src/span.jl @@ -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, ")")