nitc :: SourceFile
nitc :: SourceFile :: _first_token
The first token parser by the lexernitc :: SourceFile :: _last_token
The first token parser by the lexernitc :: SourceFile :: _line_starts
Offset of each line start in the contentstring
.
nitc :: SourceFile :: _mmodule
Associated mmodule, once creatednitc :: SourceFile :: _stream
The original stream used to initializestring
nitc :: SourceFile :: defaultinit
nitc :: SourceFile :: first_token
The first token parser by the lexernitc :: SourceFile :: first_token=
The first token parser by the lexernitc :: SourceFile :: from_string
Create a new sourcefile using a dummy filename and a given contentnitc :: SourceFile :: last_token=
The first token parser by the lexernitc :: SourceFile :: line_starts
Offset of each line start in the contentstring
.
nitc :: SourceFile :: line_starts=
Offset of each line start in the contentstring
.
nitc :: SourceFile :: mmodule=
Associated mmodule, once creatednitc :: SourceFile :: stream=
The original stream used to initializestring
nitc $ SourceFile :: SELF
Type of this instance, automatically specialized in every classnitc $ SourceFile :: init
nitc :: SourceFile :: _first_token
The first token parser by the lexernitc :: SourceFile :: _last_token
The first token parser by the lexernitc :: SourceFile :: _line_starts
Offset of each line start in the contentstring
.
nitc :: SourceFile :: _mmodule
Associated mmodule, once creatednitc :: SourceFile :: _stream
The original stream used to initializestring
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: SourceFile :: defaultinit
core :: Object :: defaultinit
nitc :: SourceFile :: first_token
The first token parser by the lexernitc :: SourceFile :: first_token=
The first token parser by the lexernitc :: SourceFile :: from_string
Create a new sourcefile using a dummy filename and a given contentcore :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: SourceFile :: last_token=
The first token parser by the lexernitc :: SourceFile :: line_starts
Offset of each line start in the contentstring
.
nitc :: SourceFile :: line_starts=
Offset of each line start in the contentstring
.
nitc :: SourceFile :: mmodule=
Associated mmodule, once createdcore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: SourceFile :: stream=
The original stream used to initializestring
# A raw text Nit source file
class SourceFile
# The path of the source
var filename: String
# The content of the source
var string: String is noinit
# The original stream used to initialize `string`
var stream: Reader
init
do
string = stream.read_all
line_starts[0] = 0
end
# Create a new sourcefile using a dummy filename and a given content
init from_string(filename: String, string: String) is
nosuper
do
self.filename = filename
self.string = string
line_starts[0] = 0
end
# 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]
# Extract a given line excluding the line-terminators characters.
#
# `line_number` starts at 1 for the first line.
fun get_line(line_number: Int): String do
if line_number > line_starts.length then return ""
var line_start = line_starts[line_number-1]
var line_end = line_start
var string = self.string
while line_end+1 < string.length and string.chars[line_end+1] != '\n' and string.chars[line_end+1] != '\r' do
line_end += 1
end
return string.substring(line_start, line_end-line_start+1)
end
end
src/location.nit:20,1--64,3
redef class SourceFile
# The first token parser by the lexer
# May have disappeared in the final AST
var first_token: nullable Token = null
# The first token parser by the lexer
# May have disappeared in the final AST
var last_token: nullable Token = null
end
src/parser/parser_nodes.nit:414,1--422,3
redef class SourceFile
# Errors and warnings associated to the whole source.
var messages = new Array[Message]
end
src/toolcontext.nit:138,1--141,3
redef class SourceFile
# Associated mmodule, once created
var mmodule: nullable MModule = null
end
src/loader.nit:1272,1--1275,3