Aprepro  5.0x
SEAMS::Scanner Class Reference

#include <apr_scanner.h>

Inheritance diagram for SEAMS::Scanner:
Collaboration diagram for SEAMS::Scanner:

Public Member Functions

 Scanner (Aprepro &aprepro_yyarg, std::istream *in=nullptr, std::ostream *out=nullptr)
 
 ~Scanner () override
 
void add_include_file (const std::string &filename, bool must_exist)
 
int yywrap () override
 
void yyerror (const char *s)
 
void LexerOutput (const char *buf, int size) override
 
int LexerInput (char *buf, int max_size) override
 
virtual Parser::token_type lex (Parser::semantic_type *yylval)
 
char * rescan (char *string)
 
char * execute (char *string)
 
char * if_handler (double x)
 
char * elseif_handler (double x)
 
char * switch_handler (double x)
 
char * case_handler (double x)
 
void set_debug (bool b)
 
void save_history_string ()
 
- Public Member Functions inherited from SEAMSFlexLexer
 SEAMSFlexLexer (std::istream *arg_yyin=nullptr, std::ostream *arg_yyout=nullptr)
 
 ~SEAMSFlexLexer () override
 
void yy_switch_to_buffer (struct yy_buffer_state *new_buffer) override
 
struct yy_buffer_stateyy_create_buffer (std::istream *file, int size) override
 
void yy_delete_buffer (struct yy_buffer_state *b) override
 
void yyrestart (std::istream *input_file) override
 
void yypush_buffer_state (struct yy_buffer_state *new_buffer)
 
void yypop_buffer_state ()
 
int yylex () override
 
void switch_streams (std::istream *new_in, std::ostream *new_out=nullptr) override
 
- Public Member Functions inherited from FlexLexer
 FlexLexer ()
 
virtual ~FlexLexer ()
 
const char * YYText () const
 
int YYLeng () const
 
int yylex (std::istream *new_in, std::ostream *new_out=nullptr)
 
int lineno () const
 
int debug () const
 
void set_debug (int flag)
 

Public Attributes

class Apreproaprepro
 

Friends

class Parser
 

Additional Inherited Members

- Protected Member Functions inherited from SEAMSFlexLexer
virtual void LexerError (const char *msg)
 
void yyunput (int c, char *yy_bp)
 
int yyinput ()
 
void yy_load_buffer_state ()
 
void yy_init_buffer (struct yy_buffer_state *b, std::istream *file)
 
void yy_flush_buffer (struct yy_buffer_state *b)
 
void yy_push_state (int new_state)
 
void yy_pop_state ()
 
int yy_top_state ()
 
yy_state_type yy_get_previous_state ()
 
yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state)
 
int yy_get_next_buffer ()
 
void yyensure_buffer_stack (void)
 
- Protected Attributes inherited from SEAMSFlexLexer
int yy_start_stack_ptr
 
int yy_start_stack_depth
 
int * yy_start_stack
 
std::istream * yyin
 
std::ostream * yyout
 
char yy_hold_char
 
int yy_n_chars
 
char * yy_c_buf_p
 
int yy_init
 
int yy_start
 
int yy_did_buffer_switch_on_eof
 
size_t yy_buffer_stack_top
 
size_t yy_buffer_stack_max
 
struct yy_buffer_state ** yy_buffer_stack
 
yy_state_type yy_last_accepting_state
 
char * yy_last_accepting_cpos
 
yy_state_typeyy_state_buf
 
yy_state_typeyy_state_ptr
 
char * yy_full_match
 
int * yy_full_state
 
int yy_full_lp
 
int yy_lp
 
int yy_looking_for_trail_begin
 
int yy_more_flag
 
int yy_more_len
 
int yy_more_offset
 
int yy_prev_more_offset
 
- Protected Attributes inherited from FlexLexer
char * yytext
 
int yyleng
 
int yylineno
 
int yy_flex_debug
 

Detailed Description

Scanner is a derived class to add some extra function to the scanner class. Flex itself creates a class named yyFlexLexer, which is renamed using macros to SEAMSFlexLexer. However we change the context of the generated yylex() function to be contained within the Scanner class. This is required because the yylex() defined in SEAMSFlexLexer has no parameters.

Constructor & Destructor Documentation

◆ Scanner()

SEAMS::Scanner::Scanner ( Aprepro aprepro_yyarg,
std::istream *  in = nullptr,
std::ostream *  out = nullptr 
)
explicit

Create a new scanner object. The streams arg_yyin and arg_yyout default to cin and cout, but that assignment is only made when initializing in yylex().

◆ ~Scanner()

SEAMS::Scanner::~Scanner ( )
override

Required for virtual functions

Member Function Documentation

◆ add_include_file()

void SEAMS::Scanner::add_include_file ( const std::string &  filename,
bool  must_exist 
)

◆ case_handler()

char * SEAMS::Scanner::case_handler ( double  x)

◆ elseif_handler()

char * SEAMS::Scanner::elseif_handler ( double  x)

◆ execute()

char * SEAMS::Scanner::execute ( char *  string)

◆ if_handler()

char * SEAMS::Scanner::if_handler ( double  x)

◆ lex()

virtual Parser::token_type SEAMS::Scanner::lex ( Parser::semantic_type yylval)
virtual

This is the main lexing function. It is generated by flex according to the macro declaration YY_DECL above. The generated bison parser then calls this virtual function to fetch new tokens.

◆ LexerInput()

int SEAMS::Scanner::LexerInput ( char *  buf,
int  max_size 
)
overridevirtual

Reimplemented from SEAMSFlexLexer.

◆ LexerOutput()

void SEAMS::Scanner::LexerOutput ( const char *  buf,
int  size 
)
overridevirtual

Reimplemented from SEAMSFlexLexer.

◆ rescan()

char * SEAMS::Scanner::rescan ( char *  string)

◆ save_history_string()

void SEAMS::Scanner::save_history_string ( )

◆ set_debug()

void SEAMS::Scanner::set_debug ( bool  b)

Enable debug output (via arg_yyout) if compiled into the scanner.

◆ switch_handler()

char * SEAMS::Scanner::switch_handler ( double  x)

◆ yyerror()

void SEAMS::Scanner::yyerror ( const char *  s)

◆ yywrap()

int SEAMS::Scanner::yywrap ( )
overridevirtual

Reimplemented from SEAMSFlexLexer.

Friends And Related Function Documentation

◆ Parser

friend class Parser
friend

Member Data Documentation

◆ aprepro

class Aprepro& SEAMS::Scanner::aprepro

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