- readable var _file: nullable SourceFile
- readable var _line_start: Int
- readable var _line_end: Int
- readable var _column_start: Int
- readable var _column_end: Int
-
- init(f: nullable SourceFile, line_s: Int, line_e: Int, column_s: Int, column_e: Int) do
- _file = f
- _line_start = line_s
- _line_end = line_e
- _column_start = column_s
- _column_end = column_e
- end
+ # The associated source-file
+ var file: nullable SourceFile
+
+ # The starting line number (starting from 1)
+ #
+ # If `line_start==0` then the whole file is considered
+ var line_start: Int
+
+ # The stopping line number (starting from 1)
+ var line_end: Int
+
+ # Start of this location on `line_start`
+ #
+ # A `column_start` of 1 means the first column or character.
+ #
+ # If `column_start == 0` this location concerns the whole line.
+ #
+ # Require: `column_start >= 0`
+ var column_start: Int
+
+ # End of this location on `line_end`
+ var column_end: Int
+
+ # The index in the start character in the source
+ fun pstart: Int do return file.line_starts[line_start-1] + column_start-1
+
+ # The index on the end character in the source
+ fun pend: Int do return file.line_starts[line_end-1] + column_end-1