1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:07:45 +00:00

LibWeb: Add a super basic HTML syntax highlighter

This can currently highlight tag names and attribute names/values.
This commit is contained in:
Ali Mohammad Pur 2021-05-20 23:15:33 +04:30 committed by Andreas Kling
parent aa7939bc6c
commit 97a230e4ef
6 changed files with 194 additions and 4 deletions

View file

@ -229,6 +229,11 @@ Optional<u32> HTMLTokenizer::peek_code_point(size_t offset) const
Optional<HTMLToken> HTMLTokenizer::next_token()
{
{
auto last_position = m_source_positions.last();
m_source_positions.clear();
m_source_positions.append(move(last_position));
}
_StartOfFunction:
if (!m_queued_tokens.is_empty())
return m_queued_tokens.dequeue();

View file

@ -110,6 +110,10 @@ public:
Optional<HTMLToken> next_token();
void switch_to(Badge<HTMLDocumentParser>, State new_state);
void switch_to(State new_state)
{
m_state = new_state;
}
void set_blocked(bool b) { m_blocked = b; }
bool is_blocked() const { return m_blocked; }