nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: add tests for multi-iterators
[nit.git]
/
src
/
location.nit
diff --git
a/src/location.nit
b/src/location.nit
index
1a27697
..
0c5b55d
100644
(file)
--- a/
src/location.nit
+++ b/
src/location.nit
@@
-35,14
+35,17
@@
class SourceFile
end
# Create a new sourcefile using a dummy filename and a given content
end
# Create a new sourcefile using a dummy filename and a given content
- init from_string(filename: String, string: String)
+ init from_string(filename: String, string: String) is
+ nosuper
do
self.filename = filename
self.string = string
line_starts[0] = 0
end
do
self.filename = filename
self.string = string
line_starts[0] = 0
end
- # Position of each line start
+ # Offset of each line start in the content `string`.
+ #
+ # Used for fast access to each line when rendering parts of the `string`.
var line_starts = new Array[Int]
end
var line_starts = new Array[Int]
end
@@
-97,7
+100,9
@@
class Location
# loc = new Location.from_string("location.nit:82--105,8")
# assert loc.to_s == "location.nit:82,0--105,8"
# ~~~
# loc = new Location.from_string("location.nit:82--105,8")
# assert loc.to_s == "location.nit:82,0--105,8"
# ~~~
- init from_string(string: String) do
+ init from_string(string: String) is
+ nosuper
+ do
self.line_start = 0
self.line_end = 0
self.column_start = 0
self.line_start = 0
self.line_end = 0
self.column_start = 0
@@
-241,7
+246,7
@@
class Location
# * `"0;32"` for green
fun colored_line(color: String): String
do
# * `"0;32"` for green
fun colored_line(color: String): String
do
- var esc = 27.ascii
+ var esc = 27.code_point
var def = "{esc}[0m"
var col = "{esc}[{color}m"
var def = "{esc}[0m"
var col = "{esc}[{color}m"