| 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::SymbolScanner Class Reference

Scans for symbol names. More...

`#include <SymbolScanner.h>`

Inheritance diagram for erpcgen::SymbolScanner:

## Public Member Functions
| SymbolScanner (SymbolScope *globals)
| This function is constructor of symbol scanner class. More...
| SymbolScanner (SymbolScope *globals, std::string fileName)
| This function is constructor of symbol scanner class. More...
virtual | ~SymbolScanner ()
| Destructor.
Program * | getProgram ()
| Program is out of global symbol scope. More...
Public Member Functions inherited from erpcgen::AstWalker
| AstWalker ()=default
| default constructor
| AstWalker (std::string inputFile)
| Constructor. More...
virtual | ~AstWalker ()=default
| destructor
virtual void | startWalk (AstNode *node)
| This function walk the AstNode depth-first and invoke handler methods. More...

## Protected Member Functions
virtual void | handleRoot (AstNode *node, bottom_up)
| This function is called at the end of scanning. More...
virtual AstNode * | handleProgram (AstNode *node, top_down)
| This function start handle program. More...
virtual AstNode * | handleProgram (AstNode *node, bottom_up)
| This function start handle program. More...
virtual AstNode * | handleConst (AstNode *node, bottom_up)
| This function handles a constant definition. More...
virtual AstNode * | handleType (AstNode *node, top_down)
| This function start handle type. More...
virtual AstNode * | handleType (AstNode *node, bottom_up)
| This function end handle type. More...
virtual AstNode * | handleEnum (AstNode *node, top_down)
| This function end handle enum. More...
virtual AstNode * | handleEnum (AstNode *node, bottom_up)
| This function end handle enum. More...
virtual AstNode * | handleEnumMember (AstNode *node, bottom_up)
| This function end handle enum member. More...
bool | enumMemberHasValue (AstNode *enumMember)
| Check to see if enum member is assigned a value by the user. More...
virtual AstNode * | handleExpr (AstNode *node, bottom_up)
| This function start handle expression. More...
virtual AstNode * | handleBinaryOp (AstNode *node, bottom_up)
| This function end handle binary operator. More...
virtual AstNode * | handleUnaryOp (AstNode *node, bottom_up)
| This function end handle unary operator. More...
virtual AstNode * | handleStruct (AstNode *node, top_down)
| This function start handle struct. More...
virtual AstNode * | handleStruct (AstNode *node, bottom_up)
| This function end handle struct. More...
virtual AstNode * | handleStructMember (AstNode *node, bottom_up)
| This function end handle struct member. More...
virtual AstNode * | handleUnion (AstNode *node, top_down)
| Handles Union data type while traversing down the AST. More...
virtual AstNode * | handleUnion (AstNode *node, bottom_up)
| Handles Union data type while traversing down the AST. More...
virtual AstNode * | handleUnionCase (AstNode *node, top_down)
virtual AstNode * | handleUnionCase (AstNode *node, bottom_up)
| This function end handle struct member. More...
virtual AstNode * | handleInterface (AstNode *node, top_down)
| This function start handle interface. More...
virtual AstNode * | handleInterface (AstNode *node, bottom_up)
| This function end handle interface. More...
virtual AstNode * | handleFunction (AstNode *node, top_down)
| This function start handle function. More...
virtual AstNode * | handleFunction (AstNode *node, bottom_up)
| This function end handle function. More...
virtual AstNode * | handleParam (AstNode *node, top_down)
| This function start handle function parameter. More...
virtual AstNode * | handleParam (AstNode *node, bottom_up)
| This function end handle function parameter. More...
void | setParameterDirection (StructMember *param, AstNode *directionNode)
| set parameter direction: in, out, inout More...
Value * | getValueFromSymbol (Token &tok)
| Get value from symbol table for name defined by given token. More...
DataType * | getDataTypeForConst (AstNode *typeNode)
| This function returns the data type for a constant variable. More...
bool | containsStructEnumDeclaration (const AstNode *typeNode)
| Returns true when given Astnode is enum or structure declaration. More...
DataType * | lookupDataType (const AstNode *typeNode)
| This function returns pointer to new type object. More...
DataType * | createListType (const AstNode *typeNode)
| This function returns pointer to new list object. More...
DataType * | createArrayType (const AstNode *typeNode)
| This function returns pointer to new array object. More...
DataType * | lookupDataTypeByName (const Token &tok, SymbolScope *scope, bool recursive=true)
| This function returns pointer to new type object. More...
uint64_t | getIntExprValue (const AstNode *exprNode)
| This function returns token integer value. More...
bool | rhsIsAStringLiteral (AstNode *rhs)
| Determines if the right hand side of a constant declaration is a string literal. More...
bool | rhsIsAnExpression (AstNode *rhs)
| Determines if the right hand side of a constant declaration is an expression. More...
Value * | getValueForConst (AstNode *const node, DataType *const constDataType)
| Gets the value object for the const variable. More...
void | addAnnotations (AstNode *childTok, Symbol *symbol)
| This function add annotations to vector of symbol annotations. More...
void | checkAnnotationBeforeAdding (AstNode *annotation, Symbol *symbol)
| This function check annotation just before it will be added to symbol. More...
Value * | getAnnotationValue (AstNode *annotationNode)
| Helper function to get Value from annotation AstNode. More...
Annotation::program_lang_t | getAnnotationLang (AstNode *annotationNode)
| Helper function to get programming language type if specified for which is annotation intended. More...
void | scanStructForAnnotations ()
| Controlling annotations used on structure members. More...
void | addDoxygenComments (Symbol *symbol, AstNode *above, AstNode *trailing)
| This function sets to given symbol given doxygen comments. More...
StructMember * | createCallbackParam (StructMember *structMember, const std::string &name)
| This function creates new function parameter. More...
void | addForwardDeclaration (DataType *dataType)
| This function registers forward union/structure declarations. More...
void | removeForwardDeclaration (DataType *dataType)
| This function unregister union/structure declarations. More...
void | addGlobalSymbol (Symbol *symbol)
| This function add symbol into global symbol scope. More...
Protected Member Functions inherited from erpcgen::AstWalker
virtual void | walk (AstNode *node)
| This function walk the AstNode depth-first and invoke handler methods. More...
template<typename D >
void | dispatch (AstNode *node)
| This function invoke the appropriate handler method for the node's token type.. More...
virtual void | handleRoot (AstNode *node, top_down)
virtual AstNode * | handleConst (AstNode *node, top_down)
virtual AstNode * | handleChildren (AstNode *node, top_down)
virtual AstNode * | handleEnumMember (AstNode *node, top_down)
virtual AstNode * | handleStructMember (AstNode *node, top_down)
virtual AstNode * | handleExpr (AstNode *node, top_down)
virtual AstNode * | handleBinaryOp (AstNode *node, top_down)
virtual AstNode * | handleUnaryOp (AstNode *node, top_down)
virtual AstNode * | handleAnnotation (AstNode *node, top_down)
virtual AstNode * | handleChildren (AstNode *node, bottom_up)
virtual AstNode * | handleAnnotation (AstNode *node, bottom_up)

