|
Bash++
Bash++ compiler internal documentation
|
The main listener class for the Bash++ compiler. More...
#include <BashppListener.h>


Private Member Functions | |
| bool | should_declare_local () const |
Private Attributes | |
| std::string | source_file |
| Path to the source file being compiled (used for error reporting) | |
| bool | included = false |
| std::shared_ptr< std::vector< std::string > > | include_paths = nullptr |
| A list of paths to search for included files. | |
| bool | suppress_warnings = false |
| std::shared_ptr< std::set< std::string > > | included_files = std::make_shared<std::set<std::string>>() |
| A set of (unique) included files (used for '@include_once' directives) | |
| BashppListener * | included_from = nullptr |
| std::vector< std::string > | include_stack |
| A chain of included files, from the main file to the current file (used for error reporting) | |
| std::shared_ptr< std::ostream > | code_buffer |
| std::shared_ptr< std::ostream > | output_stream |
| Pointer to the output stream to write the compiled code to. | |
| std::string | output_file |
| bool | run_on_exit = false |
| BashVersion | target_bash_version = {5, 2} |
| The target Bash version to compile for (default is 5.2) | |
| std::vector< char * > | arguments = {} |
| Command-line arguments to pass to the compiled program if run_on_exit is true. | |
| std::shared_ptr< bpp::bpp_program > | program = std::make_shared<bpp::bpp_program>() |
| bool | in_method = false |
| bool | in_class = false |
| bool | in_supershell = false |
| std::stack< std::monostate > | bash_function_stack |
| std::stack< std::monostate > | dynamic_cast_stack |
| std::stack< std::monostate > | typeof_stack |
| ExpectationsStack | context_expectations_stack |
| std::stack< std::shared_ptr< bpp::bpp_entity > > | entity_stack |
| A stack to keep track of the current entity being processed. | |
| std::unordered_map< std::string, std::string > | replacement_file_contents |
| A map of file paths to replacement contents for those files This is used by the language server to provide unsaved changes to the listener so that we can report diagnostics/completions/etc based on the unsaved changes. | |
| std::shared_ptr< bpp::bpp_class > | primitive |
| bool | lsp_mode = false |
Additional Inherited Members | |
Protected Attributes inherited from AST::BaseListener< BashppListener > | |
| bool | program_has_errors |
| std::vector< AST::ParserError > | parser_errors |
The main listener class for the Bash++ compiler.
This class is the main listener for the Bash++ compiler. This is where the main logic for the compiler is implemented by walking the parse tree.
The listener is responsible for generating the compiled Bash code from the parsed Bash++ code. The listener is also responsible for handling errors and warnings.
A brief run-down of how the parse tree works:
When we enter a node in the parse tree, we execute the enter* function for that node. When we exit a node in the parse tree, we execute the exit* function for that node.
| void BashppListener::enterArrayAssignment | ( | std::shared_ptr< AST::ArrayAssignment > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterArrayIndex | ( | std::shared_ptr< AST::ArrayIndex > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Array indices take the form: [...] Where the contents of the brackets are the array index And can be any valid sequence of statements
| void BashppListener::enterBash53NativeSupershell | ( | std::shared_ptr< AST::Bash53NativeSupershell > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterBashArithmeticForCondition | ( | std::shared_ptr< AST::BashArithmeticForCondition > | node | ) |
| void BashppListener::enterBashArithmeticForStatement | ( | std::shared_ptr< AST::BashArithmeticForStatement > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterBashArithmeticSubstitution | ( | std::shared_ptr< AST::BashArithmeticSubstitution > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Bash arithmetic is a series of arithmetic operations that are enclosed in $((...)) They do not run in a subshell. So, unlike with the subshell rule, We can preserve objects instantiated within the arithmetic context, etc
| void BashppListener::enterBashCasePattern | ( | std::shared_ptr< AST::BashCasePattern > | node | ) |
| void BashppListener::enterBashCasePatternHeader | ( | std::shared_ptr< AST::BashCasePatternHeader > | node | ) |
| void BashppListener::enterBashCaseStatement | ( | std::shared_ptr< AST::BashCaseStatement > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes This file contains parser rules for all of:
Bash case statements take the form case (something) in pattern1) ... ;; ... esac
| void BashppListener::enterBashCommandSequence | ( | std::shared_ptr< AST::BashCommandSequence > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterBashForStatement | ( | std::shared_ptr< AST::BashForStatement > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes This file contains parser rules for all of:
| void BashppListener::enterBashFunction | ( | std::shared_ptr< AST::BashFunction > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Bash functions take the format:
function function_name { ... }
Or: function function_name() { ... }
Or: function_name() { ... }
| void BashppListener::enterBashIfCondition | ( | std::shared_ptr< AST::BashIfCondition > | node | ) |
| void BashppListener::enterBashIfElseBranch | ( | std::shared_ptr< AST::BashIfElseBranch > | node | ) |
| void BashppListener::enterBashIfRootBranch | ( | std::shared_ptr< AST::BashIfRootBranch > | node | ) |
| void BashppListener::enterBashIfStatement | ( | std::shared_ptr< AST::BashIfStatement > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes This file contains parser rules for all of:
Bash if statement take the form if CONDITION; then ... elif CONDITION; then ... else ... fi
The elif/else branches will be caught by the BashIfRootBranch and BashIfElseBranch contexts Both of those will be children of the BashIfStatement context in the parse tree
The only thing that we need to be careful about is this: All of the pre-code which is generated INSIDE of the if CONDITION Should be placed before the if statement altogether, not only before the condition Likewise all of the post-code for the condition should be placed after the if statement
For example, consider the following code: if [[ -f "@this.filePath" ]]; then ... elif [[ -f "@this.otherFilePath" ]]; then ... fi
Pre-code has to be generated in order to access @this.filePath and @this.otherFilePath The pre-code converts these references into ordinary variable references which we can substitute directly into the if condition As in, for example, swapping 'if [[ -f "@this.filePath" ]]' with 'if [[ -f "$filePath" ]]' Although we have better naming conventions for the variables, this is just an example
If we weren't careful, and just placed the pre-code the way we always do, we would end up with something like this: $filePath={whatever we need to do to access @this.filePath} if [[ -f "$filePath" ]]; then ... $otherFilePath={whatever we need to do to access @this.otherFilePath} elif [[ -f "$otherFilePath" ]]; then ... fi
As you can tell from the above, the $otherFilePath assignment is INSIDE the first branch of the if statement And therefore is completely useless – if the first branch is taken, the second branch will never be taken And in the event that the second branch IS taken, $otherFilePath will not be defined
So, what we have to do instead is a bit more like: $filePath={whatever we need to do to access @this.filePath} $otherFilePath={whatever we need to do to access @this.otherFilePath} if [[ -f "$filePath" ]]; then ... elif [[ -f "$otherFilePath" ]]; then ... fi
| void BashppListener::enterBashInCondition | ( | std::shared_ptr< AST::BashInCondition > | node | ) |
| void BashppListener::enterBashPipeline | ( | std::shared_ptr< AST::BashPipeline > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterBashRedirection | ( | std::shared_ptr< AST::BashRedirection > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterBashSelectStatement | ( | std::shared_ptr< AST::BashSelectStatement > | node | ) |
| void BashppListener::enterBashTestConditionCommand | ( | std::shared_ptr< AST::BashTestConditionCommand > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterBashUntilStatement | ( | std::shared_ptr< AST::BashUntilStatement > | node | ) |
| void BashppListener::enterBashVariable | ( | std::shared_ptr< AST::BashVariable > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterBashWhileOrUntilCondition | ( | std::shared_ptr< AST::BashWhileOrUntilCondition > | node | ) |
| void BashppListener::enterBashWhileStatement | ( | std::shared_ptr< AST::BashWhileStatement > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes This file contains parser rules for all of:
BashUntilStatement
| void BashppListener::enterBlock | ( | std::shared_ptr< AST::Block > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Blocks are just groups of statements enclosed in curly-braces Sometimes, a block is a part of a larger construct, such as a method or class definition
| void BashppListener::enterClassDefinition | ( | std::shared_ptr< AST::ClassDefinition > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterConnective | ( | std::shared_ptr< AST::Connective > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterConstructorDefinition | ( | std::shared_ptr< AST::ConstructorDefinition > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Constructor definitions take the form @constructor { ... }
| void BashppListener::enterDatamemberDeclaration | ( | std::shared_ptr< AST::DatamemberDeclaration > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
This will either be:
| void BashppListener::enterDeleteStatement | ( | std::shared_ptr< AST::DeleteStatement > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Delete statements take the form @delete @object Where object is the name of the object to delete
This statement calls the __delete function for the object and the object's destructor if it exists If the destructor exists, it will be called first (before __delete) It then unsets the object
| void BashppListener::enterDestructorDefinition | ( | std::shared_ptr< AST::DestructorDefinition > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Destructor definitions take the form @destructor { ... }
| void BashppListener::enterDoublequotedString | ( | std::shared_ptr< AST::DoublequotedString > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterDynamicCast | ( | std::shared_ptr< AST::DynamicCast > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Dynamic cast statements take the form @dynamic_cast<ClassName> Pointer or: @dynamic_cast<$shell_variable> Pointer or: @dynamic_cast<@object.reference> Pointer Where Pointer is what we're casting
If the cast is in the first form, ClassName refers to the class we're casting to If it's in the second or third form, we expect that the class we're casting to will be evaluated at runtime Ie, the class name is contained in the shell variable or object reference
This statement performs a runtime check to verify the cast is valid And substitutes either the address of the cast object or the @nullptr value
| void BashppListener::enterDynamicCastTarget | ( | std::shared_ptr< AST::DynamicCastTarget > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Dynamic cast targets are the part of a dynamic cast statement that specifies the class we're casting to This can be either an identifier (the name of the class), a shell variable (the name of the class is stored in the variable), or an object reference (the class is determined by the output of the object reference)
| void BashppListener::enterHeredocBody | ( | std::shared_ptr< AST::HeredocBody > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterHereString | ( | std::shared_ptr< AST::HereString > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterIncludeStatement | ( | std::shared_ptr< AST::IncludeStatement > | node | ) |
Handles.
Copyright (C) 2025 rail5 Bash++: Bash with classes
@include_once statements
This function is called when the parser enters an
@include_once statement.
The syntax of an include is:
| dynamic] {PATH} [as "{PATH}"]
For example:
@include_once dynamic <Stack> as "/usr/lib/Stack.sh"
Or:
| void BashppListener::enterMethodDefinition | ( | std::shared_ptr< AST::MethodDefinition > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterNewStatement | ( | std::shared_ptr< AST::NewStatement > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
New statements take the form @new ClassName Where ClassName is the name of the class to instantiate
This statement creates a new object of the specified class And replaces the "@new ClassName" statement with the address of the new object
| void BashppListener::enterObjectAssignment | ( | std::shared_ptr< AST::ObjectAssignment > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterObjectInstantiation | ( | std::shared_ptr< AST::ObjectInstantiation > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
The object type will be stored in one of either IDENTIFIER_LVALUE or IDENTIFIER(0) If IDENTIFIER_LVALUE, then the object name will be in IDENTIFIER(0) If IDENTIFIER(0), then the object name will be in IDENTIFIER(1)
| void BashppListener::enterObjectReference | ( | std::shared_ptr< AST::ObjectReference > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Object references take the form [*|&]@IDENTIFIER.IDENTIFIER.IDENTIFIER... Where each IDENTIFIER following a dot is a member of the object referenced by the preceding IDENTIFIER
This reference may resolve to either an object or a method If it's a primitive object, treat this as an rvalue and get the value of the primitive object If it's a non-primitive object, this is a method call to .toPrimitive If it's a method, call the method in a supershell and substitute the result
This rule handles:
| void BashppListener::enterParameterExpansion | ( | std::shared_ptr< AST::ParameterExpansion > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterPointerDeclaration | ( | std::shared_ptr< AST::PointerDeclaration > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterPrimitiveAssignment | ( | std::shared_ptr< AST::PrimitiveAssignment > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterProcessSubstitution | ( | std::shared_ptr< AST::ProcessSubstitution > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterProgram | ( | std::shared_ptr< AST::Program > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterRawSubshell | ( | std::shared_ptr< AST::RawSubshell > | node | ) |
| void BashppListener::enterRawText | ( | std::shared_ptr< AST::RawText > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterSubshellSubstitution | ( | std::shared_ptr< AST::SubshellSubstitution > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::enterSupershell | ( | std::shared_ptr< AST::Supershell > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
Supershells take the form @(...) Where ... is a series of commands to be executed in a supershell Supershells can be nested
| void BashppListener::enterTypeofExpression | ( | std::shared_ptr< AST::TypeofExpression > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
The typeof statement is used to determine the type of a value at runtime. It takes the form: @typeof
Where
is a valid rvalue.
| void BashppListener::enterValueAssignment | ( | std::shared_ptr< AST::ValueAssignment > | node | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::exitArrayAssignment | ( | std::shared_ptr< AST::ArrayAssignment > | node | ) |
| void BashppListener::exitArrayIndex | ( | std::shared_ptr< AST::ArrayIndex > | node | ) |
| void BashppListener::exitBash53NativeSupershell | ( | std::shared_ptr< AST::Bash53NativeSupershell > | node | ) |
| void BashppListener::exitBashArithmeticForCondition | ( | std::shared_ptr< AST::BashArithmeticForCondition > | node | ) |
| void BashppListener::exitBashArithmeticForStatement | ( | std::shared_ptr< AST::BashArithmeticForStatement > | node | ) |
| void BashppListener::exitBashArithmeticSubstitution | ( | std::shared_ptr< AST::BashArithmeticSubstitution > | node | ) |
| void BashppListener::exitBashCasePattern | ( | std::shared_ptr< AST::BashCasePattern > | node | ) |
| void BashppListener::exitBashCasePatternHeader | ( | std::shared_ptr< AST::BashCasePatternHeader > | node | ) |
| void BashppListener::exitBashCaseStatement | ( | std::shared_ptr< AST::BashCaseStatement > | node | ) |
| void BashppListener::exitBashCommandSequence | ( | std::shared_ptr< AST::BashCommandSequence > | node | ) |
| void BashppListener::exitBashForStatement | ( | std::shared_ptr< AST::BashForStatement > | node | ) |
| void BashppListener::exitBashFunction | ( | std::shared_ptr< AST::BashFunction > | node | ) |
| void BashppListener::exitBashIfCondition | ( | std::shared_ptr< AST::BashIfCondition > | node | ) |
| void BashppListener::exitBashIfElseBranch | ( | std::shared_ptr< AST::BashIfElseBranch > | node | ) |
| void BashppListener::exitBashIfRootBranch | ( | std::shared_ptr< AST::BashIfRootBranch > | node | ) |
| void BashppListener::exitBashIfStatement | ( | std::shared_ptr< AST::BashIfStatement > | node | ) |
| void BashppListener::exitBashInCondition | ( | std::shared_ptr< AST::BashInCondition > | node | ) |
| void BashppListener::exitBashPipeline | ( | std::shared_ptr< AST::BashPipeline > | node | ) |
| void BashppListener::exitBashRedirection | ( | std::shared_ptr< AST::BashRedirection > | node | ) |
| void BashppListener::exitBashSelectStatement | ( | std::shared_ptr< AST::BashSelectStatement > | node | ) |
| void BashppListener::exitBashTestConditionCommand | ( | std::shared_ptr< AST::BashTestConditionCommand > | node | ) |
| void BashppListener::exitBashUntilStatement | ( | std::shared_ptr< AST::BashUntilStatement > | node | ) |
| void BashppListener::exitBashVariable | ( | std::shared_ptr< AST::BashVariable > | node | ) |
| void BashppListener::exitBashWhileOrUntilCondition | ( | std::shared_ptr< AST::BashWhileOrUntilCondition > | node | ) |
| void BashppListener::exitBashWhileStatement | ( | std::shared_ptr< AST::BashWhileStatement > | node | ) |
| void BashppListener::exitBlock | ( | std::shared_ptr< AST::Block > | node | ) |
| void BashppListener::exitClassDefinition | ( | std::shared_ptr< AST::ClassDefinition > | node | ) |
| void BashppListener::exitConnective | ( | std::shared_ptr< AST::Connective > | node | ) |
| void BashppListener::exitConstructorDefinition | ( | std::shared_ptr< AST::ConstructorDefinition > | node | ) |
| void BashppListener::exitDatamemberDeclaration | ( | std::shared_ptr< AST::DatamemberDeclaration > | node | ) |
| void BashppListener::exitDeleteStatement | ( | std::shared_ptr< AST::DeleteStatement > | node | ) |
| void BashppListener::exitDestructorDefinition | ( | std::shared_ptr< AST::DestructorDefinition > | node | ) |
| void BashppListener::exitDoublequotedString | ( | std::shared_ptr< AST::DoublequotedString > | node | ) |
| void BashppListener::exitDynamicCast | ( | std::shared_ptr< AST::DynamicCast > | node | ) |
| void BashppListener::exitDynamicCastTarget | ( | std::shared_ptr< AST::DynamicCastTarget > | node | ) |
| void BashppListener::exitHeredocBody | ( | std::shared_ptr< AST::HeredocBody > | node | ) |
| void BashppListener::exitHereString | ( | std::shared_ptr< AST::HereString > | node | ) |
| void BashppListener::exitIncludeStatement | ( | std::shared_ptr< AST::IncludeStatement > | node | ) |
| void BashppListener::exitMethodDefinition | ( | std::shared_ptr< AST::MethodDefinition > | node | ) |
| void BashppListener::exitNewStatement | ( | std::shared_ptr< AST::NewStatement > | node | ) |
| void BashppListener::exitObjectAssignment | ( | std::shared_ptr< AST::ObjectAssignment > | node | ) |
| void BashppListener::exitObjectInstantiation | ( | std::shared_ptr< AST::ObjectInstantiation > | node | ) |
| void BashppListener::exitObjectReference | ( | std::shared_ptr< AST::ObjectReference > | node | ) |
There are 12 possible combinations here: LVALUE SELF_REF POINTER_DEREF OBJ_ADDRESS
POINTER_DEREF and OBJ_ADDRESS are mutually exclusive, so combinations where both are 1 are invalid
| void BashppListener::exitParameterExpansion | ( | std::shared_ptr< AST::ParameterExpansion > | node | ) |
| void BashppListener::exitPointerDeclaration | ( | std::shared_ptr< AST::PointerDeclaration > | node | ) |
| void BashppListener::exitPrimitiveAssignment | ( | std::shared_ptr< AST::PrimitiveAssignment > | node | ) |
| void BashppListener::exitProcessSubstitution | ( | std::shared_ptr< AST::ProcessSubstitution > | node | ) |
| void BashppListener::exitProgram | ( | std::shared_ptr< AST::Program > | node | ) |
| void BashppListener::exitRawSubshell | ( | std::shared_ptr< AST::RawSubshell > | node | ) |
| void BashppListener::exitRawText | ( | std::shared_ptr< AST::RawText > | node | ) |
| void BashppListener::exitSubshellSubstitution | ( | std::shared_ptr< AST::SubshellSubstitution > | node | ) |
| void BashppListener::exitSupershell | ( | std::shared_ptr< AST::Supershell > | node | ) |
| void BashppListener::exitTypeofExpression | ( | std::shared_ptr< AST::TypeofExpression > | node | ) |
| void BashppListener::exitValueAssignment | ( | std::shared_ptr< AST::ValueAssignment > | node | ) |
Value assignments will appear in the following contexts:
| const std::vector< std::string > & BashppListener::get_include_stack | ( | ) |
| std::shared_ptr< std::set< std::string > > BashppListener::get_included_files | ( | ) |
| bool BashppListener::get_lsp_mode | ( | ) |
| std::shared_ptr< bpp::bpp_program > BashppListener::get_program | ( | ) |
| std::string BashppListener::get_source_file | ( | ) |
| std::shared_ptr< bpp::bpp_code_entity > BashppListener::latest_code_entity | ( | ) |
| void BashppListener::set_arguments | ( | std::vector< char * > | arguments | ) |
| void BashppListener::set_code_buffer | ( | std::shared_ptr< std::ostream > | code_buffer | ) |
| void BashppListener::set_include_paths | ( | std::shared_ptr< std::vector< std::string > > | include_paths | ) |
| void BashppListener::set_included | ( | bool | included | ) |
| void BashppListener::set_included_files | ( | std::shared_ptr< std::set< std::string > > | included_files | ) |
Sets the included_files pointer to the given set of included files.
| void BashppListener::set_included_from | ( | BashppListener * | included_from | ) |
Sets the included_from pointer to the given listener.
| void BashppListener::set_lsp_mode | ( | bool | lsp_mode | ) |
| void BashppListener::set_output_file | ( | std::string | output_file | ) |
| void BashppListener::set_output_stream | ( | std::shared_ptr< std::ostream > | output_stream | ) |
| void BashppListener::set_replacement_file_contents | ( | const std::string & | file_path, |
| const std::string & | contents | ||
| ) |
| void BashppListener::set_run_on_exit | ( | bool | run_on_exit | ) |
| void BashppListener::set_source_file | ( | std::string | source_file | ) |
Copyright (C) 2025 rail5 Bash++: Bash with classes
| void BashppListener::set_suppress_warnings | ( | bool | suppress_warnings | ) |
| void BashppListener::set_target_bash_version | ( | BashVersion | target_bash_version | ) |
|
private |
|
private |
Command-line arguments to pass to the compiled program if run_on_exit is true.
|
private |
|
private |
|
private |
|
private |
|
private |
A stack to keep track of the current entity being processed.
For example, when we encounter a class definition, we push the class onto the entity_stack. Then, inside that class, when we encounter a method definition, we push the method onto the entity_stack. Inside that method, when we encounter a value assignment, we push the value assignment onto the entity_stack. When we're done with the value assignment, we pop it off the entity_stack, so that the method is now at the top of the stack. When we're done with the method, we pop it off the entity_stack, so that the class is now at the top of the stack. When we're done with the class, we pop it off the entity_stack, so that the program is now at the top of the stack.
|
private |
|
private |
|
private |
|
private |
A list of paths to search for included files.
|
private |
A chain of included files, from the main file to the current file (used for error reporting)
|
private |
|
private |
A set of (unique) included files (used for '@include_once' directives)
|
private |
|
private |
|
private |
|
private |
Pointer to the output stream to write the compiled code to.
|
private |
|
private |
|
private |
A map of file paths to replacement contents for those files This is used by the language server to provide unsaved changes to the listener so that we can report diagnostics/completions/etc based on the unsaved changes.
|
private |
|
private |
Path to the source file being compiled (used for error reporting)
|
private |
|
private |
The target Bash version to compile for (default is 5.2)
|
private |