mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
AK: Remove ByteString from GenericLexer
A bunch of users used consume_specific with a constant ByteString
literal, which can be replaced by an allocation-free StringView literal.
The generic consume_while overload gains a requires clause so that
consume_specific("abc") causes a more understandable and actionable
error.
This commit is contained in:
committed by
Andrew Kaster
parent
7c88ab2836
commit
eada4f2ee8
@@ -125,10 +125,10 @@ StringView FormatParser::consume_literal()
|
||||
auto const begin = tell();
|
||||
|
||||
while (!is_eof()) {
|
||||
if (consume_specific("{{"))
|
||||
if (consume_specific("{{"sv))
|
||||
continue;
|
||||
|
||||
if (consume_specific("}}"))
|
||||
if (consume_specific("}}"sv))
|
||||
continue;
|
||||
|
||||
if (next_is(is_any_of("{}"sv)))
|
||||
@@ -858,7 +858,7 @@ void StandardFormatter::parse(TypeErasedFormatParams& params, FormatParser& pars
|
||||
m_mode = Mode::Hexfloat;
|
||||
else if (parser.consume_specific('A'))
|
||||
m_mode = Mode::HexfloatUppercase;
|
||||
else if (parser.consume_specific("hex-dump"))
|
||||
else if (parser.consume_specific("hex-dump"sv))
|
||||
m_mode = Mode::HexDump;
|
||||
|
||||
if (!parser.is_eof())
|
||||
|
||||
Reference in New Issue
Block a user