## Protected Attributes
SymbolScope * | m_globals
Interface * | m_currentInterface
StructType * | m_currentStruct
Program * | m_currentProgram
EnumType * | m_currentEnum
AliasType * | m_currentAlias
UnionType * | m_currentUnion
std::vector< UnionCase * > | m_emptyUnionCases
std::map< std::string, DataType * > | m_forwardDeclarations
Protected Attributes inherited from erpcgen::AstWalker
std::string | m_fileName
| Stores name of file from which AST was built.

## Detailed Description

Scans for symbol names.

## Constructor & Destructor Documentation

erpcgen::SymbolScanner::SymbolScanner | ( | SymbolScope * | globals | ) |
| inline

This function is constructor of symbol scanner class.

This function set their variables to default values, when object is created.

Parameters

  [in] | globals | Global symbol scope variable.

erpcgen::SymbolScanner::SymbolScanner | ( | SymbolScope * | globals,
|  | std::string | fileName
| ) |  |
| inline

This function is constructor of symbol scanner class.

This function set their variables to default values, when object is created.

Parameters

  [in] | globals | Global symbol scope variable.
  [in] | fileName | name of IDL from which AST was built.

## Member Function Documentation

void SymbolScanner::addAnnotations | ( | AstNode * | childTok,
|  | Symbol * | symbol
| ) |  |
| protected

This function add annotations to vector of symbol annotations.

Parameters

  [in] | childTok | AstNode contains annotations information.
  [in] | symbol | Symbol containing vector of annotations belongs to him.

void SymbolScanner::addDoxygenComments | ( | Symbol * | symbol,
|  | AstNode * | above,
|  | AstNode * | trailing
| ) |  |
| protected

This function sets to given symbol given doxygen comments.

Comments can be placed above declaration or as trailing comments.

Parameters

  [in] | symbol | Symbol where doxygen comments will be added.
  [in] | above | Doxygen comments placed above.
  [in] | trailing | Trailing doxygen comments.

void SymbolScanner::addForwardDeclaration | ( | DataType * | dataType | ) |
| protected

