mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibCpp: Add lexer option to ignore whitespace tokens
This commit is contained in:
parent
06e47ce7aa
commit
c7d3a7789c
Notes:
sideshowbarker
2024-07-18 06:59:52 +09:00
Author: https://github.com/itamar8910
Commit: c7d3a7789c
Pull-request: https://github.com/SerenityOS/serenity/pull/9402
2 changed files with 8 additions and 0 deletions
|
@ -222,6 +222,8 @@ Vector<Token> Lexer::lex()
|
|||
token_start_position = m_position;
|
||||
};
|
||||
auto commit_token = [&](auto type) {
|
||||
if (m_options.ignore_whitespace && type == Token::Type::Whitespace)
|
||||
return;
|
||||
tokens.empend(type, token_start_position, m_previous_position, m_input.substring_view(token_start_index, m_index - token_start_index));
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue