tan
0.0.1
|
Public Member Functions | |
void | open (const str &filename) |
void | from_string (const str &code) |
size_t | size () const |
Return the number of lines of code of the current file. More... | |
str | get_line (size_t index) const |
Return source at a specific line. More... | |
char | at (const SrcLoc &ptr) const |
str | substr (const SrcLoc &start) const |
Get a substring from start to the end of the current line. More... | |
str | substr (const SrcLoc &start, const SrcLoc &end) const |
Get a substring from the source code. More... | |
bool | is_cursor_valid (const SrcLoc &c) const |
Check if a cursor is in bound. More... | |
SrcLoc | begin () const |
The start of source file (inclusive). More... | |
SrcLoc | end () const |
The end of source file (exclusive). More... | |
SrcLoc | forward (SrcLoc c) |
Return a copy of code_ptr that points to the next character. More... | |
str | get_filename () const |
Definition at line 10 of file source_file.h.
SrcLoc tanlang::SourceFile::begin | ( | ) | const |
The start of source file (inclusive).
Definition at line 128 of file source_file.cpp.
SrcLoc tanlang::SourceFile::end | ( | ) | const |
The end of source file (exclusive).
Definition at line 110 of file source_file.cpp.
Referenced by substr().
Return a copy of code_ptr that points to the next character.
Definition at line 92 of file source_file.cpp.
str tanlang::SourceFile::get_line | ( | size_t | index | ) | const |
Return source at a specific line.
index | line of code starting from 0 |
Definition at line 130 of file source_file.cpp.
Referenced by substr().
bool tanlang::SourceFile::is_cursor_valid | ( | const SrcLoc & | c | ) | const |
Check if a cursor is in bound.
Definition at line 47 of file source_file.cpp.
Referenced by substr().
|
inline |
Return the number of lines of code of the current file.
Definition at line 17 of file source_file.h.
str tanlang::SourceFile::substr | ( | const SrcLoc & | start | ) | const |
Get a substring from start to the end of the current line.
start | start of the string, inclusive |
Definition at line 87 of file source_file.cpp.
References end(), and get_line().
Get a substring from the source code.
start | start of the string, inclusive |
end | end of the string, exclusive |
Definition at line 60 of file source_file.cpp.
References end(), and is_cursor_valid().