This function registers forward union/structure declarations.

Parameters

  [in] | dataType | Union/structure data type.

void SymbolScanner::addGlobalSymbol | ( | Symbol * | symbol | ) |
| protected

This function add symbol into global symbol scope.

Parameters

  [in] | dataType | Union/structure data type.

void SymbolScanner::checkAnnotationBeforeAdding | ( | AstNode * | annotation,
|  | Symbol * | symbol
| ) |  |
| protected

This function check annotation just before it will be added to symbol.

Parameters

  [in] | annotation | Node containing information about annotation.
  [in] | symbol | Symbol containing vector of annotations belongs to him.

bool SymbolScanner::containsStructEnumDeclaration | ( | const AstNode * | typeNode | ) |
| protected

Returns true when given Astnode is enum or structure declaration.

Parameters

  [in] | typeNode | Node, which data type is searched.

Return values

  true | when AstNode is enum/struct declaration.
  false | when AstNode is not enum/struct declaration.

DataType * SymbolScanner::createArrayType | ( | const AstNode * | typeNode | ) |
| protected

This function returns pointer to new array object.

The function returns pointer to new array object with set array size and nested element type.

Parameters

  [in] | typeNode | Node, which has array token type.

Returns
  Return new array data type.

See also
  DataType * SymbolScanner::createListType(const AstNode * typeNode, const std::string &name)
  DataType * SymbolScanner::lookupDataTypeByName(const Token * tok, const std::string &name)

StructMember * SymbolScanner::createCallbackParam | ( | StructMember * | structMember,
|  | const std::string & | name
| ) |  |
| protected

This function creates new function parameter.

Function parameter information are set based on given structure member, which is param member of function type.

Parameters

  [in] | structMember | Function type param member.
  [in] | name | Param name.

Returns
  new function (callback) parameter.

DataType * SymbolScanner::createListType | ( | const AstNode * | typeNode | ) |
| protected

This function returns pointer to new list object.

The function returns pointer to new list object with set list variable name for list size and nested element type.

Parameters

  [in] | typeNode | Node, which has list token type.

Returns
  Return new list data type.

See also
  DataType * SymbolScanner::createArrayType(const AstNode * typeNode, const std::string &name)
  DataType * SymbolScanner::lookupDataTypeByName(const Token * tok, const std::string &name)

bool SymbolScanner::enumMemberHasValue | ( | AstNode * | enumMember | ) |
| protected

Check to see if enum member is assigned a value by the user.

Parameters

  [in] | enumMember | AST node type enum member.

Return values

  Returns | whether or not the enum member has user-defined value.

Annotation::program_lang_t SymbolScanner::getAnnotationLang | ( | AstNode * | annotationNode | ) |
| protected

Helper function to get programming language type if specified for which is annotation intended.

Parameters

  [in] | annotationNode | AstNode pointing to the annotation

Returns
  Programming language type.

Value * SymbolScanner::getAnnotationValue | ( | AstNode * | annotationNode | ) |
| protected

Helper function to get Value from annotation AstNode.

Parameters

  [in] | annotationNode | AstNode pointing to the annotation

Returns
  Value pointer for annotation

DataType * SymbolScanner::getDataTypeForConst | ( | AstNode * | typeNode | ) |
| protected

This function returns the data type for a constant variable.

Parameters

  [in] | typeNode | Node referring to the data type

Returns
  DataType of the constant variable

uint64_t SymbolScanner::getIntExprValue | ( | const AstNode * | exprNode | ) |
| protected

This function returns token integer value.

The function returns token integer value, when when given AstNode is expression and his child token is equal TOK_INT_LITERAL. Otherwise throw error.

Parameters

  [in] | exprNode | Expression node.

Returns
  Integer value from expression node.

Exceptions

  semantic_error | Thrown if given ast node has not child with token type TOK_INT_LITERAL.

Program* erpcgen::SymbolScanner::getProgram | ( |  | ) |
| inline

Program is out of global symbol scope.

Returns
  Program symbol.

Value * SymbolScanner::getValueForConst | ( | AstNode *const | node,
|  | DataType *const | constDataType
| ) |  |
| protected

Gets the value object for the const variable.

Parameters

  [in] | node | Parent const node
  [in] | constDataType | const variable's data type

Returns
  Literal value assigned to const variable

Value * SymbolScanner::getValueFromSymbol | ( | Token & | tok | ) |
| protected

Get value from symbol table for name defined by given token.

Parameters

  [in] | tok | Token with symbol name defined

Return values

  Value | object for name defined by given token

