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

LibCpp: Add library for working with c++ code

Moved the C++ Lexer we have from LibGUI to here, so that other
components could use it without linking with LibGUI.
This commit is contained in:
Itamar 2020-09-28 16:21:25 +03:00 committed by Andreas Kling
parent fec4152220
commit bf53d7ff64
8 changed files with 132 additions and 126 deletions

View file

@ -28,7 +28,7 @@
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibGUI/CppLexer.h>
#include <LibCpp/Lexer.h>
#include <LibGUI/TextPosition.h>
namespace HackStudio {
@ -39,8 +39,8 @@ public:
static Vector<String> get_suggestions(const String& code, GUI::TextPosition autocomplete_position);
private:
static Optional<size_t> token_in_position(const Vector<GUI::CppToken>&, GUI::TextPosition);
static String text_of_token(const Vector<String> lines, const GUI::CppToken&);
static Vector<String> identifier_prefixes(const Vector<String> lines, const Vector<GUI::CppToken>&, size_t target_token_index);
static Optional<size_t> token_in_position(const Vector<Cpp::Token>&, GUI::TextPosition);
static String text_of_token(const Vector<String> lines, const Cpp::Token&);
static Vector<String> identifier_prefixes(const Vector<String> lines, const Vector<Cpp::Token>&, size_t target_token_index);
};
};