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

LibCpp: Replace defined preprocessor values when parsing

This commit is contained in:
Itamar 2021-03-12 17:04:08 +02:00 committed by Andreas Kling
parent f21af0922a
commit 3658c4c567
8 changed files with 134 additions and 44 deletions

View file

@ -52,11 +52,33 @@ public:
private:
struct DocumentData {
DocumentData(String&& text, const String& filename);
String filename;
String text;
Preprocessor preprocessor;
Parser parser;
const String& filename() const { return m_filename; }
const String& text() const { return m_text; }
const Preprocessor& preprocessor() const
{
VERIFY(m_preprocessor);
return *m_preprocessor;
}
Preprocessor& preprocessor()
{
VERIFY(m_preprocessor);
return *m_preprocessor;
}
const Parser& parser() const
{
VERIFY(m_parser);
return *m_parser;
}
Parser& parser()
{
VERIFY(m_parser);
return *m_parser;
}
String m_filename;
String m_text;
OwnPtr<Preprocessor> m_preprocessor;
OwnPtr<Parser> m_parser;
};
Vector<GUI::AutocompleteProvider::Entry> autocomplete_property(const DocumentData&, const MemberExpression&, const StringView partial_text) const;
@ -85,6 +107,8 @@ private:
void update_declared_symbols(const DocumentData&);
GUI::AutocompleteProvider::DeclarationType type_of_declaration(const Declaration&);
OwnPtr<DocumentData> create_document_data(String&& text, const String& filename);
HashMap<String, OwnPtr<DocumentData>> m_documents;
};