summaryrefslogtreecommitdiff
path: root/upb/json/parser.c
AgeCommit message (Collapse)Author
2019-01-12A lot more tests are working now.Joshua Haberman
2019-01-09upb_refcounted is gone! Some tests still to fix.Joshua Haberman
2018-12-22Merge branch 'master' into defcleanupJoshua Haberman
2018-12-13Fix generated file testBo Yang
2018-12-12Add support for encoding Any in jsonBo Yang
2018-12-10WIP, core library compiles now.Joshua Haberman
2018-12-04Implement json decoding for Any message. (#130)Paul Yang
* Implement json decoding for Any message. type url may not appear as the first value in json. As a result, other data cannot be resolved before resolving type url. To solve that, this change caches the start and end position of unparsed values and resolve them in end_any_object when type url has been resolved. * Handle Any in switch * Update json parser size * Fix comments * Sync upstream * Add dependency on upb_pb for upb_json * Debug failed test * Fix cmake * Update test generated files * Remove debug tests
2018-11-03Bazel builds everything except conformance_upb.Josh Haberman
2018-10-05Fix json ignore unknown (#128)Paul Yang
* Fix json ignore unknown Previously, there were several problems with ignoring unknown in json. 1) After finding a field is unknown, the parser's state is not changed. Thus, there is no way to distinguish whether the parser is dealing with an unknown field or it's just a top level message. 2) Several method didn't respect unknown field, e.g., start_object, end_bool, start_array. * Update json parser size * Update json parser size
2018-09-21Fix mac use local timezone for strptime by default. (#127)Paul Yang
* Fix mac use local timezone for strptime by default. * Fix comments * Check len == UPB_TIMESTAMP_BASE_SIZE * Fix comment
2018-09-18Fix json encoding for wrappers, ListValue, Struct and Value. (#126)Paul Yang
* Fix json encoding for wrappers, ListValue, Struct and Value. * Add well_known_type field in upb_msgdef to specify type of well known messages. * Remove comma at end of enum definition. * Group number wrappers * Fix comments * Refactoring to use is_wellknown_{msg/field}
2018-09-06Initialize valueBo Yang
2018-09-06Fix json parsing for Struct, ListValue and Value.Bo Yang
2018-08-29Fix json encoding/decoding for duration. (#118)Paul Yang
* Fix json encoding/decoding for duration. * Use lld for int64_t * Cast int64_t to long
2018-08-24Fix json parsing for timestamp (#115)Paul Yang
* Fix json parsing for timestamp * Fix json encoding for timestamp * Implement timestamp_machine to parse timestamp * Remove comparision for size_t and 0 * Increase defined printer size * Increase size * Increase parser size * Mark json_en_timestamp_machine unused
2018-08-09Use special eof char to mark end of parsingBo Yang
2018-08-09Move logic away from ragel machineBo Yang
2018-08-05Remove unused codeBo Yang
2018-08-05Make value top levelBo Yang
2018-08-01Mark unused variableBo Yang
2018-07-31Update ragel generated fileBo Yang
2018-06-27Enable ignore unknown field in json parsingBo Yang
2017-06-19Responded to PR comments. This also fixed a few more conformance tests.Josh Haberman
2017-06-08Some fixes to make JSON properly recognize numbers in quotes.Josh Haberman
2016-09-01Updated generated code.Josh Haberman
2016-05-12Added UPB_ASSERT() that helps avoid unused var warnings.Joshua Haberman
* Added UPB_ASSERT() that helps avoid unused var warnings. * Addressed PR comments. * Fixed assert in the JIT.
2016-04-19Split upb::Arena/upb::Allocator from upb::Environment. (#58)Joshua Haberman
* Split upb::Arena/upb::Allocator from upb::Environment. This will allow arenas and allocators to be used independently of environments, which will be important for an upcoming change (a message representation). Overall this design feels cleaner that the previous Environment/SeededAllocator design. As part of this change, moved all allocations in upb to use a global allocator instead of hard-coding malloc/free. This will allow injecting OOM faults for more robust testing. One place that doesn't use the global allocator is the tracked ref code. Instead of its previous approach of CHECK_OOM() after every malloc() or table insert, it simply uses an allocator that does this automatically. I moved Allocator/Arena/Environment into upb.h. This seems principled since these are the only types in upb whose size is directly exposed to users, since they form the basis of memory allocation strategy. * Cleaned up some header includes and fixed more malloc -> upb_gmalloc(). * Changes from PR review. * Don't use UINTPTR_MAX or UINT64_MAX. * Punt on adding line/file for now. * We actually can't store (uint64_t)-1, update comment and test.
2016-04-15Also regenerate JSON parser.Josh Haberman
2016-04-14JSON parser: always accept both name variants, flag controls which we generate.Joshua Haberman
* JSON parser: always accept both name variants, flag controls which we generate. My previous commit was based on wrong information about the proto3 JSON spec. It turns out we need to accept both field name formats all the time, and a runtime flag should control which we generate. * Documented the preserve_proto_fieldnames option. * Fix bugs in PR.
2016-04-14Added migration flag for users using old JSON format.Josh Haberman
2016-02-17Addressed code review comments.Josh Haberman
2016-02-17Changed JSON parser/printer to correctly camelCase names.Josh Haberman
2015-07-15Clear JSON parser status in reset.Josh Haberman
2015-07-15Updated JSON parser size.Josh Haberman
2015-07-15Fixed JSON parser error reporting.Josh Haberman
This was previously broken -- it would try to set the status object on the parser, but the pointer was never initialized. Also it didn't report errors properly to the environment object.
2015-07-07Updated license headers for Ragel source also.Josh Haberman
2015-06-02Ported upb to C89, for greater portability.Josh Haberman
A large part of this change contains surface-level porting, like moving variable declarations to the top of the block. However there are a few more substantial things too: - moved internal-only struct definitions to a separate file (structdefs.int.h), for greater encapsulation and ABI compatibility. - removed the UPB_UPCAST macro, since it requires access to the internal-only struct definitions. Replaced uses with calls to inline, type-safe casting functions. - removed the UPB_DEFINE_CLASS/UPB_DEFINE_STRUCT macros. Class and struct definitions are now more explicit -- you get to see the actual class/struct keywords in the source. The casting convenience functions have been moved into UPB_DECLARE_DERIVED_TYPE() and UPB_DECLARE_DERIVED_TYPE2(). - the new way that we duplicate base methods in derived types is also more convenient and requires less duplication. It is also less greppable, but hopefully that is not too big a problem. Compiler flags (-std=c89 -pedantic) should help to rigorously enforce that the code is free of C99-isms. A few functions are not available in C89 (strtoll). There are temporary, hacky solutions in place.
2015-05-08Merge from open-source development.Josh Haberman
2015-05-08Google-internal development.Josh Haberman
2015-05-06Resolve compilation errors if compiled with more stringent semantic checks.Martin Maly
Adding Travis test to build with strict warnings. Fixing a warning in a test which used signed/unsigned integer comparison.
2015-02-02Fixed JSON parser issue: missing NUL byte in parse_number() in some codeChris Fallin
paths. Also, fix unused-function warnings.
2015-01-08Fix for JSON parser: don't overrun buffer parsing ints.Josh Haberman
2015-01-07Changes from Google-internal development.Josh Haberman
* JSON parser expanded to handle split buffers. * bugfix to the protobuf decoder.
2014-12-12Amalgamated distribution (upb.c/upb.h) tool.Chris Fallin
There are a number of tweaks to get this to work: - The #include dependence graph wasn't quite complete, and I had to add a few #includes to get the tool to work. - I had to change a number of symbol names to avoid conflicts between 'static' definitions in different .c files. This could be avoided if the tool were smart enough to rename static symbols to have unique prefixes instead, but (i) this requires semantic understanding of C, and (ii) the macro-defined static functions (e.g., handlers for primitive types in several places) would probably trip this up. Verified that the resulting upb.h/upb.c compiles and doesn't have any unresolved references.
2014-12-09JSON test, symbolic enum names in JSON, and a few improvements.Chris Fallin
- Added a JSON test that round-trips (parses then re-serializes) several test messages, ensuring that the re-serialized form matches the original exactly. - Added support for printing and parsing symbolic enum names (rather than integer values) in JSON. - Updated JSON printer to properly handle string fields that come in multiple pieces. ('bytes' fields still do not support this, and this work is more challenging because it requires making the base64 encoder resumable. Base64 encoding is not separable at an input-byte granularity, unlike string escaping.) - Fixed a < vs. <= bug in UTF-8 encoding generation (oops).
2014-12-05Sync update: haberman@'s internal changes.Chris Fallin
2014-12-05Update JSON parser to emit UTF8 to string fields appropriately.Chris Fallin
2014-12-03Sync from Google-internal development.Josh Haberman
Most notably, a JSON parser is now provided.
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback