mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
LibCpp: Access Cpp::Token members via getter functions
This commit is contained in:
parent
d0b4f9cc0e
commit
5cd1c69b96
5 changed files with 56 additions and 53 deletions
|
@ -114,6 +114,13 @@ struct Token {
|
|||
#undef __TOKEN
|
||||
};
|
||||
|
||||
Token(Type type, const Position& start, const Position& end)
|
||||
: m_type(type)
|
||||
, m_start(start)
|
||||
, m_end(end)
|
||||
{
|
||||
}
|
||||
|
||||
static const char* type_to_string(Type t)
|
||||
{
|
||||
switch (t) {
|
||||
|
@ -130,10 +137,14 @@ struct Token {
|
|||
{
|
||||
return type_to_string(m_type);
|
||||
}
|
||||
Position start() const { return m_start; }
|
||||
Position end() const { return m_end; }
|
||||
const Position& start() const { return m_start; }
|
||||
const Position& end() const { return m_end; }
|
||||
|
||||
void set_start(const Position& other) {m_start = other;}
|
||||
void set_end(const Position& other) {m_end = other;}
|
||||
Type type() const { return m_type; }
|
||||
|
||||
private:
|
||||
Type m_type { Type::Unknown };
|
||||
Position m_start;
|
||||
Position m_end;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue