22 try { Some(Integer.parseInt(value)) } |
22 try { Some(Integer.parseInt(value)) } |
23 catch { case _: NumberFormatException => None } |
23 catch { case _: NumberFormatException => None } |
24 } |
24 } |
25 } |
25 } |
26 |
26 |
27 def line_of(pos: T) = get_int(Markup.LINE, pos) |
27 def get_line(pos: T): Option[Int] = get_int(Markup.LINE, pos) |
28 def column_of(pos: T) = get_int(Markup.COLUMN, pos) |
28 def get_column(pos: T): Option[Int] = get_int(Markup.COLUMN, pos) |
29 def offset_of(pos: T) = get_int(Markup.OFFSET, pos) |
29 def get_offset(pos: T): Option[Int] = get_int(Markup.OFFSET, pos) |
30 def end_line_of(pos: T) = get_int(Markup.END_LINE, pos) |
30 def get_end_line(pos: T): Option[Int] = get_int(Markup.END_LINE, pos) |
31 def end_column_of(pos: T) = get_int(Markup.END_COLUMN, pos) |
31 def get_end_column(pos: T): Option[Int] = get_int(Markup.END_COLUMN, pos) |
32 def end_offset_of(pos: T) = get_int(Markup.END_OFFSET, pos) |
32 def get_end_offset(pos: T): Option[Int] = get_int(Markup.END_OFFSET, pos) |
33 def file_of(pos: T) = get_string(Markup.FILE, pos) |
33 def get_file(pos: T): Option[String] = get_string(Markup.FILE, pos) |
34 def id_of(pos: T) = get_string(Markup.ID, pos) |
34 def get_id(pos: T): Option[String] = get_string(Markup.ID, pos) |
35 |
35 |
36 def offsets_of(pos: T): (Option[Int], Option[Int]) = |
36 def get_offsets(pos: T): (Option[Int], Option[Int]) = |
37 { |
37 { |
38 val begin = offset_of(pos) |
38 val begin = get_offset(pos) |
39 val end = end_offset_of(pos) |
39 val end = get_end_offset(pos) |
40 (begin, if (end.isDefined) end else begin.map(_ + 1)) |
40 (begin, if (end.isDefined) end else begin.map(_ + 1)) |
41 } |
41 } |
42 } |
42 } |