LibCpp: Use east const style in Lexer and SyntaxHighlighter

This commit is contained in:
Max Wipfli 2021-06-03 23:17:34 +02:00 committed by Ali Mohammad Pur
parent 282a623853
commit d57d7bea1c
Notes: sideshowbarker 2024-07-18 16:52:48 +09:00
4 changed files with 9 additions and 9 deletions

View file

@ -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()) {

View file

@ -14,7 +14,7 @@ namespace Cpp {
class Lexer {
public:
Lexer(const StringView&);
Lexer(StringView const&);
Vector<Token> lex();

View file

@ -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);

View file

@ -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;