Exceptions

  syntax_error | Thrown, when token value is null or when symbol is not defined in global symbol scope.
  semantic_error | Thrown, when symbol type is not constant or enum member.

AstNode * SymbolScanner::handleBinaryOp | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle binary operator.

This function handle binary operator for integer and float value.

Parameters

  [in] | node | AST node.

Returns
  New AstNode with binary result.

Return values

  nullptr | Return null pointer, when left or right token value of given AstNode can't be cast to IntegerValue or FloatValue.

Exceptions

  internal_error | Thrown if is used unknown binary operator for integer or float value.
  semantic_error | Thrown if is used invalid binary operators on float value.

See also
  AstNode * SymbolScanner::handleExpr()
  AstNode * SymbolScanner::handleUnaryOp()

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleConst | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function handles a constant definition.

Parameters

  [in] | node | AST node const type definition).

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleEnum | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

This function end handle enum.

The function set enum variable m_currentEnum to null.

Parameters

  [in] | node | AST node type enum.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleEnum | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle enum.

The function set enum variable m_currentEnum to null.

Parameters

  [in] | node | AST node type enum.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleEnumMember | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle enum member.

The function set to enum member variable m_currentEnumMember to null.

Parameters

  [in] | node | AST node type enum member.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleExpr | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function start handle expression.

Parameters

  [in] | node | AST node type expression.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleFunction | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

This function start handle function.

The function add function to interface functions vector. Also initialize function parameters vector. For function is also set name and return type.

Parameters

  [in] | node | AST node type function.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleFunction | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle function.

The function set function parameters vector variable to null.

Parameters

  [in] | node | AST node type function.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleInterface | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

This function start handle interface.

The function add interface to symbol m_globals variable. Also initialize interface functions vector. For interface is also set name.

Parameters

  [in] | node | AST node type interface.

Return values

  nullptr | Always return null pointer.

Exceptions

  Throw | semantic error, when struct member data type name is same as struct name (nested structs).

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleInterface | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle interface.

The function set interface functions vector variable to null.

Parameters

  [in] | node | AST node type interface.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleParam | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

This function start handle function parameter.

The function add function parameter to function parameters vector. The function also set name and data type to parameter.

Parameters

  [in] | node | AST node type parameter.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Exceptions

  semantic_error | Thrown if given ast node has not child with token type TOK_IN, TOK_OUT, TOK_INOUT.

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleParam | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle function parameter.

Parameters

  [in] | node | AST node type parameter.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Exceptions

  semantic_error | Thrown if given ast node has not child with token type TOK_IN, TOK_OUT, TOK_INOUT.

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleProgram | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

This function start handle program.

Parameters

  [in] | node | AST node program (type definition).

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleProgram | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function start handle program.

Parameters

  [in] | node | AST node program (type definition).

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

void SymbolScanner::handleRoot | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function is called at the end of scanning.

Parameters

  [in] | node | Root node.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleStruct | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

This function start handle struct.

The function add struct to symbol scope variable m_globals. For struct is also set name and this struct is set to struct variable m_currentStruct.

Parameters

  [in] | node | AST node type struct.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Exceptions

  semantic_error | Thrown if an given node has not children and is not alias (type definition).

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleStruct | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle struct.

The function set struct variable m_currentStruct to null.

Parameters

  [in] | node | AST node type struct.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleStructMember | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle struct member.

The function add struct member to struct m_currentStruct variable. For struct member is also set name and data type.

Parameters

  [in] | node | AST node type struct member.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleType | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

This function start handle type.

The function set alias (type definition) to symbol scope variable m_globals. Also set name and data type to alias. Bool variable m_isInTypedef is set to true.

Parameters

  [in] | node | AST node type alias (type definition).

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleType | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle type.

The function set bool variable m_isInTypedef to false.

Parameters

  [in] | node | AST node type alias (type definition).

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleUnaryOp | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle unary operator.

This function handle unary operator for integer and float value.

Parameters

  [in] | node | AST node.

Returns
  New AstNode with integer or float result.

Return values

  nullptr | Return null pointer, when value of AstNode token can't be cast to FloatValue or IntegerValue.

Exceptions

  internal_error | Thrown if is used unknown unary operator for integer or float value.
  semantic_error | Thrown if is used unary operator '~' on float value.

See also
  AstNode * SymbolScanner::handleExpr()
  AstNode * SymbolScanner::handleBinaryOp()

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleUnion | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

Handles Union data type while traversing down the AST.

The function sets the variable m_currentUnion.

Parameters

  [in] | node | AST node type struct.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleUnion | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

Handles Union data type while traversing down the AST.

The function add m_currentUnion to m_currentStruct.

