865257751772f8b912d3677312796a2659ac505d
1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # This module is used to model locations in source files.
20 # A location inside a source file.
24 var path
: nullable String = null is writable
25 var line_start
: Int = 1 is writable
26 var line_end
: Int = 1 is writable
27 var column_start
: Int = 1 is writable
28 var column_end
: Int = 1 is writable
30 redef fun to_s
: String do
31 var file_part
= "/dev/null:"
32 if path
!= null and path
.length
> 0 then file_part
= "{path.as(not null)}:"
33 return "{file_part}{line_start},{column_start}--{line_end},{column_end}"
36 redef fun to_json
do return to_s
.to_json