1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:57:35 +00:00

JsonParser: Some minor optimizations

- Return more specific types from parse_array() and parse_object().
- Don't create a throwaway String in extract_while().
- Use a StringView in parse_number() to avoid a throwaway String.
This commit is contained in:
Andreas Kling 2019-08-04 11:47:21 +02:00
parent 93596dc00d
commit b62a12c687
2 changed files with 10 additions and 9 deletions

View file

@ -23,8 +23,8 @@ private:
void consume_specific(char expected_ch);
void consume_string(const char*);
String consume_quoted_string();
JsonValue parse_array();
JsonValue parse_object();
JsonArray parse_array();
JsonObject parse_object();
JsonValue parse_number();
JsonValue parse_string();
JsonValue parse_false();
@ -36,7 +36,7 @@ private:
void consume_while(C);
template<typename C>
String extract_while(C);
Vector<char, 128> extract_while(C);
StringView m_input;
int m_index { 0 };