| eRPC Generator (erpcgen) Rev. 1.8.1 NXP Semiconductors

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
erpcgen::ErpcLexer Class Reference

Lexical scanner class for erpcgen interface files. More...

`#include <ErpcLexer.h>`

Inheritance diagram for erpcgen::ErpcLexer:

## Public Member Functions
| ErpcLexer (const char *inputFile)
| This function is constructor of ErpcLexer class. More...
| ~ErpcLexer ()
| This function is destructor of ErpcLexer class.
virtual Token * | getNextToken ()
| This function returns next Token from flex lexer. More...
token_loc_t & | getLocation ()
| returns the current token's location in loc. More...
void | pushFile (const std::string &fileName)
| Suspend actual and give new file to flex. More...
void | popFile ()
| Give suspended file to flex.
std::string & | getFileName ()
| return current file name More...
uint16_t | getIdlCrc16 ()
| This function returns crc16 of all used IDL files. More...

## Protected Member Functions
virtual void | LexerError (const char *msg)
| This function thrown lexical_error with given message. More...
int | processStringEscapes (const char *in, char *out)
| Reads the in string and writes to the out string. More...
virtual int | yylex ()
| Internal lexer interface. More...
CurrentFileInfo * | openFile (const std::string &fileName)
| This function open file. More...

## Protected Attributes
Value * | m_value
token_loc_t | m_location
uint32_t | m_indents
CurrentFileInfo * | m_currentFileInfo
uint16_t | m_idlCrc16

## Detailed Description

Lexical scanner class for erpcgen interface 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.

## Constructor & Destructor Documentation

ErpcLexer::ErpcLexer | ( | const char * | inputFile | ) |

This function is constructor of ErpcLexer class.

This function set given file for flex lexer.

Parameters

  [in] | inputFile | This variable contains file name and can contains also path to file. File is given to flex lexical analysis.

## Member Function Documentation

std::string& erpcgen::ErpcLexer::getFileName | ( |  | ) |
| inline

return current file name

Returns
  Current file name.

uint16_t erpcgen::ErpcLexer::getIdlCrc16 | ( |  | ) |
| inline

This function returns crc16 of all used IDL files.

Returns
  Crc16 of all used IDL files.

token_loc_t& erpcgen::ErpcLexer::getLocation | ( |  | ) |
| inline

returns the current token's location in loc.

Returns
  Current token's location.

Token * ErpcLexer::getNextToken | ( |  | ) |
| virtual

This function returns next Token from flex lexer.

Returns
  A newly allocated Token object. Ownership of this token is passed to the caller, who is responsible for its deallocation. If the end of input is reached, NULL is returned instead.

void ErpcLexer::LexerError | ( | const char * | msg | ) |
| protected virtual

This function thrown lexical_error with given message.

Parameters

  [in] | msg | Message, which is showed, when this functions is called.

Exceptions

  lexical_error | Thrown always, when function is called.

CurrentFileInfo * ErpcLexer::openFile | ( | const std::string & | fileName | ) |
| protected

This function open file.

This function will try find and open file, which is given be file name variable. When file is found and opened new current file info object is created.

Parameters

  [in] | fileName | File name, which can contains also path to file, which is given to flex lexical analysis.

Returns
  return new current file info object if file is found and opened.

Exceptions

  std::runtime_error | Thrown if file is not found.
  std::runtime_error | Thrown if file can not open.
  std::runtime_error | Thrown if can not create ifstream object from file.

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

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.

void ErpcLexer::pushFile | ( | const std::string & | fileName | ) |

Suspend actual and give new file to flex.

This function set to flex lexer new file, when import file request is inside parsed file.

Parameters

  [in] | fileName | File name, which can contains also path to file, which is given to flex lexical analysis.

virtual int erpcgen::ErpcLexer::yylex | ( |  | ) |
| protected virtual

Internal lexer interface.

Returns
  returns one token.

## Member Data Documentation

CurrentFileInfo* erpcgen::ErpcLexer::m_currentFileInfo
| protected

Pointer to current file info.

uint16_t erpcgen::ErpcLexer::m_idlCrc16
| protected

Crc16 of IDL files.

uint32_t erpcgen::ErpcLexer::m_indents
| protected

How much indents can be removed from newlines in doxygen comments.

token_loc_t erpcgen::ErpcLexer::m_location
| protected

Location for the current token.

Value* erpcgen::ErpcLexer::m_value
| protected

Value for the current token.

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

- ErpcLexer.h
- ErpcLexer.cpp