summaryrefslogtreecommitdiff
path: root/AK/JsonParser.h
AgeCommit message (Collapse)Author
2020-09-08AK: Remove empty destructor from JsonParser.asynts
2020-08-09AK: Add a GenericLexer and extend the JsonParser with it (#2696)Benoît Lormeau
2020-06-13AK: JsonParser improvementsMatthew Olsson
- Parsing invalid JSON no longer asserts Instead of asserting when coming across malformed JSON, JsonParser::parse now returns an Optional<JsonValue>. - Disallow trailing commas in JSON objects and arrays - No longer parse 'undefined', as that is a purely JS thing - No longer allow non-whitespace after anything consumed by the initial parse() call. Examples of things that were valid and no longer are: - undefineddfz - {"foo": 1}abcd - [1,2,3]4 - JsonObject.for_each_member now iterates in original insertion order
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
Using int was a mistake. This patch changes String, StringImpl, StringView and StringBuilder to use size_t instead of int for lengths. Obviously a lot of code needs to change as a result of this.
2019-08-04JsonParser: Fold extract_while() into parse_number()Andreas Kling
It wasn't unsed anywhere else anyway, and this is actually ~1% faster on the load_4chan_catalog benchmark.
2019-08-04JsonParser: Cache the last seen string starting with each possible charAndreas Kling
Keep a 256-entry string cache during parse to avoid creating some new strings when possible. This cache is far from perfect but very cheap. Since none of the strings are transient, this only costs us a couple of pointers and a bit of ref-count manipulation. The cache hit rate on 4chan_catalog.json is ~33% and the speedup on the load_4chan_catalog benchmark is ~7%.
2019-08-04JsonParser: Some minor optimizationsAndreas Kling
- 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.
2019-06-24AK: Let's put the JSON parsing in a separate class.Andreas Kling