Aprepro  5.0x
SEAMS::Scanner Class Reference

#include <apr_scanner.h>

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 Attributes

class Apreproaprepro
 

Friends

class Parser
 

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 
)
override

◆ LexerOutput()

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

◆ 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 ( )
override

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: