|
Bash++
Bash++ compiler internal documentation
|
Represents the parsed command-line arguments given to the compiler. More...
#include <parse_arguments.h>

Public Member Functions | |
| constexpr | Arguments () |
| ~Arguments ()=default | |
| Arguments (const Arguments &)=delete | |
| Arguments & | operator= (const Arguments &)=delete |
| Arguments (Arguments &&)=default | |
| Arguments & | operator= (Arguments &&)=default |
| void | set_program_arguments (int argc, char **argv) |
| Sets the program arguments to be passed to the compiled program. | |
| const std::vector< char * > & | program_arguments () const |
| void | set_input_file (const std::string_view &input_file) |
| Sets the input file for the compiler. | |
| const std::optional< std::string > & | input_file () const |
| void | set_output_file (const std::string_view &output_file_arg) |
| Parses a given output_file argument and updates the Arguments object accordingly. | |
| const std::optional< std::string > & | output_file () const |
| void | set_target_bash_version (const std::string_view &version_arg) |
| Parses a given target Bash version argument and updates the Arguments object accordingly. | |
| const BashVersion & | target_bash_version () const |
| void | add_include_path (const std::string_view &path) |
| Adds a directory to the include paths. | |
| const std::shared_ptr< std::vector< std::string > > & | include_paths () const |
| void | set_suppress_warnings (bool suppress) |
| bool | suppress_warnings () const |
| void | set_display_tokens (bool display) |
| bool | display_tokens () const |
| void | set_display_parse_tree (bool display) |
| bool | display_parse_tree () const |
| void | set_exit_early (bool exit) |
| bool | exit_early () const |
Private Attributes | |
| std::vector< char * > | m_program_arguments |
| std::optional< std::string > | m_input_file |
| std::optional< std::string > | m_output_file |
| BashVersion | m_target_bash_version = {5, 2} |
| std::shared_ptr< std::vector< std::string > > | m_include_paths = std::make_shared<std::vector<std::string>>() |
| bool | f_suppress_warnings = false |
| bool | f_display_tokens = false |
| bool | f_display_parse_tree = false |
| bool | f_exit_early = false |
Represents the parsed command-line arguments given to the compiler.
This struct holds the parsed command-line arguments for the Bash++ compiler. It includes options for input/output files, target Bash version, include paths, warning suppression, and flags for displaying tokens or parse trees.
|
inlineconstexpr |
|
default |
|
delete |
|
default |
|
inline |
Adds a directory to the include paths.
The include paths are directories that the compiler will search for included files. The first include path is always /usr/lib/bpp/stdlib/, which contains the standard library for Bash++. Additional include paths are searched in the order they are given
| path | The directory path to add to the include paths |
| std::runtime_error | if the provided path is not a directory |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets the input file for the compiler.
If no input file is set, the compiler will read from stdin. The method verifies that the provided input file exists and is a regular file.
| input_file | The path to the input file to compile |
| std::runtime_error | if the input file does not exist or is not a regular file |
|
inline |
Parses a given output_file argument and updates the Arguments object accordingly.
If '-' is given, compiled code will be written to stdout. Otherwise, the output file path is resolved and verified for write permissions. Exceptions are thrown if the output file is invalid or not writable.
| output_file_arg | The output file argument string to parse |
| std::runtime_error | if the output file argument is invalid or not writable |
|
inline |
Sets the program arguments to be passed to the compiled program.
The program arguments are all of the arguments provided after the input file. e.g.: bpp -a -b -c source.bpp -x -y -z In this case, -x -y -z are the program arguments (passed to the compiled program)
The argv pointers are expected to be borrowed from the original argv passed to main
| argc | The count of program arguments |
| argv | The array of program argument strings (borrowed from main's argv) |
|
inline |
|
inline |
Parses a given target Bash version argument and updates the Arguments object accordingly.
The version argument should be in the format "<major>.<minor>", e.g. "5.2". The method validates the format and updates the target_bash_version member.
| version_arg | The target Bash version argument string to parse |
| std::runtime_error | if the version argument is in an invalid format |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |