Represents a single token in a parsed expression. More...
#include <elamexpression.h>
Public Types | |
| enum | Type { Invalid = 0, Function = 1, Constant = 2, Variable = 4, Name = 0xff, NameMask = Name, UnaryOp = 0x100, BinaryOp = 0x200, AssignmentOp = 0x400, Operator = 0xff00, OperatorMask = Operator, SpecialCharMask = 0xff0000, ParenthesesMask = 0xf0000, Parentheses = 0x10000, ParOpen = 0x20000, ParClose = 0x40000, Comma = 0x100000, Literal = 0x1000000, LiteralMask = Literal, FunctionalMask = NameMask|OperatorMask|SpecialCharMask, Whitespace = 0x10000000, IgnoredTokenMask = 0xf0000000 } |
The type of token. More... | |
Public Member Functions | |
| Token (Position pos=Position(-1,-1)) | |
| creates an empty/invalid token | |
| Token (QString, Type, Position pos=Position(-1,-1)) | |
| creates a token from a parsed piece of string, only generic types can be used | |
| Token (QString, QVariant, Position pos=Position(-1,-1)) | |
| creates a literal token | |
| QString | content () const |
| returns the string content of the token | |
| Type | type () const |
| returns the type of token this is | |
| QVariant | literalValue () const |
| for literals: returns the value | |
| Position | position () const |
| returns the original position of the token | |
| QList< Token > | subTokens () const |
| when the token is hierarchised (Parentheses, Function) this returns the subordinate tokens | |
| bool | isFunctional () const |
| true if the token is functional (not ignored) | |
| bool | isOperator () const |
| true if the token represents an operator | |
| bool | isIgnored () const |
| true if the token can be ignored | |
| bool | isName () const |
| true if the token represents a name | |
| bool | isLiteral () const |
| true if the token is a literal | |
Protected Member Functions | |
| void | setSubType (Type) |
| makes the tokens type more specialized | |
| void | addSubToken (const Token &) |
| adds a token to the sub-token list | |
| void | setSubTokens (const QList< Token > &) |
| overrides the list of sub-tokens | |
Friends | |
| class | Expression |
Represents a single token in a parsed expression.
Tokens are pretty stupid themselves - they just know their type, position, their original piece of text and an optional value (literals). They are used by the engine and expressions to transform text into executable expressions.
| enum ELAM::Token::Type |
The type of token.
creates a token from a parsed piece of string, only generic types can be used
| void ELAM::Token::addSubToken | ( | const Token & | ) | [protected] |
adds a token to the sub-token list
| QString ELAM::Token::content | ( | ) | const |
returns the string content of the token
| bool ELAM::Token::isFunctional | ( | ) | const [inline] |
true if the token is functional (not ignored)
| bool ELAM::Token::isIgnored | ( | ) | const [inline] |
true if the token can be ignored
| bool ELAM::Token::isLiteral | ( | ) | const [inline] |
true if the token is a literal
| bool ELAM::Token::isName | ( | ) | const [inline] |
true if the token represents a name
| bool ELAM::Token::isOperator | ( | ) | const [inline] |
true if the token represents an operator
| QVariant ELAM::Token::literalValue | ( | ) | const |
for literals: returns the value
| Position ELAM::Token::position | ( | ) | const |
returns the original position of the token
| void ELAM::Token::setSubTokens | ( | const QList< Token > & | ) | [protected] |
overrides the list of sub-tokens
| void ELAM::Token::setSubType | ( | Type | ) | [protected] |
makes the tokens type more specialized
| QList<Token> ELAM::Token::subTokens | ( | ) | const |
when the token is hierarchised (Parentheses, Function) this returns the subordinate tokens
| Type ELAM::Token::type | ( | ) | const |
returns the type of token this is
friend class Expression [friend] |
1.7.1