elftosb::ElftosbLexer Class Reference

Lexical scanner class for elftosb command files. More...

`#include <ElftosbLexer.h>`

Inheritance diagram for elftosb::ElftosbLexer:
[legend]
Collaboration diagram for elftosb::ElftosbLexer:
[legend]

## Public Member Functions

| ElftosbLexer (istream &inputStream)
| Constructor.
virtual int | yylex ()
| Lexer interface. Returns one token.
virtual void | getSymbolValue (YYSTYPE *value)
| Returns the value for the most recently produced token in value.
token_loc_t & | getLocation ()
| Returns the current token's location in loc.
Source names
void | addSourceName (std::string *ident)
bool | isSourceName (std::string *ident)
Public Member Functions inherited from yyFlexLexer
| yyFlexLexer (FLEX_STD istream *arg_yyin=0, FLEX_STD ostream *arg_yyout=0)
void | yy_switch_to_buffer (struct yy_buffer_state *new_buffer)
struct yy_buffer_state * | yy_create_buffer (FLEX_STD istream *s, int size)
void | yy_delete_buffer (struct yy_buffer_state *b)
void | yyrestart (FLEX_STD istream *s)
void | yypush_buffer_state (struct yy_buffer_state *new_buffer)
void | yypop_buffer_state ()
virtual void | switch_streams (FLEX_STD istream *new_in, FLEX_STD ostream *new_out=0)
virtual int | yywrap ()
Public Member Functions inherited from FlexLexer
const char * | YYText () const
int | YYLeng () const
int | yylex (FLEX_STD istream *new_in, FLEX_STD ostream *new_out=0)
int | lineno () const
int | debug () const
void | set_debug (int flag)

## Protected Types

typedef std::vector< std::string > | string_vector_t

## Protected Member Functions

virtual void | LexerError (const char *msg)
| Throw an elftosb::lexical_error exception.
int | processStringEscapes (const char *in, char *out)
| Process a string containing escape sequences. More...
Protected Member Functions inherited from yyFlexLexer
virtual size_t | LexerInput (char *buf, size_t max_size)
virtual void | LexerOutput (const char *buf, size_t size)
void | yyunput (int c, char *buf_ptr)
int | yyinput ()
void | yy_load_buffer_state ()
void | yy_init_buffer (struct yy_buffer_state *b, FLEX_STD istream *s)
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 current_state)
int | yy_get_next_buffer ()
void | yyensure_buffer_stack (void)

## Protected Attributes

YYSTYPE | m_symbolValue
| Value for the current token.
int | m_line
| Current line number.
token_loc_t | m_location
| Location for the current token.
Blob * | m_blob
| The binary object value as its being constructed.
int | m_blobFirstLine
| Line number for the first character of a blob.
string_vector_t | m_sources
| Vector of source identifiers;.
Protected Attributes inherited from yyFlexLexer
int | yy_start_stack_ptr
int | yy_start_stack_depth
int * | yy_start_stack
FLEX_STD istream * | yyin
FLEX_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_type * | yy_state_buf
yy_state_type * | yy_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

Lexical scanner class for elftosb command files.

This class is a subclass of the standard C++ lexer class produced by Flex. It's primary purpose is to provide a clean way to report values for symbols, without using the yylval global. This is necessary because the parser produced by Bison is a "pure" parser.

In addition, this class manages a list of source names generated by parsing. The lexer uses this list to determine if an identifier is a source name or a constant identifier.

## Member Function Documentation

int ElftosbLexer::processStringEscapes | ( | const char * | in,
|  | char * | out
| ) |  |

protected

Process a string containing escape sequences.

Reads the in string and writes to the out string. These strings can be the same string since the read head is always in front of the write head.

Parameters

  [in] | in | Input string containing C-style escape sequences.
  [out] | out | Output string. All escape sequences in the input string have been converted to the actual characters. May point to the same string as in.

Returns
  The length of the resulting out string. This length is necessary because the string may have contained escape sequences that inserted null characters.

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

- ElftosbLexer.h
- ElftosbLexer.cpp