Bash++
Bash++ compiler internal documentation
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
AST::BashppParser Class Reference

A driver class to wrap around the Bison-generated parser for Bash++. This class manages both the lexer and parser state, and provides methods to set the input source. More...

#include <BashppParser.h>

Public Member Functions

 BashppParser ()=default
 
void setUTF16Mode (bool enabled)
 
bool getUTF16Mode () const
 
void setDisplayLexerOutput (bool enabled)
 
bool getDisplayLexerOutput () const
 
void setInputFromFilePath (const std::string &file_path)
 
void setInputFromFilePtr (FILE *file_ptr, const std::string &file_path)
 
void setInputFromStringContents (const std::string &contents)
 
void setIncludeChain (const std::vector< std::string > &includes)
 
std::shared_ptr< AST::Programprogram ()
 

Private Types

enum class  InputType { FILEPATH , FILEPTR , STRING_CONTENTS }
 

Private Member Functions

void _initialize_lexer ()
 
void _destroy_lexer ()
 
void _parse ()
 

Private Attributes

yyscan_t lexer
 
std::shared_ptr< AST::Programm_program = nullptr
 
bool current_command_can_receive_lvalues = true
 
bool utf16_mode = false
 
bool display_lexer_output = false
 
std::string input_file_path = "<stdin>"
 
std::vector< std::string > include_chain
 
enum AST::BashppParser::InputType input_type = InputType::FILEPATH
 
std::variant< std::string, FILE *, std::monostate > input_source = std::monostate{}
 
std::string input_string_contents
 
FILE * input_file = nullptr
 

Detailed Description

A driver class to wrap around the Bison-generated parser for Bash++. This class manages both the lexer and parser state, and provides methods to set the input source.

Member Enumeration Documentation

◆ InputType

enum class AST::BashppParser::InputType
strongprivate
Enumerator
FILEPATH 
FILEPTR 
STRING_CONTENTS 

Constructor & Destructor Documentation

◆ BashppParser()

AST::BashppParser::BashppParser ( )
default

Member Function Documentation

◆ _destroy_lexer()

void AST::BashppParser::_destroy_lexer ( )
private

◆ _initialize_lexer()

void AST::BashppParser::_initialize_lexer ( )
private

◆ _parse()

void AST::BashppParser::_parse ( )
private

◆ getDisplayLexerOutput()

bool AST::BashppParser::getDisplayLexerOutput ( ) const

◆ getUTF16Mode()

bool AST::BashppParser::getUTF16Mode ( ) const

◆ program()

std::shared_ptr< AST::Program > AST::BashppParser::program ( )

◆ setDisplayLexerOutput()

void AST::BashppParser::setDisplayLexerOutput ( bool  enabled)

◆ setIncludeChain()

void AST::BashppParser::setIncludeChain ( const std::vector< std::string > &  includes)

◆ setInputFromFilePath()

void AST::BashppParser::setInputFromFilePath ( const std::string &  file_path)

◆ setInputFromFilePtr()

void AST::BashppParser::setInputFromFilePtr ( FILE *  file_ptr,
const std::string &  file_path 
)

◆ setInputFromStringContents()

void AST::BashppParser::setInputFromStringContents ( const std::string &  contents)

◆ setUTF16Mode()

void AST::BashppParser::setUTF16Mode ( bool  enabled)

Member Data Documentation

◆ current_command_can_receive_lvalues

bool AST::BashppParser::current_command_can_receive_lvalues = true
private

◆ display_lexer_output

bool AST::BashppParser::display_lexer_output = false
private

◆ include_chain

std::vector<std::string> AST::BashppParser::include_chain
private

◆ input_file

FILE* AST::BashppParser::input_file = nullptr
private

◆ input_file_path

std::string AST::BashppParser::input_file_path = "<stdin>"
private

◆ input_source

std::variant<std::string, FILE*, std::monostate> AST::BashppParser::input_source = std::monostate{}
private

◆ input_string_contents

std::string AST::BashppParser::input_string_contents
private

◆ input_type

enum AST::BashppParser::InputType AST::BashppParser::input_type = InputType::FILEPATH
private

◆ lexer

yyscan_t AST::BashppParser::lexer
private

◆ m_program

std::shared_ptr<AST::Program> AST::BashppParser::m_program = nullptr
private

◆ utf16_mode

bool AST::BashppParser::utf16_mode = false
private

The documentation for this class was generated from the following files: