1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:07:36 +00:00

LibWeb: Record position information in CSS Tokens

This is a requirement to be able to use the Tokens for syntax
highlighting.
This commit is contained in:
Sam Atkins 2021-10-21 21:25:14 +01:00 committed by Andreas Kling
parent 9a2eecaca4
commit ecf5368535
3 changed files with 30 additions and 2 deletions

View file

@ -56,6 +56,12 @@ public:
Number,
};
struct Position {
size_t line { 0 };
size_t column { 0 };
};
Type type() const { return m_type; }
bool is(Type type) const { return m_type == type; }
StringView ident() const
@ -136,6 +142,9 @@ public:
String to_debug_string() const;
Position const& start_position() const { return m_start_position; }
Position const& end_position() const { return m_end_position; }
private:
Type m_type { Type::Invalid };
@ -143,6 +152,9 @@ private:
StringBuilder m_unit;
HashType m_hash_type { HashType::Unrestricted };
NumberType m_number_type { NumberType::Integer };
Position m_start_position;
Position m_end_position;
};
}