IDL front-end.
More...
#include <IDL_FrontEnd.h>
|
int | main (int argc, const char *const argv[]) noexcept |
| Call this method from the main() function. More...
|
|
int | run (const char *command, int argc, const char *const argv[]) noexcept |
| The same as main (), but aruments must not include the first main() argument (executable file name). More...
|
|
unsigned | flags () const noexcept |
|
std::ostream & | err_out () const noexcept |
|
|
static const char * | filename (const char *path) noexcept |
| Get file name from path. More...
|
|
IDL front-end.
Performs:
- Command line parsing
- Preprocessing
- IDL files parsing
- Building of the Abstract Syntax Tree (AST)
The compiler class should derive from this class and implement virtual void generate_code ();
- Examples
- IDL_Print.cpp.
Definition at line 62 of file IDL_FrontEnd.h.
◆ IDL_FrontEnd()
IDL_FrontEnd::IDL_FrontEnd |
( |
unsigned |
flags = 0 , |
|
|
std::ostream & |
err_out = std::cerr |
|
) |
| |
|
inlineprotected |
◆ main()
int IDL_FrontEnd::main |
( |
int |
argc, |
|
|
const char *const |
argv[] |
|
) |
| |
|
inlinenoexcept |
Call this method from the main() function.
- Parameters
-
argc | Count of command line arguments. |
argv | Command line arguments. |
- Returns
- The 0 if no errors, otherwise -1.
Definition at line 70 of file IDL_FrontEnd.h.
◆ run()
int IDL_FrontEnd::run |
( |
const char * |
command, |
|
|
int |
argc, |
|
|
const char *const |
argv[] |
|
) |
| |
|
noexcept |
The same as main (), but aruments must not include the first main() argument (executable file name).
- Parameters
-
command | The command name for usage info. You can use filename (argv [0]). |
argc | Count of command line arguments. |
argv | Command line arguments. |
- Returns
- The 0 if no errors, otherwise -1.
◆ filename()
static const char* IDL_FrontEnd::filename |
( |
const char * |
path | ) |
|
|
staticnoexcept |
Get file name from path.
- Parameters
-
- Returns
- The file name.
◆ flags()
unsigned IDL_FrontEnd::flags |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Flags parameter specified in constructor.
Definition at line 91 of file IDL_FrontEnd.h.
◆ err_out()
std::ostream& IDL_FrontEnd::err_out |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Compiler messages output stream.
Definition at line 106 of file IDL_FrontEnd.h.
◆ parse_arguments()
virtual void IDL_FrontEnd::parse_arguments |
( |
CmdLine & |
args | ) |
|
|
protectedvirtual |
Parse command line parameters.
User can override this method to do some parameter fix/check. For example, user can add include paths from the environment.
- Parameters
-
◆ parse_command_line()
virtual bool IDL_FrontEnd::parse_command_line |
( |
CmdLine & |
args | ) |
|
|
protectedvirtual |
Parse command line parameter.
User can override this method to parse additional parameters. The user method must call IDL_FrontEnd::parse_command_line () first to let the IDL_FrontEnd parse it's arguments. If the IDL_FrontEnd::parse_command_line () returns false
, user method may parse it's own arguments. If the argument is recognized, args.next () must be called for advance to the next argument.
Switches recognized by IDL_FrontEnd:
- -D definition Define a symbol.
- -U definition Undefine a sy
- -I include_path Add directory to the include directories.
- -FI include_file Include a file.
- -h Display usage information.
- Parameters
-
- Returns
true
if command line parameter was recognized.
- Exceptions
-
std::invalid_argument | If the argument was recognized but the syntax is invalid. |
- Examples
- IDL_Print.cpp.
◆ print_usage_info()
virtual void IDL_FrontEnd::print_usage_info |
( |
const char * |
exe_name | ) |
|
|
protectedvirtual |
Prints usage information to std::cout.
User can override this method to print additional information.
- Parameters
-
exe_name | The name of program executable file obtained from argv[0]. |
- Examples
- IDL_Print.cpp.
◆ defines()
std::vector<std::string>& IDL_FrontEnd::defines |
( |
| ) |
|
|
inlineprotectednoexcept |
◆ undefines()
std::vector<std::string>& IDL_FrontEnd::undefines |
( |
| ) |
|
|
inlineprotectednoexcept |
◆ include_paths()
std::vector<std::string>& IDL_FrontEnd::include_paths |
( |
| ) |
|
|
inlineprotectednoexcept |
◆ includes()
std::vector<std::string>& IDL_FrontEnd::includes |
( |
| ) |
|
|
inlineprotectednoexcept |
◆ files()
std::vector<std::string>& IDL_FrontEnd::files |
( |
| ) |
|
|
inlineprotectednoexcept |
◆ generate_code()
virtual void IDL_FrontEnd::generate_code |
( |
const AST::Root & |
tree | ) |
|
|
protectedpure virtual |
Generate user code from AST.
User must override this method.
- Parameters
-
- Exceptions
-
std::runtime_error | For displaying the error message and compile next file. Other exceptions will cause the compilation interruption. |
- Examples
- IDL_Print.cpp.
◆ file_begin()
virtual void IDL_FrontEnd::file_begin |
( |
const std::filesystem::path & |
file, |
|
|
AST::Builder & |
builder |
|
) |
| |
|
inlineprotectedvirtual |
Begin of the file parsing.
- Parameters
-
file | The IDL file path. |
builder | The AST builder. User can use this object to inject some initial items to the empty AST. |
Definition at line 252 of file IDL_FrontEnd.h.
◆ interface_end()
End of the interface parsing.
User can override this method for interface post-processing, e. g. AMI IDL generation. This method is called on the end of interface from the IDL file. It is not called on Builder::interface_end () call.
- Parameters
-
itf | The parsed interface. |
builder | The AST builder. |
Definition at line 263 of file IDL_FrontEnd.h.
The documentation for this class was generated from the following file: