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

LanguageServers/Cpp: Support jumping to declaration of preprocessor

.. definitions.
This commit is contained in:
Itamar 2021-03-13 10:37:23 +02:00 committed by Andreas Kling
parent 7bf6eca9d8
commit 8688259ed9
8 changed files with 43 additions and 10 deletions

View file

@ -54,6 +54,7 @@ Parser::Parser(const StringView& program, const String& filename, Preprocessor::
}
#endif
}
void Parser::initialize_program_tokens(const StringView& program)
{
Lexer lexer(program);
@ -63,6 +64,7 @@ void Parser::initialize_program_tokens(const StringView& program)
if (token.type() == Token::Type::Identifier) {
if (auto defined_value = m_definitions.find(text_of_token(token)); defined_value != m_definitions.end()) {
add_tokens_for_preprocessor(token, defined_value->value);
m_replaced_preprocessor_tokens.append({ token, defined_value->value });
continue;
}
}