Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
SystemVerilogExpressionParser Class Reference

Parser for SystemVerilog expressions. More...

#include <SystemVerilogExpressionParser.h>

Inheritance diagram for SystemVerilogExpressionParser:
ExpressionParser IPXactSystemVerilogParser ModeConditionParser

Public Member Functions

 SystemVerilogExpressionParser ()=default
 The constructor.
 
 SystemVerilogExpressionParser (SystemVerilogExpressionParser const &rhs)=delete
 
 ~SystemVerilogExpressionParser () override=default
 The destructor.
 
int baseForExpression (QStringView expression) const override
 
virtual bool isArrayExpression (QStringView expression) const noexcept
 
bool isPlainValue (QStringView expression) const override
 
SystemVerilogExpressionParseroperator= (SystemVerilogExpressionParser const &rhs)=delete
 
QString parseExpression (QStringView expression, bool *validExpression=nullptr) const override
 
- Public Member Functions inherited from ExpressionParser
virtual ~ExpressionParser ()=default
 The destructor.
 

Protected Member Functions

virtual QString findSymbolValue (QStringView symbol) const
 
virtual int getBaseForSymbol (QStringView symbol) const
 
virtual bool isSymbol (QStringView expression) const
 
virtual bool isUnaryOperator (QStringView token) const
 
QString parseConstant (QStringView token) const
 
virtual QString solveUnary (QStringView operation, QString const &term) const
 

Static Protected Member Functions

static unsigned int operatorPrecedence (QStringView oper)
 

Detailed Description

Parser for SystemVerilog expressions.

Definition at line 25 of file SystemVerilogExpressionParser.h.

Constructor & Destructor Documentation

◆ SystemVerilogExpressionParser() [1/2]

SystemVerilogExpressionParser::SystemVerilogExpressionParser ( )
default

The constructor.

◆ ~SystemVerilogExpressionParser()

SystemVerilogExpressionParser::~SystemVerilogExpressionParser ( )
overridedefault

The destructor.

◆ SystemVerilogExpressionParser() [2/2]

SystemVerilogExpressionParser::SystemVerilogExpressionParser ( SystemVerilogExpressionParser const & rhs)
delete

Member Function Documentation

◆ baseForExpression()

int SystemVerilogExpressionParser::baseForExpression ( QStringView expression) const
overridevirtual

Finds the common base in the expression.

Parameters
[in]expressionThe expression to search in.
Returns
The common base for the expression.

Implements ExpressionParser.

◆ findSymbolValue()

virtual QString SystemVerilogExpressionParser::findSymbolValue ( QStringView symbol) const
protectedvirtual

Finds the value for given symbol.

Parameters
[in]symbolThe symbol whose value to find.
Returns
The found symbol value.

Reimplemented in IPXactSystemVerilogParser, and ModeConditionParser.

◆ getBaseForSymbol()

virtual int SystemVerilogExpressionParser::getBaseForSymbol ( QStringView symbol) const
protectedvirtual

Finds the base in the symbol.

Parameters
[in]symbolThe symbol whose base to find.
Returns
The base for the symbol.

Reimplemented in IPXactSystemVerilogParser.

◆ isArrayExpression()

virtual bool SystemVerilogExpressionParser::isArrayExpression ( QStringView expression) const
virtualnoexcept

Check if the given expression is an array.

Parameters
[in]expressionThe expression to check.
Returns
True, if the expression is an array, otherwise false.

◆ isPlainValue()

bool SystemVerilogExpressionParser::isPlainValue ( QStringView expression) const
overridevirtual

Checks if the given expression is a plain value and does not need evaluation.

Parameters
[in]expressionThe expression to check.
Returns
True, if the expression is a plain value, otherwise false.

Implements ExpressionParser.

◆ isSymbol()

virtual bool SystemVerilogExpressionParser::isSymbol ( QStringView expression) const
protectedvirtual

Checks if the given expression is a symbol e.g. reference.

Parameters
[in]expressionThe expression to check.
Returns
True, if the expression is a symbol, otherwise false.

Reimplemented in IPXactSystemVerilogParser, and ModeConditionParser.

◆ isUnaryOperator()

virtual bool SystemVerilogExpressionParser::isUnaryOperator ( QStringView token) const
protectedvirtual

Checks if the given token is a unary operator.

Parameters
[in]expressionThe token to check.
Returns
True, if the token is a unary operator, otherwise false.

Reimplemented in ModeConditionParser.

◆ operator=()

SystemVerilogExpressionParser & SystemVerilogExpressionParser::operator= ( SystemVerilogExpressionParser const & rhs)
delete

◆ operatorPrecedence()

static unsigned int SystemVerilogExpressionParser::operatorPrecedence ( QStringView oper)
staticprotected

Get the operator precedence value for the given operator.

Parameters
[in]operThe operator whose precedence to get.
Returns
The precedence value where bigger value has higher precedence.

◆ parseConstant()

QString SystemVerilogExpressionParser::parseConstant ( QStringView token) const
protected

Parses a token to a decimal number or string.

Parameters
[in]tokenThe constant to parse.
Returns
The decimal value of the constant or the given string.

◆ parseExpression()

QString SystemVerilogExpressionParser::parseExpression ( QStringView expression,
bool * validExpression = nullptr ) const
overridevirtual

Parses an expression to decimal number.

Parameters
[in]expressionThe expression to parse.
[out]validExpressionSet to true, if the parsing was successful, otherwise false.
Returns
The decimal value of the evaluated expression.

Implements ExpressionParser.

◆ solveUnary()

virtual QString SystemVerilogExpressionParser::solveUnary ( QStringView operation,
QString const & term ) const
protectedvirtual

Solves a binary operation.

Parameters
[in]operationThe operation to solve.
[in]termThe term for the operation.
Returns
The result of the operation.

Reimplemented in ModeConditionParser.


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