diff options
author | Max Wipfli <mail@maxwipfli.ch> | 2021-06-03 23:17:34 +0200 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-06-05 00:32:28 +0430 |
commit | d57d7bea1c6af23ce07e98b6eb7bf0e72afeb6ad (patch) | |
tree | f436510f32a774c5d2c5cfc629194ba27ff02875 /Userland/Libraries/LibCpp | |
parent | 282a623853f6dc50ca3d3bc6d6bbd73ca6d3d585 (diff) | |
download | serenity-d57d7bea1c6af23ce07e98b6eb7bf0e72afeb6ad.zip |
LibCpp: Use east const style in Lexer and SyntaxHighlighter
Diffstat (limited to 'Userland/Libraries/LibCpp')
-rw-r--r-- | Userland/Libraries/LibCpp/Lexer.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibCpp/Lexer.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCpp/SyntaxHighlighter.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibCpp/SyntaxHighlighter.h | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Libraries/LibCpp/Lexer.cpp b/Userland/Libraries/LibCpp/Lexer.cpp index b7d0917e9c..5ccb86d00d 100644 --- a/Userland/Libraries/LibCpp/Lexer.cpp +++ b/Userland/Libraries/LibCpp/Lexer.cpp @@ -12,7 +12,7 @@ namespace Cpp { -Lexer::Lexer(const StringView& input) +Lexer::Lexer(StringView const& input) : m_input(input) { } @@ -48,7 +48,7 @@ static bool is_valid_nonfirst_character_of_identifier(char ch) return is_valid_first_character_of_identifier(ch) || isdigit(ch); } -constexpr const char* s_known_keywords[] = { +constexpr char const* s_known_keywords[] = { "alignas", "alignof", "and", @@ -125,7 +125,7 @@ constexpr const char* s_known_keywords[] = { "xor_eq" }; -constexpr const char* s_known_types[] = { +constexpr char const* s_known_types[] = { "ByteBuffer", "CircularDeque", "CircularQueue", @@ -186,7 +186,7 @@ constexpr const char* s_known_types[] = { "wchar_t" }; -static bool is_keyword(const StringView& string) +static bool is_keyword(StringView const& string) { static HashTable<String> keywords(array_size(s_known_keywords)); if (keywords.is_empty()) { @@ -195,7 +195,7 @@ static bool is_keyword(const StringView& string) return keywords.contains(string); } -static bool is_known_type(const StringView& string) +static bool is_known_type(StringView const& string) { static HashTable<String> types(array_size(s_known_types)); if (types.is_empty()) { diff --git a/Userland/Libraries/LibCpp/Lexer.h b/Userland/Libraries/LibCpp/Lexer.h index 59c9637aa0..1f8c1d8a93 100644 --- a/Userland/Libraries/LibCpp/Lexer.h +++ b/Userland/Libraries/LibCpp/Lexer.h @@ -14,7 +14,7 @@ namespace Cpp { class Lexer { public: - Lexer(const StringView&); + Lexer(StringView const&); Vector<Token> lex(); diff --git a/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp b/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp index 4b7d716b51..aae1e81bc6 100644 --- a/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp +++ b/Userland/Libraries/LibCpp/SyntaxHighlighter.cpp @@ -13,7 +13,7 @@ namespace Cpp { -static Syntax::TextStyle style_for_token_type(const Gfx::Palette& palette, Cpp::Token::Type type) +static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, Cpp::Token::Type type) { switch (type) { case Cpp::Token::Type::Keyword: @@ -55,7 +55,7 @@ bool SyntaxHighlighter::is_navigatable(void* token) const return cpp_token == Cpp::Token::Type::IncludePath; } -void SyntaxHighlighter::rehighlight(const Palette& palette) +void SyntaxHighlighter::rehighlight(Palette const& palette) { auto text = m_client->get_text(); Cpp::Lexer lexer(text); diff --git a/Userland/Libraries/LibCpp/SyntaxHighlighter.h b/Userland/Libraries/LibCpp/SyntaxHighlighter.h index 6c73d909ba..0df0bbc59d 100644 --- a/Userland/Libraries/LibCpp/SyntaxHighlighter.h +++ b/Userland/Libraries/LibCpp/SyntaxHighlighter.h @@ -19,7 +19,7 @@ public: virtual bool is_navigatable(void*) const override; virtual Syntax::Language language() const override { return Syntax::Language::Cpp; } - virtual void rehighlight(const Palette&) override; + virtual void rehighlight(Palette const&) override; protected: virtual Vector<MatchingTokenPair> matching_token_pairs() const override; |