1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:38:13 +00:00

LibSyntax+LibGUI+LibJS: Move JS syntax highlighter to LibJS

This is a little bit messy but the basic idea is:

Syntax::Highlighter now has a Syntax::HighlighterClient to talk to the
outside world. It mostly communicates in LibGUI primitives that are
available in headers, so inlineable.

GUI::TextEditor inherits from Syntax::HighlighterClient.

This let us to move GUI::JSSyntaxHighlighter to JS::SyntaxHighlighter
and remove LibGUI's dependency on LibJS.
This commit is contained in:
Andreas Kling 2021-02-07 16:56:02 +01:00
parent 22baa5e64f
commit ddbf20ecf6
23 changed files with 139 additions and 80 deletions

View file

@ -30,6 +30,7 @@
#include <AK/WeakPtr.h>
#include <LibGUI/TextDocument.h>
#include <LibGfx/Palette.h>
#include <LibSyntax/HighlighterClient.h>
namespace Syntax {
@ -61,14 +62,15 @@ public:
virtual bool is_identifier(void*) const { return false; };
virtual bool is_navigatable(void*) const { return false; };
void attach(GUI::TextEditor& editor);
void attach(HighlighterClient&);
void detach();
void cursor_did_change();
protected:
Highlighter() { }
WeakPtr<GUI::TextEditor> m_editor;
// FIXME: This should be WeakPtr somehow
HighlighterClient* m_client { nullptr };
struct MatchingTokenPair {
void* open;