Parameters

  [in] | node | AST node type struct.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleUnionCase | ( | AstNode * | node,
|  | top_down |
| ) |  |
| protected virtual

Parameters

  [in] | node | AST node type struct member.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

AstNode * SymbolScanner::handleUnionCase | ( | AstNode * | node,
|  | bottom_up |
| ) |  |
| protected virtual

This function end handle struct member.

The function add union cases to union m_currentUnion variable.

Parameters

  [in] | node | AST node type struct member.

Return values

  nullptr | Always return null pointer.

See also
  rest of AstNode handle functions

Reimplemented from erpcgen::AstWalker.

DataType * SymbolScanner::lookupDataType | ( | const AstNode * | typeNode | ) |
| protected

This function returns pointer to new type object.

The function returns pointer to new data type object (array, list, alias, ...). Created data type depends on given node token.

Parameters

  [in] | typeNode | Node, which data type is searched.

Returns
  Return new data type.

See also
  DataType * SymbolScanner::createListType(const AstNode * typeNode, const std::string &name)
  DataType * SymbolScanner::createArrayType(const AstNode * typeNode, const std::string &name)
  DataType * SymbolScanner::lookupDataTypeByName(const Token * tok, const std::string &name)

Exceptions

  internal_error | Thrown if given ast node has not token type: TOK_IDENT, TOK_LIST, TOK_ARRAY.

DataType * SymbolScanner::lookupDataTypeByName | ( | const Token & | tok,
|  | SymbolScope * | scope,
|  | bool | recursive = `true`
| ) |  |
| protected

This function returns pointer to new type object.

The function returns pointer to new type object, which can be simple data type or alias.

Parameters

  [in] | tok | Token with data type name.
  [in] | scope | Scope determines searching area.
  [in] | recursive | Recursive searching given scope.

Returns
  Return data type, which is not array or list.

See also
  DataType * SymbolScanner::createListType(const AstNode * typeNode, const std::string &name)
  DataType * SymbolScanner::createArrayType(const AstNode * typeNode, const std::string &name)

Exceptions

  semantic_error | Thrown if given token has not name located in symbol scope variable m_globals.
  semantic_error | Thrown if given token can not be transformed to data type.

void SymbolScanner::removeForwardDeclaration | ( | DataType * | dataType | ) |
| protected

This function unregister union/structure declarations.

Parameters

  [in] | dataType | Union/structure data type.

bool SymbolScanner::rhsIsAnExpression | ( | AstNode * | rhs | ) |
| protected

Determines if the right hand side of a constant declaration is an expression.

Parameters

  [in] | rhs | Node referring to the rhs expression.

Return values

  True | when given ast node is expression, else false.

bool SymbolScanner::rhsIsAStringLiteral | ( | AstNode * | rhs | ) |
| protected

Determines if the right hand side of a constant declaration is a string literal.

Parameters

  [in] | rhs | Node referring to the rhs expression.

Return values

  True | when given ast node is string literal, else false.

void SymbolScanner::scanStructForAnnotations | ( |  | ) |
| protected

Controlling annotations used on structure members.

Struct members are examined for and annotations, and the length member is denoted. This function is also used on function parameters, since they are represented as structs.

void SymbolScanner::setParameterDirection | ( | StructMember * | param,
|  | AstNode * | directionNode
| ) |  |
| protected

set parameter direction: in, out, inout

Parameters

  [in] | param | Current parameter
  [in] | directionNode | Direction node in AST

## Member Data Documentation

AliasType* erpcgen::SymbolScanner::m_currentAlias
| protected

Contains pointer to alias when alias is handled.

EnumType* erpcgen::SymbolScanner::m_currentEnum
| protected

Contains pointer to enumeration when enumeration is handled.

Interface* erpcgen::SymbolScanner::m_currentInterface
| protected

Contains pointer to interface when interface is handled.

Program* erpcgen::SymbolScanner::m_currentProgram
| protected

Contains pointer to program when program was set in parsed file.

StructType* erpcgen::SymbolScanner::m_currentStruct
| protected

Contains pointer to structure when structure is handled.

UnionType* erpcgen::SymbolScanner::m_currentUnion
| protected

Contains pointer to union when union is handled.

std::vector<UnionCase *> erpcgen::SymbolScanner::m_emptyUnionCases
| protected

Vector of union cases.

std::map<std::string, DataType *> erpcgen::SymbolScanner::m_forwardDeclarations
| protected

To keep forward declarations.

SymbolScope* erpcgen::SymbolScanner::m_globals
| protected

SymbolScope contains information about generating data types, functions, and interfaces.

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

- SymbolScanner.h
- SymbolScanner.cpp