The Psyche Project
|
The SyntaxLexeme class. More...
#include <SyntaxLexeme.h>
Classes | |
struct | BitFields |
Public Types | |
enum | Kind : std::uint16_t { UNSPECIFIED = 0, Identifier, IntegerConstant, FloatingConstant, CharacterConstant, ImaginaryIntegerConstant, ImaginaryFloatingConstant, StringLiteral } |
The SyntaxLexeme::Kind enumeraiton. | |
Public Types inherited from psy::TextElement | |
typedef const char * | iterator |
typedef iterator | const_iterator |
Public Member Functions | |
Kind | kind () const |
std::string | valueText () const |
template<class ValueT > | |
ValueT | value () const |
template<> | |
int | value () const |
template<> | |
long | value () const |
template<> | |
long long | value () const |
template<> | |
unsigned long | value () const |
template<> | |
unsigned long long | value () const |
template<> | |
float | value () const |
template<> | |
double | value () const |
template<> | |
long double | value () const |
template<> | |
unsigned char | value () const |
template<> | |
wchar_t | value () const |
template<> | |
char16_t | value () const |
template<> | |
char32_t | value () const |
virtual Identifier * | asIdentifier () |
virtual IntegerConstant * | asIntegerConstant () |
virtual FloatingConstant * | asFloatingConstant () |
virtual CharacterConstant * | asCharacterConstant () |
virtual ImaginaryIntegerConstant * | asImaginaryIntegerConstant () |
virtual ImaginaryFloatingConstant * | asImaginaryFloatingConstant () |
virtual StringLiteral * | asStringLiteralExpression () |
Public Member Functions inherited from psy::TextElement | |
TextElement (const char *c_str, unsigned int size) | |
TextElement (const TextElement &other)=delete | |
void | operator= (const TextElement &other)=delete |
iterator | begin () const |
iterator | end () const |
char | at (unsigned int idx) const |
const char * | c_str () const |
unsigned int | size () const |
unsigned int | length () const |
Protected Member Functions | |
SyntaxLexeme (const char *chars, unsigned int size, Kind kind) | |
SyntaxLexeme (const SyntaxLexeme &)=delete | |
SyntaxLexeme & | operator= (const SyntaxLexeme &)=delete |
void | checkHexPrefix () |
void | checkVariousPrefixesAndSuffixes () |
Protected Attributes | |
union { | |
std::uint16_t BF_all_ | |
BitFields BF_ | |
}; | |
The SyntaxLexeme class.
|
inlinevirtual |
Cast this
SyntaxLexeme.
Reimplemented in psy::C::CharacterConstant.
|
inlinevirtual |
Cast this
SyntaxLexeme.
Reimplemented in psy::C::FloatingConstant.
|
inlinevirtual |
Cast this
SyntaxLexeme.
Reimplemented in psy::C::Identifier.
|
inlinevirtual |
Cast this
SyntaxLexeme.
Reimplemented in psy::C::ImaginaryFloatingConstant.
|
inlinevirtual |
Cast this
SyntaxLexeme.
Reimplemented in psy::C::ImaginaryIntegerConstant.
|
inlinevirtual |
Cast this
SyntaxLexeme.
Reimplemented in psy::C::IntegerConstant.
|
inlinevirtual |
Cast this
SyntaxLexeme.
Reimplemented in psy::C::StringLiteral.
SyntaxLexeme::Kind SyntaxLexeme::kind | ( | ) | const |
The Kind of this
SyntaxLexeme.
ValueT psy::C::SyntaxLexeme::value | ( | ) | const |
The value of this
SyntaxLexeme. Template parameter ValueT
must be substituted, as an argument, by the C type corresponding to the lexeme in question. Therefore, prior to calling SyntaxLexeme::value, one must check the speficic kind of a lexeme, and any variant it might have. Consider the snippet below, which stores in i
the C value of 42UL
of a given SyntaxLexeme, named lexeme
.
std::string SyntaxLexeme::valueText | ( | ) | const |
The value of this
SyntaxLexeme represented as text, by an std::string
.
this
SyntaxLexeme was obtained.