![]() |
HAL
|
Token refers to a token identifier and accompanied data. More...
#include <parser.h>
Public Member Functions | |
Token (TokenType _type, std::tuple< std::string, u16 > variable, std::vector< BooleanFunction::Value > constant) | |
Construct a new initialized Token. More... | |
unsigned | precedence (const ParserType &type) const |
bool | is (TokenType type) const |
std::string | to_string () const |
Static Public Member Functions | |
static Token | And () |
static Token | Not () |
static Token | NotSuffix () |
static Token | Or () |
static Token | Xor () |
static Token | Variable (std::string name, u16 size) |
static Token | Constant (std::vector< BooleanFunction::Value > value) |
static Token | BracketOpen () |
static Token | BracketClose () |
Public Attributes | |
TokenType | type |
refers to the underlying token type identifier More... | |
std::tuple< std::string, u16 > | variable {} |
optional value and bit-size in case token is a variable More... | |
std::vector< BooleanFunction::Value > | constant {} |
optional value in case token is a constant More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Token &token) |
hal::BooleanFunctionParser::Token::Token | ( | TokenType | _type, |
std::tuple< std::string, u16 > | variable, | ||
std::vector< BooleanFunction::Value > | constant | ||
) |
Construct a new initialized Token.
[in] | _type | - The type of the token. |
[in] | variable | - A variable name and bit-size in case the token type is Variable . |
[in] | constant | - A constant value in case the token type is Constant . |
Definition at line 133 of file parser_types.cpp.
Referenced by And(), BracketClose(), BracketOpen(), Constant(), Not(), NotSuffix(), Or(), Variable(), and Xor().
|
static |
Creates an AND
token.
AND
token. Definition at line 11 of file parser_types.cpp.
References hal::BooleanFunctionParser::And, and Token().
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), and hal::BooleanFunctionParser::parse_with_standard_grammar().
|
static |
Creates an BracketClose
token.
BracketClose
token. Definition at line 51 of file parser_types.cpp.
References hal::BooleanFunctionParser::BracketClose, and Token().
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), and hal::BooleanFunctionParser::parse_with_standard_grammar().
|
static |
Creates an BracketOpen
token.
BracketOpen
token. Definition at line 46 of file parser_types.cpp.
References hal::BooleanFunctionParser::BracketOpen, and Token().
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), and hal::BooleanFunctionParser::parse_with_standard_grammar().
|
static |
Creates an Constant
token.
[in] | value | - The (multi-bit) value of the constant. |
Constant
token. Definition at line 41 of file parser_types.cpp.
References hal::BooleanFunctionParser::Constant, constant, and Token().
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), and hal::BooleanFunctionParser::parse_with_standard_grammar().
bool hal::BooleanFunctionParser::Token::is | ( | TokenType | type | ) | const |
Short-hand implementation to check for a token type.
[in] | type | Token type. |
true
in case instance has the same token type, false
otherwise. Definition at line 85 of file parser_types.cpp.
References type.
|
static |
Creates an NOT
token.
NOT
token. Definition at line 16 of file parser_types.cpp.
References hal::BooleanFunctionParser::Not, and Token().
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), hal::BooleanFunctionParser::parse_with_standard_grammar(), and hal::BooleanFunctionParser::reverse_polish_notation().
|
static |
Creates an NOT_SUFFIX
token.
NOT_SUFFIX
token. Definition at line 21 of file parser_types.cpp.
References hal::BooleanFunctionParser::NotSuffix, and Token().
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar().
|
static |
Creates an OR
token.
OR
token. Definition at line 26 of file parser_types.cpp.
References hal::BooleanFunctionParser::Or, and Token().
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), and hal::BooleanFunctionParser::parse_with_standard_grammar().
unsigned hal::BooleanFunctionParser::Token::precedence | ( | const ParserType & | type | ) | const |
Returns the precedence of a token.
[in] | type | The parser type identifier. |
Definition at line 56 of file parser_types.cpp.
References hal::BooleanFunctionParser::And, hal::BooleanFunctionParser::Liberty, hal::BooleanFunctionParser::Not, hal::BooleanFunctionParser::NotSuffix, hal::BooleanFunctionParser::Or, control::parser, hal::BooleanFunctionParser::Standard, and hal::BooleanFunctionParser::Xor.
std::string hal::BooleanFunctionParser::Token::to_string | ( | ) | const |
Convert the token to its string representation.
Definition at line 126 of file parser_types.cpp.
Creates an Variable
token.
[in] | name | - The name of the variable. |
[in] | size | - The bit-size of the variable. |
Variable
token. Definition at line 36 of file parser_types.cpp.
References name, Token(), and hal::BooleanFunctionParser::Variable.
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), and hal::BooleanFunctionParser::parse_with_standard_grammar().
|
static |
Creates an XOR
token.
XOR
token. Definition at line 31 of file parser_types.cpp.
References Token(), and hal::BooleanFunctionParser::Xor.
Referenced by hal::BooleanFunctionParser::parse_with_liberty_grammar(), and hal::BooleanFunctionParser::parse_with_standard_grammar().
|
friend |
Outputs a token to the given output stream.
[in] | os | - The output stream. |
[in] | token | - The token to be output. |
Definition at line 90 of file parser_types.cpp.
std::vector<BooleanFunction::Value> hal::BooleanFunctionParser::Token::constant {} |
optional value in case token is a constant
Definition at line 72 of file parser.h.
Referenced by Constant().
TokenType hal::BooleanFunctionParser::Token::type |
std::tuple<std::string, u16> hal::BooleanFunctionParser::Token::variable {} |