mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
LibCpp: Use east const style in Lexer and SyntaxHighlighter
This commit is contained in:
parent
282a623853
commit
d57d7bea1c
Notes:
sideshowbarker
2024-07-18 16:52:48 +09:00
Author: https://github.com/MaxWipfli Commit: https://github.com/SerenityOS/serenity/commit/d57d7bea1c6 Pull-request: https://github.com/SerenityOS/serenity/pull/7768 Issue: https://github.com/SerenityOS/serenity/issues/7349 Reviewed-by: https://github.com/alimpfard
|
@ -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()) {
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Cpp {
|
|||
|
||||
class Lexer {
|
||||
public:
|
||||
Lexer(const StringView&);
|
||||
Lexer(StringView const&);
|
||||
|
||||
Vector<Token> lex();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue