AALanguage
The best language for those who have nothing to do
|
A helper class for getting information about built-in libraries. More...
#include <LibParser.h>
Public Member Functions | |
LibParser (std::string libs_) | |
Constructor that saves the path to the standard libraries directory. | |
bool | add_lib (std::string name) |
Adds the new library to the list of libraries in use, if necessary. | |
std::string | parse_lib (std::string name) |
Reads all text from the library file. | |
std::string | name_to_path (std::string name) |
Converts the standard library name to its file path. | |
Private Member Functions | |
std::vector< std::string > | split (const std::string &s, char delim) |
std::string | slurp (std::ifstream &in) |
Private Attributes | |
std::string | libs |
std::unordered_set< std::string > | used |
A helper class for getting information about built-in libraries.
Definition at line 10 of file LibParser.h.
LibParser::LibParser | ( | std::string | libs_ | ) |
Constructor that saves the path to the standard libraries directory.
libs_ | library directory path |
Definition at line 3 of file LibParser.cpp.
References libs.
bool LibParser::add_lib | ( | std::string | name | ) |
Adds the new library to the list of libraries in use, if necessary.
name | library name with . splitting |
Definition at line 6 of file LibParser.cpp.
References name_to_path(), and used.
Referenced by LexicalAnalyzer::LexicalAnalyzer().
std::string LibParser::name_to_path | ( | std::string | name | ) |
Converts the standard library name to its file path.
name | library name with . splitting |
Definition at line 30 of file LibParser.cpp.
Referenced by add_lib(), LexicalAnalyzer::LexicalAnalyzer(), and parse_lib().
std::string LibParser::parse_lib | ( | std::string | name | ) |
Reads all text from the library file.
name | library name with . splitting |
Definition at line 19 of file LibParser.cpp.
References name_to_path(), and slurp().
|
private |
Definition at line 51 of file LibParser.cpp.
Referenced by parse_lib().
|
private |
Definition at line 42 of file LibParser.cpp.
Referenced by name_to_path().
|
private |
Definition at line 43 of file LibParser.h.
Referenced by LibParser(), and name_to_path().
|
private |
Definition at line 44 of file LibParser.h.
Referenced by add_lib().