diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..fdf9d2b --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include *.txt +include *.md +include Makefile +graft flojay diff --git a/flojay/lloyd-yajl/.gitignore b/flojay/lloyd-yajl/.gitignore index 53f02f8..b0aff9a 100644 --- a/flojay/lloyd-yajl/.gitignore +++ b/flojay/lloyd-yajl/.gitignore @@ -1,2 +1,3 @@ +.DS_Store Makefile /build/ diff --git a/flojay/lloyd-yajl/CMakeLists.txt b/flojay/lloyd-yajl/CMakeLists.txt index 4fa623d..4c0a9be 100644 --- a/flojay/lloyd-yajl/CMakeLists.txt +++ b/flojay/lloyd-yajl/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2007-2011, Lloyd Hilaiel +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -17,8 +17,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(YetAnotherJSONParser C) SET (YAJL_MAJOR 2) -SET (YAJL_MINOR 0) -SET (YAJL_MICRO 1) +SET (YAJL_MINOR 1) +SET (YAJL_MICRO 0) SET (YAJL_DIST_NAME "yajl-${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}") @@ -28,7 +28,7 @@ ENDIF (NOT CMAKE_BUILD_TYPE) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -IF (WIN32) +IF (WIN32) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") ADD_DEFINITIONS(-DWIN32) SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF") @@ -60,7 +60,7 @@ ELSE (WIN32) SET(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g") SET(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2 -Wuninitialized") -ENDIF (WIN32) +ENDIF (WIN32) ADD_SUBDIRECTORY(src) @@ -74,6 +74,8 @@ INCLUDE(YAJLDoc.cmake) # a test target ADD_CUSTOM_TARGET(test - ./run_tests.sh ${CMAKE_CURRENT_BINARY_DIR}/test/yajl_test - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test) + ./run_tests.sh ${CMAKE_CURRENT_BINARY_DIR}/test/parsing/yajl_test + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test/parsing) +ADD_CUSTOM_TARGET(test-api ${CMAKE_CURRENT_SOURCE_DIR}/test/api/run_tests.sh + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/api) diff --git a/flojay/lloyd-yajl/COPYING b/flojay/lloyd-yajl/COPYING index 4f2f896..30be349 100644 --- a/flojay/lloyd-yajl/COPYING +++ b/flojay/lloyd-yajl/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2007-2011, Lloyd Hilaiel +Copyright (c) 2007-2014, Lloyd Hilaiel Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -10,4 +10,4 @@ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/flojay/lloyd-yajl/ChangeLog b/flojay/lloyd-yajl/ChangeLog index 0e228e5..343f894 100644 --- a/flojay/lloyd-yajl/ChangeLog +++ b/flojay/lloyd-yajl/ChangeLog @@ -1,3 +1,35 @@ +2.1.0 + * @nonodename, @patperry - fixed some compiler warnings + * @yep, @emaste - documentation improvements + * @sgravrock - build fix for NetBSD (and whenever sh != bash) + * @rotty, @brimstone3, @lloyd - allow client to reset generator + * @sgravrock - remove bash dependencies + * @lloyd - add api tests + * @rflynn - remove ruby dependency + * @cloderic - nmake install works on windows + * @shahbag - build fix for qnx + * @breese - debugging improvements + * @lloyd - json_verify supports -s flag for stream processing + * @lloyd - json_reformat supports -s flag for stream processing + +2.0.4 + * @jcekstrom - additional checking in integer parsing + * @jcekstrom - fix a bug in yajl_tree that would cause valid json integersto fail to parse + * @plaguemorin - fix a memory leak in yajl_tree (error strings were being leaked) + * @7AC - reset errno + * @ConradIrwin - include flags to reformatter to allow toggling of escape solidus option + +2.0.3 + * John Stamp generation of a pkgconfig file at build time. + * @robzuber bugfix in yajl_tree_get() + * @lloyd - fix for compilation on 64 bit windows + +2.0.2 + * lth fix typos in yajl_tree.h macros YAJL_IS_INTEGER and YAJL_IS_DOUBLE, + contributed by Artem S Vybornov. + * lth add #ifdef __cplusplus wrappers to yajl_tree to allow proper + usage from many populer C++ compilers. + 2.0.1 * lth generator flag to allow client to specify they want escaped solidi '/'. issue #28 diff --git a/flojay/lloyd-yajl/README b/flojay/lloyd-yajl/README index 5e53062..ad61759 100644 --- a/flojay/lloyd-yajl/README +++ b/flojay/lloyd-yajl/README @@ -1,5 +1,5 @@ ********************************************************************** - This is YAJL 2, for the legacy version of YAJL. see + This is YAJL 2. For the legacy version of YAJL see https://github.com/lloyd/yajl/tree/1.x ********************************************************************** @@ -20,7 +20,7 @@ unable to find one that satisfies my requirements. Those are, 7. simple to use 8. tiny -Numbers 3, 5, 6, and 7 where particularly hard to find, and were what +Numbers 3, 5, 6, and 7 were particularly hard to find, and were what caused me to ultimately create YAJL. This document is a tour of some of the more important aspects of YAJL. diff --git a/flojay/lloyd-yajl/configure b/flojay/lloyd-yajl/configure index 66c1497..716e7d1 100755 --- a/flojay/lloyd-yajl/configure +++ b/flojay/lloyd-yajl/configure @@ -1,6 +1,6 @@ -#!/usr/bin/env ruby +#!/bin/sh # -# Copyright (c) 2007-2011, Lloyd Hilaiel +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -14,66 +14,68 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -require 'fileutils' -require 'optparse' +prefix="/usr/local" +if [ "$1" = "--help" ] +then + cat < ./Makefile < +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/example/parse_config.c b/flojay/lloyd-yajl/example/parse_config.c index 0e70192..fca9c0d 100644 --- a/flojay/lloyd-yajl/example/parse_config.c +++ b/flojay/lloyd-yajl/example/parse_config.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/perf/CMakeLists.txt b/flojay/lloyd-yajl/perf/CMakeLists.txt index bfabce4..b438d7a 100644 --- a/flojay/lloyd-yajl/perf/CMakeLists.txt +++ b/flojay/lloyd-yajl/perf/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2007-2011, Lloyd Hilaiel +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/perf/documents.c b/flojay/lloyd-yajl/perf/documents.c index 3f33f87..831245c 100644 --- a/flojay/lloyd-yajl/perf/documents.c +++ b/flojay/lloyd-yajl/perf/documents.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/perf/documents.h b/flojay/lloyd-yajl/perf/documents.h index 1e08f85..dff1aec 100644 --- a/flojay/lloyd-yajl/perf/documents.h +++ b/flojay/lloyd-yajl/perf/documents.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/perf/perftest.c b/flojay/lloyd-yajl/perf/perftest.c index 2d30984..21aaff9 100644 --- a/flojay/lloyd-yajl/perf/perftest.c +++ b/flojay/lloyd-yajl/perf/perftest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/reformatter/CMakeLists.txt b/flojay/lloyd-yajl/reformatter/CMakeLists.txt index da4032b..52a9bee 100644 --- a/flojay/lloyd-yajl/reformatter/CMakeLists.txt +++ b/flojay/lloyd-yajl/reformatter/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2007-2011, Lloyd Hilaiel +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -28,12 +28,16 @@ ADD_EXECUTABLE(json_reformat ${SRCS}) TARGET_LINK_LIBRARIES(json_reformat yajl_s) +# In some environments, we must explicitly link libm (like qnx, +# thanks @shahbag) +IF (NOT WIN32) + TARGET_LINK_LIBRARIES(json_reformat m) +ENDIF (NOT WIN32) + # copy the binary into the output directory GET_TARGET_PROPERTY(binPath json_reformat LOCATION) ADD_CUSTOM_COMMAND(TARGET json_reformat POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir}) -IF (NOT WIN32) - INSTALL(TARGETS json_reformat RUNTIME DESTINATION bin) -ENDIF () +INSTALL(TARGETS json_reformat RUNTIME DESTINATION bin) diff --git a/flojay/lloyd-yajl/reformatter/json_reformat.c b/flojay/lloyd-yajl/reformatter/json_reformat.c index c5b88f0..2ed4f39 100644 --- a/flojay/lloyd-yajl/reformatter/json_reformat.c +++ b/flojay/lloyd-yajl/reformatter/json_reformat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -21,61 +21,73 @@ #include #include +/* non-zero when we're reformatting a stream */ +static int s_streamReformat = 0; + +#define GEN_AND_RETURN(func) \ + { \ + yajl_gen_status __stat = func; \ + if (__stat == yajl_gen_generation_complete && s_streamReformat) { \ + yajl_gen_reset(g, "\n"); \ + __stat = func; \ + } \ + return __stat == yajl_gen_status_ok; } + static int reformat_null(void * ctx) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_null(g); + GEN_AND_RETURN(yajl_gen_null(g)); } static int reformat_boolean(void * ctx, int boolean) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_bool(g, boolean); + GEN_AND_RETURN(yajl_gen_bool(g, boolean)); } static int reformat_number(void * ctx, const char * s, size_t l) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_number(g, s, l); + GEN_AND_RETURN(yajl_gen_number(g, s, l)); } static int reformat_string(void * ctx, const unsigned char * stringVal, size_t stringLen) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_string(g, stringVal, stringLen); + GEN_AND_RETURN(yajl_gen_string(g, stringVal, stringLen)); } static int reformat_map_key(void * ctx, const unsigned char * stringVal, size_t stringLen) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_string(g, stringVal, stringLen); + GEN_AND_RETURN(yajl_gen_string(g, stringVal, stringLen)); } static int reformat_start_map(void * ctx) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_map_open(g); + GEN_AND_RETURN(yajl_gen_map_open(g)); } static int reformat_end_map(void * ctx) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_map_close(g); + GEN_AND_RETURN(yajl_gen_map_close(g)); } static int reformat_start_array(void * ctx) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_array_open(g); + GEN_AND_RETURN(yajl_gen_array_open(g)); } static int reformat_end_array(void * ctx) { yajl_gen g = (yajl_gen) ctx; - return yajl_gen_status_ok == yajl_gen_array_close(g); + GEN_AND_RETURN(yajl_gen_array_close(g)); } static yajl_callbacks callbacks = { @@ -97,14 +109,15 @@ usage(const char * progname) { fprintf(stderr, "%s: reformat json from stdin\n" "usage: json_reformat [options]\n" + " -e escape any forward slashes (for embedding in HTML)\n" " -m minimize json rather than beautify (default)\n" + " -s reformat a stream of multiple json entites\n" " -u allow invalid UTF8 inside strings during parsing\n", progname); exit(1); - } -int +int main(int argc, char ** argv) { yajl_handle hand; @@ -133,9 +146,16 @@ main(int argc, char ** argv) case 'm': yajl_gen_config(g, yajl_gen_beautify, 0); break; + case 's': + yajl_config(hand, yajl_allow_multiple_values, 1); + s_streamReformat = 1; + break; case 'u': yajl_config(hand, yajl_dont_validate_strings, 1); break; + case 'e': + yajl_gen_config(g, yajl_gen_escape_solidus, 1); + break; default: fprintf(stderr, "unrecognized option: '%c'\n\n", argv[a][i]); diff --git a/flojay/lloyd-yajl/src/CMakeLists.txt b/flojay/lloyd-yajl/src/CMakeLists.txt index 479b405..99cf9e9 100644 --- a/flojay/lloyd-yajl/src/CMakeLists.txt +++ b/flojay/lloyd-yajl/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2007-2011, Lloyd Hilaiel +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -30,6 +30,7 @@ ADD_DEFINITIONS(-DYAJL_BUILD) # set up some paths SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl) +SET (shareDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/share/pkgconfig) # set the output path for libraries SET(LIBRARY_OUTPUT_PATH ${libDir}) @@ -58,7 +59,9 @@ FILE(MAKE_DIRECTORY ${libDir}) FILE(MAKE_DIRECTORY ${incDir}) # generate build-time source +SET(dollar $) CONFIGURE_FILE(api/yajl_version.h.cmake ${incDir}/yajl_version.h) +CONFIGURE_FILE(yajl.pc.cmake ${shareDir}/yajl.pc) # copy public headers to output directory FOREACH (header ${PUB_HDRS}) @@ -72,11 +75,13 @@ ENDFOREACH (header ${PUB_HDRS}) INCLUDE_DIRECTORIES(${incDir}/..) -IF(NOT WIN32) - # at build time you may specify the cmake variable LIB_SUFFIX to handle - # 64-bit systems which use 'lib64' - INSTALL(TARGETS yajl LIBRARY DESTINATION lib${LIB_SUFFIX}) - INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX}) - INSTALL(FILES ${PUB_HDRS} DESTINATION include/yajl) - INSTALL(FILES ${incDir}/yajl_version.h DESTINATION include/yajl) -ENDIF() +# at build time you may specify the cmake variable LIB_SUFFIX to handle +# 64-bit systems which use 'lib64' +INSTALL(TARGETS yajl + RUNTIME DESTINATION lib${LIB_SUFFIX} + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX}) +INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX}) +INSTALL(FILES ${PUB_HDRS} DESTINATION include/yajl) +INSTALL(FILES ${incDir}/yajl_version.h DESTINATION include/yajl) +INSTALL(FILES ${shareDir}/yajl.pc DESTINATION share/pkgconfig) diff --git a/flojay/lloyd-yajl/src/api/yajl_common.h b/flojay/lloyd-yajl/src/api/yajl_common.h index 49ca3a5..9596ef9 100644 --- a/flojay/lloyd-yajl/src/api/yajl_common.h +++ b/flojay/lloyd-yajl/src/api/yajl_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -21,14 +21,14 @@ #ifdef __cplusplus extern "C" { -#endif +#endif #define YAJL_MAX_DEPTH 128 /* msft dll export gunk. To build a DLL on windows, you * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared * DLL, you must define YAJL_SHARED and WIN32 */ -#if defined(WIN32) && defined(YAJL_SHARED) +#if (defined(_WIN32) || defined(WIN32)) && defined(YAJL_SHARED) # ifdef YAJL_BUILD # define YAJL_API __declspec(dllexport) # else @@ -40,7 +40,7 @@ extern "C" { # else # define YAJL_API # endif -#endif +#endif /** pointer to a malloc function, supporting client overriding memory * allocation routines */ diff --git a/flojay/lloyd-yajl/src/api/yajl_gen.h b/flojay/lloyd-yajl/src/api/yajl_gen.h index 52fa99f..ddd1527 100644 --- a/flojay/lloyd-yajl/src/api/yajl_gen.h +++ b/flojay/lloyd-yajl/src/api/yajl_gen.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -43,7 +43,7 @@ extern "C" { * state */ yajl_gen_in_error_state, /** A complete JSON document has been generated */ - yajl_gen_generation_complete, + yajl_gen_generation_complete, /** yajl_gen_double was passed an invalid floating point value * (infinity or NaN). */ yajl_gen_invalid_number, @@ -150,8 +150,16 @@ extern "C" { * intended to enable incremental JSON outputing. */ YAJL_API void yajl_gen_clear(yajl_gen hand); + /** Reset the generator state. Allows a client to generate multiple + * json entities in a stream. The "sep" string will be inserted to + * separate the previously generated entity from the current, + * NULL means *no separation* of entites (clients beware, generating + * multiple JSON numbers, for instance, will result in inscrutable + * output) */ + YAJL_API void yajl_gen_reset(yajl_gen hand, const char * sep); + #ifdef __cplusplus } -#endif +#endif #endif diff --git a/flojay/lloyd-yajl/src/api/yajl_parse.h b/flojay/lloyd-yajl/src/api/yajl_parse.h index 55c8311..1c25a60 100644 --- a/flojay/lloyd-yajl/src/api/yajl_parse.h +++ b/flojay/lloyd-yajl/src/api/yajl_parse.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/api/yajl_tree.h b/flojay/lloyd-yajl/src/api/yajl_tree.h index 8b377f6..1c1e06a 100644 --- a/flojay/lloyd-yajl/src/api/yajl_tree.h +++ b/flojay/lloyd-yajl/src/api/yajl_tree.h @@ -33,6 +33,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** possible data types that a yajl_val_s can hold */ typedef enum { yajl_t_string = 1, @@ -63,7 +67,7 @@ typedef struct yajl_val_s * yajl_val; */ struct yajl_val_s { - /** Type of the value contained. Use the "YAJL_IS_*" macors to check for a + /** Type of the value contained. Use the "YAJL_IS_*" macros to check for a * specific type. */ yajl_type type; /** Type-specific data. You may use the "YAJL_GET_*" macros to access these @@ -74,10 +78,10 @@ struct yajl_val_s struct { long long i; /*< integer value, if representable. */ double d; /*< double value, if representable. */ + char *r; /*< unparsed number in string form. */ /** Signals whether the \em i and \em d members are * valid. See \c YAJL_NUMBER_INT_VALID and * \c YAJL_NUMBER_DOUBLE_VALID. */ - char *r; /*< unparsed number in string form. */ unsigned int flags; } number; struct { @@ -117,6 +121,7 @@ struct yajl_val_s YAJL_API yajl_val yajl_tree_parse (const char *input, char *error_buffer, size_t error_buffer_size); + /** * Free a parse tree returned by "yajl_tree_parse". * @@ -133,7 +138,7 @@ YAJL_API void yajl_tree_free (yajl_val v); * \param type the yajl_type of the object you seek, or yajl_t_any if any will do. * * \returns a pointer to the found value, or NULL if we came up empty. - * + * * Future Ideas: it'd be nice to move path to a string and implement support for * a teeny tiny micro language here, so you can extract array elements, do things * like .first and .last, even .length. Inspiration from JSONPath and css selectors? @@ -144,8 +149,8 @@ YAJL_API yajl_val yajl_tree_get(yajl_val parent, const char ** path, yajl_type t /* Various convenience macros to check the type of a `yajl_val` */ #define YAJL_IS_STRING(v) (((v) != NULL) && ((v)->type == yajl_t_string)) #define YAJL_IS_NUMBER(v) (((v) != NULL) && ((v)->type == yajl_t_number)) -#define YAJL_IS_INTEGER(v) (YAJL_IS_NUMBER(v) && ((v)->u.flags & YAJL_NUMBER_INT_VALID)) -#define YAJL_IS_DOUBLE(v) (YAJL_IS_NUMBER(v) && ((v)->u.flags & YAJL_NUMBER_DOUBLE_VALID)) +#define YAJL_IS_INTEGER(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_INT_VALID)) +#define YAJL_IS_DOUBLE(v) (YAJL_IS_NUMBER(v) && ((v)->u.number.flags & YAJL_NUMBER_DOUBLE_VALID)) #define YAJL_IS_OBJECT(v) (((v) != NULL) && ((v)->type == yajl_t_object)) #define YAJL_IS_ARRAY(v) (((v) != NULL) && ((v)->type == yajl_t_array )) #define YAJL_IS_TRUE(v) (((v) != NULL) && ((v)->type == yajl_t_true )) @@ -174,4 +179,8 @@ YAJL_API yajl_val yajl_tree_get(yajl_val parent, const char ** path, yajl_type t /** Get a pointer to a yajl_val_array or NULL if the value is not an object. */ #define YAJL_GET_ARRAY(v) (YAJL_IS_ARRAY(v) ? &(v)->u.array : NULL) +#ifdef __cplusplus +} +#endif + #endif /* YAJL_TREE_H */ diff --git a/flojay/lloyd-yajl/src/yajl.c b/flojay/lloyd-yajl/src/yajl.c index 293e545..d477893 100644 --- a/flojay/lloyd-yajl/src/yajl.c +++ b/flojay/lloyd-yajl/src/yajl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_alloc.c b/flojay/lloyd-yajl/src/yajl_alloc.c index 276315a..96ad1d3 100644 --- a/flojay/lloyd-yajl/src/yajl_alloc.c +++ b/flojay/lloyd-yajl/src/yajl_alloc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -25,17 +25,20 @@ static void * yajl_internal_malloc(void *ctx, size_t sz) { + (void)ctx; return malloc(sz); } static void * yajl_internal_realloc(void *ctx, void * previous, size_t sz) { + (void)ctx; return realloc(previous, sz); } static void yajl_internal_free(void *ctx, void * ptr) { + (void)ctx; free(ptr); } diff --git a/flojay/lloyd-yajl/src/yajl_alloc.h b/flojay/lloyd-yajl/src/yajl_alloc.h index 85dbad0..203c2f9 100644 --- a/flojay/lloyd-yajl/src/yajl_alloc.h +++ b/flojay/lloyd-yajl/src/yajl_alloc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_buf.c b/flojay/lloyd-yajl/src/yajl_buf.c index 0d249d3..1aeafde 100644 --- a/flojay/lloyd-yajl/src/yajl_buf.c +++ b/flojay/lloyd-yajl/src/yajl_buf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_buf.h b/flojay/lloyd-yajl/src/yajl_buf.h index 682457f..a358246 100644 --- a/flojay/lloyd-yajl/src/yajl_buf.h +++ b/flojay/lloyd-yajl/src/yajl_buf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_bytestack.h b/flojay/lloyd-yajl/src/yajl_bytestack.h index 8c34b71..9ea7d15 100644 --- a/flojay/lloyd-yajl/src/yajl_bytestack.h +++ b/flojay/lloyd-yajl/src/yajl_bytestack.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_encode.c b/flojay/lloyd-yajl/src/yajl_encode.c index 9dc9a3e..fd08258 100644 --- a/flojay/lloyd-yajl/src/yajl_encode.c +++ b/flojay/lloyd-yajl/src/yajl_encode.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_encode.h b/flojay/lloyd-yajl/src/yajl_encode.h index ac7acc6..853a1a7 100644 --- a/flojay/lloyd-yajl/src/yajl_encode.h +++ b/flojay/lloyd-yajl/src/yajl_encode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_gen.c b/flojay/lloyd-yajl/src/yajl_gen.c index 3d42f4d..0f5c68e 100644 --- a/flojay/lloyd-yajl/src/yajl_gen.c +++ b/flojay/lloyd-yajl/src/yajl_gen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -57,6 +57,7 @@ yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...) switch(opt) { case yajl_gen_beautify: case yajl_gen_validate_utf8: + case yajl_gen_escape_solidus: if (va_arg(ap, int)) g->flags |= opt; else g->flags &= ~opt; break; @@ -124,6 +125,14 @@ yajl_gen_alloc(const yajl_alloc_funcs * afs) return g; } +void +yajl_gen_reset(yajl_gen g, const char * sep) +{ + g->depth = 0; + memset((void *) &(g->state), 0, sizeof(g->state)); + if (sep != NULL) g->print(g->ctx, sep, strlen(sep)); +} + void yajl_gen_free(yajl_gen g) { @@ -139,7 +148,7 @@ yajl_gen_free(yajl_gen g) } else if (g->state[g->depth] == yajl_gen_map_val) { \ g->print(g->ctx, ":", 1); \ if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, " ", 1); \ - } + } #define INSERT_WHITESPACE \ if ((g->flags & yajl_gen_beautify)) { \ @@ -171,7 +180,7 @@ yajl_gen_free(yajl_gen g) if (++(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded; #define DECREMENT_DEPTH \ - if (--(g->depth) >= YAJL_MAX_DEPTH) return yajl_gen_error; + if (--(g->depth) >= YAJL_MAX_DEPTH) return yajl_gen_generation_complete; #define APPENDED_ATOM \ switch (g->state[g->depth]) { \ @@ -208,7 +217,7 @@ yajl_gen_integer(yajl_gen g, long long int number) return yajl_gen_status_ok; } -#ifdef WIN32 +#if defined(_WIN32) || defined(WIN32) #include #define isnan _isnan #define isinf !_finite @@ -218,10 +227,13 @@ yajl_gen_status yajl_gen_double(yajl_gen g, double number) { char i[32]; - ENSURE_VALID_STATE; ENSURE_NOT_KEY; + ENSURE_VALID_STATE; ENSURE_NOT_KEY; if (isnan(number) || isinf(number)) return yajl_gen_invalid_number; INSERT_SEP; INSERT_WHITESPACE; sprintf(i, "%.20g", number); + if (strspn(i, "0123456789-") == strlen(i)) { + strcat(i, ".0"); + } g->print(g->ctx, i, (unsigned int)strlen(i)); APPENDED_ATOM; FINAL_NEWLINE; @@ -285,8 +297,8 @@ yajl_gen_status yajl_gen_map_open(yajl_gen g) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - INCREMENT_DEPTH; - + INCREMENT_DEPTH; + g->state[g->depth] = yajl_gen_map_start; g->print(g->ctx, "{", 1); if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); @@ -297,9 +309,9 @@ yajl_gen_map_open(yajl_gen g) yajl_gen_status yajl_gen_map_close(yajl_gen g) { - ENSURE_VALID_STATE; + ENSURE_VALID_STATE; DECREMENT_DEPTH; - + if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); APPENDED_ATOM; INSERT_WHITESPACE; @@ -312,7 +324,7 @@ yajl_gen_status yajl_gen_array_open(yajl_gen g) { ENSURE_VALID_STATE; ENSURE_NOT_KEY; INSERT_SEP; INSERT_WHITESPACE; - INCREMENT_DEPTH; + INCREMENT_DEPTH; g->state[g->depth] = yajl_gen_array_start; g->print(g->ctx, "[", 1); if ((g->flags & yajl_gen_beautify)) g->print(g->ctx, "\n", 1); diff --git a/flojay/lloyd-yajl/src/yajl_lex.c b/flojay/lloyd-yajl/src/yajl_lex.c index b098e6a..0b6f7cc 100644 --- a/flojay/lloyd-yajl/src/yajl_lex.c +++ b/flojay/lloyd-yajl/src/yajl_lex.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -24,7 +24,7 @@ #ifdef YAJL_LEXER_DEBUG static const char * -tokToStr(yajl_tok tok) +tokToStr(yajl_tok tok) { switch (tok) { case yajl_tok_bool: return "bool"; @@ -53,13 +53,13 @@ tokToStr(yajl_tok tok) * the network or disk). This makes the lexer more complex. The * responsibility of the lexer is to handle transparently the case where * a chunk boundary falls in the middle of a token. This is - * accomplished is via a buffer and a character reading abstraction. + * accomplished is via a buffer and a character reading abstraction. * * Overview of implementation * * When we lex to end of input string before end of token is hit, we * copy all of the input text composing the token into our lexBuf. - * + * * Every time we read a character, we do so through the readChar function. * readChar's responsibility is to handle pulling all chars from the buffer * before pulling chars from input text @@ -74,7 +74,7 @@ struct yajl_lexer_t { yajl_lex_error error; /* a input buffer to handle the case where a token is spread over - * multiple chunks */ + * multiple chunks */ yajl_buf buf; /* in the case where we have data in the lexBuf, bufOff holds @@ -186,7 +186,7 @@ static const char charLookupTable[256] = * yajl_tok_eof - if end of input was hit before validation could * complete * yajl_tok_error - if invalid utf8 was encountered - * + * * NOTE: on error the offset will point to the first char of the * invalid utf8 */ #define UTF8_CHECK_EOF if (*offset >= jsonTextLen) { return yajl_tok_eof; } @@ -200,7 +200,7 @@ yajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText, /* single byte */ return yajl_tok_string; } else if ((curChar >> 5) == 0x6) { - /* two byte */ + /* two byte */ UTF8_CHECK_EOF; curChar = readChar(lexer, jsonText, offset); if ((curChar >> 6) == 0x2) return yajl_tok_string; @@ -226,7 +226,7 @@ yajl_lex_utf8_char(yajl_lexer lexer, const unsigned char * jsonText, if ((curChar >> 6) == 0x2) return yajl_tok_string; } } - } + } return yajl_tok_error; } @@ -279,7 +279,7 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, { const unsigned char * p; size_t len; - + if ((lexer->bufInUse && yajl_buf_len(lexer->buf) && lexer->bufOff < yajl_buf_len(lexer->buf))) { @@ -287,8 +287,8 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, (lexer->bufOff)); len = yajl_buf_len(lexer->buf) - lexer->bufOff; lexer->bufOff += yajl_string_scan(p, len, lexer->validateUTF8); - } - else if (*offset < jsonTextLen) + } + else if (*offset < jsonTextLen) { p = jsonText + *offset; len = jsonTextLen - *offset; @@ -316,8 +316,8 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, unsigned int i = 0; for (i=0;i<4;i++) { - STR_CHECK_EOF; - curChar = readChar(lexer, jsonText, offset); + STR_CHECK_EOF; + curChar = readChar(lexer, jsonText, offset); if (!(charLookupTable[curChar] & VHC)) { /* back up to offending char */ unreadChar(lexer, offset); @@ -329,8 +329,8 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, /* back up to offending char */ unreadChar(lexer, offset); lexer->error = yajl_lex_string_invalid_escaped_char; - goto finish_string_lex; - } + goto finish_string_lex; + } } /* when not validating UTF8 it's a simple table lookup to determine * if the present character is invalid */ @@ -338,29 +338,29 @@ yajl_lex_string(yajl_lexer lexer, const unsigned char * jsonText, /* back up to offending char */ unreadChar(lexer, offset); lexer->error = yajl_lex_string_invalid_json_char; - goto finish_string_lex; + goto finish_string_lex; } /* when in validate UTF8 mode we need to do some extra work */ else if (lexer->validateUTF8) { yajl_tok t = yajl_lex_utf8_char(lexer, jsonText, jsonTextLen, offset, curChar); - + if (t == yajl_tok_eof) { tok = yajl_tok_eof; goto finish_string_lex; } else if (t == yajl_tok_error) { lexer->error = yajl_lex_string_invalid_utf8; goto finish_string_lex; - } + } } - /* accept it, and move on */ + /* accept it, and move on */ } finish_string_lex: /* tell our buddy, the parser, wether he needs to process this string * again */ if (hasEscapes && tok == yajl_tok_string) { tok = yajl_tok_string_with_escapes; - } + } return tok; } @@ -379,23 +379,23 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, yajl_tok tok = yajl_tok_integer; - RETURN_IF_EOF; + RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); /* optional leading minus */ if (c == '-') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } /* a single zero, or a series of integers */ if (c == '0') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } else if (c >= '1' && c <= '9') { do { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } while (c >= '0' && c <= '9'); } else { unreadChar(lexer, offset); @@ -406,15 +406,15 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, /* optional fraction (indicates this is floating point) */ if (c == '.') { int numRd = 0; - + RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); while (c >= '0' && c <= '9') { numRd++; RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); - } + c = readChar(lexer, jsonText, offset); + } if (!numRd) { unreadChar(lexer, offset); @@ -427,18 +427,18 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, /* optional exponent (indicates this is floating point) */ if (c == 'e' || c == 'E') { RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); /* optional sign */ if (c == '+' || c == '-') { RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); } if (c >= '0' && c <= '9') { do { RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + c = readChar(lexer, jsonText, offset); } while (c >= '0' && c <= '9'); } else { unreadChar(lexer, offset); @@ -447,10 +447,10 @@ yajl_lex_number(yajl_lexer lexer, const unsigned char * jsonText, } tok = yajl_tok_double; } - + /* we always go "one too far" */ unreadChar(lexer, offset); - + return tok; } @@ -462,24 +462,24 @@ yajl_lex_comment(yajl_lexer lexer, const unsigned char * jsonText, yajl_tok tok = yajl_tok_comment; - RETURN_IF_EOF; + RETURN_IF_EOF; c = readChar(lexer, jsonText, offset); /* either slash or star expected */ if (c == '/') { /* now we throw away until end of line */ do { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); } while (c != '\n'); } else if (c == '*') { - /* now we throw away until end of comment */ + /* now we throw away until end of comment */ for (;;) { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); if (c == '*') { - RETURN_IF_EOF; - c = readChar(lexer, jsonText, offset); + RETURN_IF_EOF; + c = readChar(lexer, jsonText, offset); if (c == '/') { break; } else { @@ -491,7 +491,7 @@ yajl_lex_comment(yajl_lexer lexer, const unsigned char * jsonText, lexer->error = yajl_lex_invalid_char; tok = yajl_tok_error; } - + return tok; } @@ -599,7 +599,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, goto lexed; } case '-': - case '0': case '1': case '2': case '3': case '4': + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { /* integer parsing wants to start from the beginning */ unreadChar(lexer, offset); @@ -626,11 +626,11 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, jsonTextLen, offset); if (tok == yajl_tok_comment) { /* "error" is silly, but that's the initial - * state of tok. guilty until proven innocent. */ + * state of tok. guilty until proven innocent. */ tok = yajl_tok_error; yajl_buf_clear(lexer->buf); lexer->bufInUse = 0; - startOffset = *offset; + startOffset = *offset; break; } /* hit error or eof, bail */ @@ -651,7 +651,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, lexer->bufInUse = 1; yajl_buf_append(lexer->buf, jsonText + startOffset, *offset - startOffset); lexer->bufOff = 0; - + if (tok != yajl_tok_eof) { *outBuf = yajl_buf_data(lexer->buf); *outLen = yajl_buf_len(lexer->buf); @@ -667,7 +667,7 @@ yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText, { assert(*outLen >= 2); (*outBuf)++; - *outLen -= 2; + *outLen -= 2; } @@ -698,7 +698,7 @@ yajl_lex_error_to_string(yajl_lex_error error) case yajl_lex_string_invalid_escaped_char: return "inside a string, '\\' occurs before a character " "which it may not."; - case yajl_lex_string_invalid_json_char: + case yajl_lex_string_invalid_json_char: return "invalid character inside string."; case yajl_lex_string_invalid_hex_char: return "invalid (non-hex) character occurs after '\\u' inside " @@ -751,13 +751,13 @@ yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText, size_t bufOff = lexer->bufOff; unsigned int bufInUse = lexer->bufInUse; yajl_tok tok; - + tok = yajl_lex_lex(lexer, jsonText, jsonTextLen, &offset, &outBuf, &outLen); lexer->bufOff = bufOff; lexer->bufInUse = bufInUse; yajl_buf_truncate(lexer->buf, bufLen); - + return tok; } diff --git a/flojay/lloyd-yajl/src/yajl_lex.h b/flojay/lloyd-yajl/src/yajl_lex.h index 20edf47..fd17c00 100644 --- a/flojay/lloyd-yajl/src/yajl_lex.h +++ b/flojay/lloyd-yajl/src/yajl_lex.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -20,21 +20,21 @@ #include "api/yajl_common.h" typedef enum { - yajl_tok_bool, + yajl_tok_bool, yajl_tok_colon, - yajl_tok_comma, + yajl_tok_comma, yajl_tok_eof, yajl_tok_error, - yajl_tok_left_brace, + yajl_tok_left_brace, yajl_tok_left_bracket, - yajl_tok_null, - yajl_tok_right_brace, + yajl_tok_null, + yajl_tok_right_brace, yajl_tok_right_bracket, /* we differentiate between integers and doubles to allow the * parser to interpret the number without re-scanning */ - yajl_tok_integer, - yajl_tok_double, + yajl_tok_integer, + yajl_tok_double, /* we differentiate between strings which require further processing, * and strings that do not */ @@ -61,11 +61,11 @@ void yajl_lex_free(yajl_lexer lexer); * * the client may be interested in the value of offset when an error is * returned from the lexer. This allows the client to render useful -n * error messages. + * error messages. * * When you pass the next chunk of data, context should be reinitialized * to zero. - * + * * Finally, the output buffer is usually just a pointer into the jsonText, * however in cases where the entity being lexed spans multiple chunks, * the lexer will buffer the entity and the data returned will be diff --git a/flojay/lloyd-yajl/src/yajl_parser.c b/flojay/lloyd-yajl/src/yajl_parser.c index 15a8196..1a528a6 100644 --- a/flojay/lloyd-yajl/src/yajl_parser.c +++ b/flojay/lloyd-yajl/src/yajl_parser.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -51,6 +51,10 @@ yajl_parse_integer(const unsigned char *number, unsigned int length) errno = ERANGE; return sign == 1 ? LLONG_MAX : LLONG_MIN; } + if (*pos < '0' || *pos > '9') { + errno = ERANGE; + return sign == 1 ? LLONG_MAX : LLONG_MIN; + } ret += (*pos++ - '0'); } @@ -168,7 +172,7 @@ yajl_do_finish(yajl_handle hand) case yajl_state_parse_complete: return yajl_status_ok; default: - if (!(hand->flags & yajl_allow_partial_values)) + if (!(hand->flags & yajl_allow_partial_values)) { yajl_bs_set(hand->stateStack, yajl_state_parse_error); hand->parseError = "premature EOF"; @@ -279,6 +283,7 @@ yajl_do_parse(yajl_handle hand, const unsigned char * jsonText, hand->ctx,(const char *) buf, bufLen)); } else if (hand->callbacks->yajl_integer) { long long int i = 0; + errno = 0; i = yajl_parse_integer(buf, bufLen); if ((i == LLONG_MIN || i == LLONG_MAX) && errno == ERANGE) @@ -306,6 +311,7 @@ yajl_do_parse(yajl_handle hand, const unsigned char * jsonText, yajl_buf_clear(hand->decodeBuf); yajl_buf_append(hand->decodeBuf, buf, bufLen); buf = yajl_buf_data(hand->decodeBuf); + errno = 0; d = strtod((char *) buf, NULL); if ((d == HUGE_VAL || d == -HUGE_VAL) && errno == ERANGE) diff --git a/flojay/lloyd-yajl/src/yajl_parser.h b/flojay/lloyd-yajl/src/yajl_parser.h index c12fc1b..c79299a 100644 --- a/flojay/lloyd-yajl/src/yajl_parser.h +++ b/flojay/lloyd-yajl/src/yajl_parser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/flojay/lloyd-yajl/src/yajl_tree.c b/flojay/lloyd-yajl/src/yajl_tree.c index 3e7da94..3d357a3 100644 --- a/flojay/lloyd-yajl/src/yajl_tree.c +++ b/flojay/lloyd-yajl/src/yajl_tree.c @@ -25,7 +25,7 @@ #include "yajl_parser.h" -#ifdef WIN32 +#if defined(_WIN32) || defined(WIN32) #define snprintf sprintf_s #endif @@ -194,7 +194,7 @@ static int array_add_value (context_t *ctx, /* "context_add_value" will only call us with array values. */ assert(YAJL_IS_ARRAY(array)); - + tmp = realloc(array->u.array.values, sizeof(*(array->u.array.values)) * (array->u.array.len + 1)); if (tmp == NULL) @@ -309,11 +309,10 @@ static int handle_number (void *ctx, const char *string, size_t string_length) v->u.number.flags = 0; - endptr = NULL; errno = 0; v->u.number.i = yajl_parse_integer((const unsigned char *) v->u.number.r, strlen(v->u.number.r)); - if ((errno == 0) && (endptr != NULL) && (*endptr == 0)) + if (errno == 0) v->u.number.flags |= YAJL_NUMBER_INT_VALID; endptr = NULL; @@ -421,6 +420,7 @@ yajl_val yajl_tree_parse (const char *input, yajl_handle handle; yajl_status status; + char * internal_err_str; context_t ctx = { NULL, NULL, NULL, 0 }; ctx.errbuf = error_buffer; @@ -438,11 +438,11 @@ yajl_val yajl_tree_parse (const char *input, status = yajl_complete_parse (handle); if (status != yajl_status_ok) { if (error_buffer != NULL && error_buffer_size > 0) { - snprintf( - error_buffer, error_buffer_size, "%s", - (char *) yajl_get_error(handle, 1, - (const unsigned char *) input, - strlen(input))); + internal_err_str = (char *) yajl_get_error(handle, 1, + (const unsigned char *) input, + strlen(input)); + snprintf(error_buffer, error_buffer_size, "%s", internal_err_str); + YA_FREE(&(handle->alloc), internal_err_str); } yajl_free (handle); return NULL; @@ -456,16 +456,18 @@ yajl_val yajl_tree_get(yajl_val n, const char ** path, yajl_type type) { if (!path) return NULL; while (n && *path) { - unsigned int i; + size_t i; + size_t len; if (n->type != yajl_t_object) return NULL; - for (i = 0; i < n->u.object.len; i++) { + len = n->u.object.len; + for (i = 0; i < len; i++) { if (!strcmp(*path, n->u.object.keys[i])) { n = n->u.object.values[i]; break; } } - if (i == n->u.object.len) return NULL; + if (i == len) return NULL; path++; } if (n && type != yajl_t_any && type != n->type) n = NULL; diff --git a/flojay/lloyd-yajl/test/CMakeLists.txt b/flojay/lloyd-yajl/test/CMakeLists.txt index 153288c..c07ee0a 100644 --- a/flojay/lloyd-yajl/test/CMakeLists.txt +++ b/flojay/lloyd-yajl/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2007-2011, Lloyd Hilaiel +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -12,12 +12,5 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -SET (SRCS yajl_test.c) - -# use the library we build, duh. -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include) -LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) - -ADD_EXECUTABLE(yajl_test ${SRCS}) - -TARGET_LINK_LIBRARIES(yajl_test yajl_s) +ADD_SUBDIRECTORY(parsing) +ADD_SUBDIRECTORY(api) diff --git a/flojay/lloyd-yajl/test/cases/ac_difficult_json_c_test_case_with_comments.json b/flojay/lloyd-yajl/test/cases/ac_difficult_json_c_test_case_with_comments.json deleted file mode 100644 index 2463c71..0000000 --- a/flojay/lloyd-yajl/test/cases/ac_difficult_json_c_test_case_with_comments.json +++ /dev/null @@ -1 +0,0 @@ -{ "glossary": { /* you */ "title": /**/ "example glossary", /*should*/"GlossDiv": { "title": /*never*/"S", /*ever*/"GlossList": [ { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": "A meta-markup language, used to create markup languages such as DocBook.", /*see*/"GlossSeeAlso"/*this*/:/*coming*/[/*out*/"GML"/*of*/,/*the*/"XML"/*parser!*/, "markup"] /*hey*/}/*ho*/]/*hey*/}/*ho*/} } // and the parser won't even get this far, so chill. /* hah! diff --git a/flojay/lloyd-yajl/test/cases/ac_difficult_json_c_test_case_with_comments.json.gold b/flojay/lloyd-yajl/test/cases/ac_difficult_json_c_test_case_with_comments.json.gold deleted file mode 100644 index c3adc11..0000000 --- a/flojay/lloyd-yajl/test/cases/ac_difficult_json_c_test_case_with_comments.json.gold +++ /dev/null @@ -1,36 +0,0 @@ -map open '{' -key: 'glossary' -map open '{' -key: 'title' -string: 'example glossary' -key: 'GlossDiv' -map open '{' -key: 'title' -string: 'S' -key: 'GlossList' -array open '[' -map open '{' -key: 'ID' -string: 'SGML' -key: 'SortAs' -string: 'SGML' -key: 'GlossTerm' -string: 'Standard Generalized Markup Language' -key: 'Acronym' -string: 'SGML' -key: 'Abbrev' -string: 'ISO 8879:1986' -key: 'GlossDef' -string: 'A meta-markup language, used to create markup languages such as DocBook.' -key: 'GlossSeeAlso' -array open '[' -string: 'GML' -string: 'XML' -string: 'markup' -array close ']' -map close '}' -array close ']' -map close '}' -map close '}' -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ac_simple_with_comments.json b/flojay/lloyd-yajl/test/cases/ac_simple_with_comments.json deleted file mode 100644 index 3b79bba..0000000 --- a/flojay/lloyd-yajl/test/cases/ac_simple_with_comments.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "this": "is", // ignore this - "really": "simple", - /* ignore -this -too * / -** // -(/ -******/ - "json": "right?" -} diff --git a/flojay/lloyd-yajl/test/cases/ac_simple_with_comments.json.gold b/flojay/lloyd-yajl/test/cases/ac_simple_with_comments.json.gold deleted file mode 100644 index 80fcad2..0000000 --- a/flojay/lloyd-yajl/test/cases/ac_simple_with_comments.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -map open '{' -key: 'this' -string: 'is' -key: 'really' -string: 'simple' -key: 'json' -string: 'right?' -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ag_false_then_garbage.json b/flojay/lloyd-yajl/test/cases/ag_false_then_garbage.json deleted file mode 100644 index 78f4e96..0000000 --- a/flojay/lloyd-yajl/test/cases/ag_false_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -falsex \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/ag_false_then_garbage.json.gold b/flojay/lloyd-yajl/test/cases/ag_false_then_garbage.json.gold deleted file mode 100644 index e55fa1f..0000000 --- a/flojay/lloyd-yajl/test/cases/ag_false_then_garbage.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: false -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ag_null_then_garbage.json b/flojay/lloyd-yajl/test/cases/ag_null_then_garbage.json deleted file mode 100644 index 7b65b35..0000000 --- a/flojay/lloyd-yajl/test/cases/ag_null_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -nullx diff --git a/flojay/lloyd-yajl/test/cases/ag_null_then_garbage.json.gold b/flojay/lloyd-yajl/test/cases/ag_null_then_garbage.json.gold deleted file mode 100644 index 94ad0fa..0000000 --- a/flojay/lloyd-yajl/test/cases/ag_null_then_garbage.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -null -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ag_true_then_garbage.json b/flojay/lloyd-yajl/test/cases/ag_true_then_garbage.json deleted file mode 100644 index 9151612..0000000 --- a/flojay/lloyd-yajl/test/cases/ag_true_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -truex \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/ag_true_then_garbage.json.gold b/flojay/lloyd-yajl/test/cases/ag_true_then_garbage.json.gold deleted file mode 100644 index 0858bf7..0000000 --- a/flojay/lloyd-yajl/test/cases/ag_true_then_garbage.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: true -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/am_eof.json b/flojay/lloyd-yajl/test/cases/am_eof.json deleted file mode 100644 index 43a772f..0000000 --- a/flojay/lloyd-yajl/test/cases/am_eof.json +++ /dev/null @@ -1 +0,0 @@ -{ "123": diff --git a/flojay/lloyd-yajl/test/cases/am_eof.json.gold b/flojay/lloyd-yajl/test/cases/am_eof.json.gold deleted file mode 100644 index 5a9708b..0000000 --- a/flojay/lloyd-yajl/test/cases/am_eof.json.gold +++ /dev/null @@ -1,4 +0,0 @@ -map open '{' -key: '123' -parse error: premature EOF -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/am_integers.json b/flojay/lloyd-yajl/test/cases/am_integers.json deleted file mode 100644 index 856809b..0000000 --- a/flojay/lloyd-yajl/test/cases/am_integers.json +++ /dev/null @@ -1 +0,0 @@ -1221 21 diff --git a/flojay/lloyd-yajl/test/cases/am_integers.json.gold b/flojay/lloyd-yajl/test/cases/am_integers.json.gold deleted file mode 100644 index 7b8a953..0000000 --- a/flojay/lloyd-yajl/test/cases/am_integers.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -integer: 1221 -integer: 21 -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/am_multiple.json b/flojay/lloyd-yajl/test/cases/am_multiple.json deleted file mode 100644 index b573db0..0000000 --- a/flojay/lloyd-yajl/test/cases/am_multiple.json +++ /dev/null @@ -1,3 +0,0 @@ - -{} -{} diff --git a/flojay/lloyd-yajl/test/cases/am_multiple.json.gold b/flojay/lloyd-yajl/test/cases/am_multiple.json.gold deleted file mode 100644 index bf705d4..0000000 --- a/flojay/lloyd-yajl/test/cases/am_multiple.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -map open '{' -map close '}' -map open '{' -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/am_stuff.json b/flojay/lloyd-yajl/test/cases/am_stuff.json deleted file mode 100644 index 89c607d..0000000 --- a/flojay/lloyd-yajl/test/cases/am_stuff.json +++ /dev/null @@ -1,7 +0,0 @@ -{} -[] -[] -"sdfasd" -123 -{ "123" : 123 } -3.1e124 diff --git a/flojay/lloyd-yajl/test/cases/am_stuff.json.gold b/flojay/lloyd-yajl/test/cases/am_stuff.json.gold deleted file mode 100644 index bf3a5bb..0000000 --- a/flojay/lloyd-yajl/test/cases/am_stuff.json.gold +++ /dev/null @@ -1,14 +0,0 @@ -map open '{' -map close '}' -array open '[' -array close ']' -array open '[' -array close ']' -string: 'sdfasd' -integer: 123 -map open '{' -key: '123' -integer: 123 -map close '}' -double: 3.1e+124 -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ap_array_open.json b/flojay/lloyd-yajl/test/cases/ap_array_open.json deleted file mode 100644 index 558ed37..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_array_open.json +++ /dev/null @@ -1 +0,0 @@ -[ diff --git a/flojay/lloyd-yajl/test/cases/ap_array_open.json.gold b/flojay/lloyd-yajl/test/cases/ap_array_open.json.gold deleted file mode 100644 index 478b6b9..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_array_open.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -array open '[' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ap_eof_str.json b/flojay/lloyd-yajl/test/cases/ap_eof_str.json deleted file mode 100644 index 6a21793..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_eof_str.json +++ /dev/null @@ -1 +0,0 @@ -"abc \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/ap_eof_str.json.gold b/flojay/lloyd-yajl/test/cases/ap_eof_str.json.gold deleted file mode 100644 index 736730b..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_eof_str.json.gold +++ /dev/null @@ -1 +0,0 @@ -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ap_map_open.json b/flojay/lloyd-yajl/test/cases/ap_map_open.json deleted file mode 100644 index 98232c6..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_map_open.json +++ /dev/null @@ -1 +0,0 @@ -{ diff --git a/flojay/lloyd-yajl/test/cases/ap_map_open.json.gold b/flojay/lloyd-yajl/test/cases/ap_map_open.json.gold deleted file mode 100644 index ab1f33d..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_map_open.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -map open '{' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/ap_partial_ok.json b/flojay/lloyd-yajl/test/cases/ap_partial_ok.json deleted file mode 100644 index 2fbd027..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_partial_ok.json +++ /dev/null @@ -1 +0,0 @@ -[ "foo", "bar" diff --git a/flojay/lloyd-yajl/test/cases/ap_partial_ok.json.gold b/flojay/lloyd-yajl/test/cases/ap_partial_ok.json.gold deleted file mode 100644 index 9f754c7..0000000 --- a/flojay/lloyd-yajl/test/cases/ap_partial_ok.json.gold +++ /dev/null @@ -1,4 +0,0 @@ -array open '[' -string: 'foo' -string: 'bar' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/array.json b/flojay/lloyd-yajl/test/cases/array.json deleted file mode 100644 index f76058d..0000000 --- a/flojay/lloyd-yajl/test/cases/array.json +++ /dev/null @@ -1,6 +0,0 @@ -["foo", - "bar", "baz", - true,false,null,{"key":"value"}, - [null,null,null,[]], - "\n\r\\" -] diff --git a/flojay/lloyd-yajl/test/cases/array.json.gold b/flojay/lloyd-yajl/test/cases/array.json.gold deleted file mode 100644 index 477559d..0000000 --- a/flojay/lloyd-yajl/test/cases/array.json.gold +++ /dev/null @@ -1,22 +0,0 @@ -array open '[' -string: 'foo' -string: 'bar' -string: 'baz' -bool: true -bool: false -null -map open '{' -key: 'key' -string: 'value' -map close '}' -array open '[' -null -null -null -array open '[' -array close ']' -array close ']' -string: ' - \' -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/array_close.json b/flojay/lloyd-yajl/test/cases/array_close.json deleted file mode 100644 index 079b579..0000000 --- a/flojay/lloyd-yajl/test/cases/array_close.json +++ /dev/null @@ -1 +0,0 @@ -] diff --git a/flojay/lloyd-yajl/test/cases/array_close.json.gold b/flojay/lloyd-yajl/test/cases/array_close.json.gold deleted file mode 100644 index 972fd39..0000000 --- a/flojay/lloyd-yajl/test/cases/array_close.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -parse error: unallowed token at this point in JSON text -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/bignums.json b/flojay/lloyd-yajl/test/cases/bignums.json deleted file mode 100644 index 75aca9a..0000000 --- a/flojay/lloyd-yajl/test/cases/bignums.json +++ /dev/null @@ -1 +0,0 @@ -[ 9223372036854775807, -9223372036854775807 ] diff --git a/flojay/lloyd-yajl/test/cases/bignums.json.gold b/flojay/lloyd-yajl/test/cases/bignums.json.gold deleted file mode 100644 index 8bb3b1e..0000000 --- a/flojay/lloyd-yajl/test/cases/bignums.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -array open '[' -integer: 9223372036854775807 -integer: -9223372036854775807 -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/bogus_char.json b/flojay/lloyd-yajl/test/cases/bogus_char.json deleted file mode 100644 index 8163bd8..0000000 --- a/flojay/lloyd-yajl/test/cases/bogus_char.json +++ /dev/null @@ -1,4 +0,0 @@ -["this","is","what","should","be", - "a happy bit of json", - "but someone, misspelled \"true\"", ture, - "who says JSON is easy for humans to generate?"] diff --git a/flojay/lloyd-yajl/test/cases/bogus_char.json.gold b/flojay/lloyd-yajl/test/cases/bogus_char.json.gold deleted file mode 100644 index 0c68a49..0000000 --- a/flojay/lloyd-yajl/test/cases/bogus_char.json.gold +++ /dev/null @@ -1,10 +0,0 @@ -array open '[' -string: 'this' -string: 'is' -string: 'what' -string: 'should' -string: 'be' -string: 'a happy bit of json' -string: 'but someone, misspelled "true"' -lexical error: invalid string in json text. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/codepoints_from_unicode_org.json b/flojay/lloyd-yajl/test/cases/codepoints_from_unicode_org.json deleted file mode 100644 index f91f3be..0000000 --- a/flojay/lloyd-yajl/test/cases/codepoints_from_unicode_org.json +++ /dev/null @@ -1 +0,0 @@ -"\u004d\u0430\u4e8c\ud800\udf02" diff --git a/flojay/lloyd-yajl/test/cases/codepoints_from_unicode_org.json.gold b/flojay/lloyd-yajl/test/cases/codepoints_from_unicode_org.json.gold deleted file mode 100644 index f359a1b..0000000 --- a/flojay/lloyd-yajl/test/cases/codepoints_from_unicode_org.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: 'Mа二𐌂' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/deep_arrays.json b/flojay/lloyd-yajl/test/cases/deep_arrays.json deleted file mode 100644 index 82d1b0d..0000000 --- a/flojay/lloyd-yajl/test/cases/deep_arrays.json +++ /dev/null @@ -1 +0,0 @@ -[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/deep_arrays.json.gold b/flojay/lloyd-yajl/test/cases/deep_arrays.json.gold deleted file mode 100644 index 4d5cd99..0000000 --- a/flojay/lloyd-yajl/test/cases/deep_arrays.json.gold +++ /dev/null @@ -1,2049 +0,0 @@ -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array open '[' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/difficult_json_c_test_case.json b/flojay/lloyd-yajl/test/cases/difficult_json_c_test_case.json deleted file mode 100644 index 6998f55..0000000 --- a/flojay/lloyd-yajl/test/cases/difficult_json_c_test_case.json +++ /dev/null @@ -1 +0,0 @@ -{ "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": [ { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML", "markup"] } ] } } } diff --git a/flojay/lloyd-yajl/test/cases/difficult_json_c_test_case.json.gold b/flojay/lloyd-yajl/test/cases/difficult_json_c_test_case.json.gold deleted file mode 100644 index c3adc11..0000000 --- a/flojay/lloyd-yajl/test/cases/difficult_json_c_test_case.json.gold +++ /dev/null @@ -1,36 +0,0 @@ -map open '{' -key: 'glossary' -map open '{' -key: 'title' -string: 'example glossary' -key: 'GlossDiv' -map open '{' -key: 'title' -string: 'S' -key: 'GlossList' -array open '[' -map open '{' -key: 'ID' -string: 'SGML' -key: 'SortAs' -string: 'SGML' -key: 'GlossTerm' -string: 'Standard Generalized Markup Language' -key: 'Acronym' -string: 'SGML' -key: 'Abbrev' -string: 'ISO 8879:1986' -key: 'GlossDef' -string: 'A meta-markup language, used to create markup languages such as DocBook.' -key: 'GlossSeeAlso' -array open '[' -string: 'GML' -string: 'XML' -string: 'markup' -array close ']' -map close '}' -array close ']' -map close '}' -map close '}' -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/doubles.json b/flojay/lloyd-yajl/test/cases/doubles.json deleted file mode 100644 index 626f21c..0000000 --- a/flojay/lloyd-yajl/test/cases/doubles.json +++ /dev/null @@ -1 +0,0 @@ -[ 0.1e2, 1e1, 3.141569, 10000000000000e-10] diff --git a/flojay/lloyd-yajl/test/cases/doubles.json.gold b/flojay/lloyd-yajl/test/cases/doubles.json.gold deleted file mode 100644 index c0ea726..0000000 --- a/flojay/lloyd-yajl/test/cases/doubles.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -array open '[' -double: 10 -double: 10 -double: 3.14157 -double: 1000 -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/doubles_in_array.json b/flojay/lloyd-yajl/test/cases/doubles_in_array.json deleted file mode 100644 index 06bf727..0000000 --- a/flojay/lloyd-yajl/test/cases/doubles_in_array.json +++ /dev/null @@ -1 +0,0 @@ -[0.00011999999999999999, 6E-06, 6E-06, 1E-06, 1E-06] diff --git a/flojay/lloyd-yajl/test/cases/doubles_in_array.json.gold b/flojay/lloyd-yajl/test/cases/doubles_in_array.json.gold deleted file mode 100644 index 57f5b9a..0000000 --- a/flojay/lloyd-yajl/test/cases/doubles_in_array.json.gold +++ /dev/null @@ -1,8 +0,0 @@ -array open '[' -double: 0.00012 -double: 6e-06 -double: 6e-06 -double: 1e-06 -double: 1e-06 -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/empty_array.json b/flojay/lloyd-yajl/test/cases/empty_array.json deleted file mode 100644 index 0637a08..0000000 --- a/flojay/lloyd-yajl/test/cases/empty_array.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/empty_array.json.gold b/flojay/lloyd-yajl/test/cases/empty_array.json.gold deleted file mode 100644 index f069c8f..0000000 --- a/flojay/lloyd-yajl/test/cases/empty_array.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -array open '[' -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/empty_string.json b/flojay/lloyd-yajl/test/cases/empty_string.json deleted file mode 100644 index e16c76d..0000000 --- a/flojay/lloyd-yajl/test/cases/empty_string.json +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/flojay/lloyd-yajl/test/cases/empty_string.json.gold b/flojay/lloyd-yajl/test/cases/empty_string.json.gold deleted file mode 100644 index c197bba..0000000 --- a/flojay/lloyd-yajl/test/cases/empty_string.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: '' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/escaped_bulgarian.json b/flojay/lloyd-yajl/test/cases/escaped_bulgarian.json deleted file mode 100644 index 9ce1d1c..0000000 --- a/flojay/lloyd-yajl/test/cases/escaped_bulgarian.json +++ /dev/null @@ -1,4 +0,0 @@ -["\u0414\u0430", - "\u041c\u0443", - "\u0415\u0431\u0430", - "\u041c\u0430\u0439\u043a\u0430\u0442\u0430"] diff --git a/flojay/lloyd-yajl/test/cases/escaped_bulgarian.json.gold b/flojay/lloyd-yajl/test/cases/escaped_bulgarian.json.gold deleted file mode 100644 index a0c9ae9..0000000 --- a/flojay/lloyd-yajl/test/cases/escaped_bulgarian.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -array open '[' -string: 'Да' -string: 'Му' -string: 'Еба' -string: 'Майката' -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/escaped_foobar.json b/flojay/lloyd-yajl/test/cases/escaped_foobar.json deleted file mode 100644 index 2c0e25f..0000000 --- a/flojay/lloyd-yajl/test/cases/escaped_foobar.json +++ /dev/null @@ -1 +0,0 @@ -"\u0066\u006f\u006f\u0062\u0061\u0072" diff --git a/flojay/lloyd-yajl/test/cases/escaped_foobar.json.gold b/flojay/lloyd-yajl/test/cases/escaped_foobar.json.gold deleted file mode 100644 index 5753c64..0000000 --- a/flojay/lloyd-yajl/test/cases/escaped_foobar.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: 'foobar' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/false.json b/flojay/lloyd-yajl/test/cases/false.json deleted file mode 100644 index c508d53..0000000 --- a/flojay/lloyd-yajl/test/cases/false.json +++ /dev/null @@ -1 +0,0 @@ -false diff --git a/flojay/lloyd-yajl/test/cases/false.json.gold b/flojay/lloyd-yajl/test/cases/false.json.gold deleted file mode 100644 index e55fa1f..0000000 --- a/flojay/lloyd-yajl/test/cases/false.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: false -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/fg_false_then_garbage.json b/flojay/lloyd-yajl/test/cases/fg_false_then_garbage.json deleted file mode 100644 index 78f4e96..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_false_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -falsex \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/fg_false_then_garbage.json.gold b/flojay/lloyd-yajl/test/cases/fg_false_then_garbage.json.gold deleted file mode 100644 index fe8fc1a..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_false_then_garbage.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -bool: false -parse error: trailing garbage -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/fg_issue_7.json b/flojay/lloyd-yajl/test/cases/fg_issue_7.json deleted file mode 100644 index 77152a9..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_issue_7.json +++ /dev/null @@ -1 +0,0 @@ -2009-10-20@20:38:21.539575 diff --git a/flojay/lloyd-yajl/test/cases/fg_issue_7.json.gold b/flojay/lloyd-yajl/test/cases/fg_issue_7.json.gold deleted file mode 100644 index 4d0de0f..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_issue_7.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -integer: 2009 -parse error: trailing garbage -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/fg_null_then_garbage.json b/flojay/lloyd-yajl/test/cases/fg_null_then_garbage.json deleted file mode 100644 index 7b65b35..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_null_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -nullx diff --git a/flojay/lloyd-yajl/test/cases/fg_null_then_garbage.json.gold b/flojay/lloyd-yajl/test/cases/fg_null_then_garbage.json.gold deleted file mode 100644 index 349235c..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_null_then_garbage.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -null -parse error: trailing garbage -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/fg_true_then_garbage.json b/flojay/lloyd-yajl/test/cases/fg_true_then_garbage.json deleted file mode 100644 index 31f9deb..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_true_then_garbage.json +++ /dev/null @@ -1 +0,0 @@ -truex diff --git a/flojay/lloyd-yajl/test/cases/fg_true_then_garbage.json.gold b/flojay/lloyd-yajl/test/cases/fg_true_then_garbage.json.gold deleted file mode 100644 index 73af6ce..0000000 --- a/flojay/lloyd-yajl/test/cases/fg_true_then_garbage.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -bool: true -parse error: trailing garbage -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/four_byte_utf8.json b/flojay/lloyd-yajl/test/cases/four_byte_utf8.json deleted file mode 100644 index 582c575..0000000 --- a/flojay/lloyd-yajl/test/cases/four_byte_utf8.json +++ /dev/null @@ -1,2 +0,0 @@ -{ "U+10ABCD": "􊯍" } - diff --git a/flojay/lloyd-yajl/test/cases/four_byte_utf8.json.gold b/flojay/lloyd-yajl/test/cases/four_byte_utf8.json.gold deleted file mode 100644 index f6260f2..0000000 --- a/flojay/lloyd-yajl/test/cases/four_byte_utf8.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -map open '{' -key: 'U+10ABCD' -string: '􊯍' -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/high_overflow.json b/flojay/lloyd-yajl/test/cases/high_overflow.json deleted file mode 100644 index 8136b73..0000000 --- a/flojay/lloyd-yajl/test/cases/high_overflow.json +++ /dev/null @@ -1 +0,0 @@ -9223372036854775808 \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/high_overflow.json.gold b/flojay/lloyd-yajl/test/cases/high_overflow.json.gold deleted file mode 100644 index 19c4b77..0000000 --- a/flojay/lloyd-yajl/test/cases/high_overflow.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -parse error: integer overflow -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/integers.json b/flojay/lloyd-yajl/test/cases/integers.json deleted file mode 100644 index c50e4c9..0000000 --- a/flojay/lloyd-yajl/test/cases/integers.json +++ /dev/null @@ -1,3 +0,0 @@ -[ 1,2,3,4,5,6,7, - 123456789 , -123456789, - 2147483647, -2147483647 ] diff --git a/flojay/lloyd-yajl/test/cases/integers.json.gold b/flojay/lloyd-yajl/test/cases/integers.json.gold deleted file mode 100644 index 7ac4bee..0000000 --- a/flojay/lloyd-yajl/test/cases/integers.json.gold +++ /dev/null @@ -1,14 +0,0 @@ -array open '[' -integer: 1 -integer: 2 -integer: 3 -integer: 4 -integer: 5 -integer: 6 -integer: 7 -integer: 123456789 -integer: -123456789 -integer: 2147483647 -integer: -2147483647 -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/invalid_utf8.json b/flojay/lloyd-yajl/test/cases/invalid_utf8.json deleted file mode 100644 index 12f1718..0000000 --- a/flojay/lloyd-yajl/test/cases/invalid_utf8.json +++ /dev/null @@ -1 +0,0 @@ -["Да М Еба Майката"] diff --git a/flojay/lloyd-yajl/test/cases/invalid_utf8.json.gold b/flojay/lloyd-yajl/test/cases/invalid_utf8.json.gold deleted file mode 100644 index c0dec77..0000000 --- a/flojay/lloyd-yajl/test/cases/invalid_utf8.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -array open '[' -lexical error: invalid bytes in UTF8 string. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/isolated_surrogate_marker.json b/flojay/lloyd-yajl/test/cases/isolated_surrogate_marker.json deleted file mode 100644 index 36959f4..0000000 --- a/flojay/lloyd-yajl/test/cases/isolated_surrogate_marker.json +++ /dev/null @@ -1 +0,0 @@ -"\ud800" diff --git a/flojay/lloyd-yajl/test/cases/isolated_surrogate_marker.json.gold b/flojay/lloyd-yajl/test/cases/isolated_surrogate_marker.json.gold deleted file mode 100644 index cca172e..0000000 --- a/flojay/lloyd-yajl/test/cases/isolated_surrogate_marker.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -string: '?' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/leading_zero_in_number.json b/flojay/lloyd-yajl/test/cases/leading_zero_in_number.json deleted file mode 100644 index 959f5ba..0000000 --- a/flojay/lloyd-yajl/test/cases/leading_zero_in_number.json +++ /dev/null @@ -1 +0,0 @@ -{ "bad thing": 01 } diff --git a/flojay/lloyd-yajl/test/cases/leading_zero_in_number.json.gold b/flojay/lloyd-yajl/test/cases/leading_zero_in_number.json.gold deleted file mode 100644 index 1a1580d..0000000 --- a/flojay/lloyd-yajl/test/cases/leading_zero_in_number.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -map open '{' -key: 'bad thing' -integer: 0 -parse error: after key and value, inside map, I expect ',' or '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/lonely_minus_sign.json b/flojay/lloyd-yajl/test/cases/lonely_minus_sign.json deleted file mode 100644 index 85f69bd..0000000 --- a/flojay/lloyd-yajl/test/cases/lonely_minus_sign.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - "foo", true, - true, "blue", - "baby where are you?", "oh boo hoo!", - - -] - diff --git a/flojay/lloyd-yajl/test/cases/lonely_minus_sign.json.gold b/flojay/lloyd-yajl/test/cases/lonely_minus_sign.json.gold deleted file mode 100644 index d15ede9..0000000 --- a/flojay/lloyd-yajl/test/cases/lonely_minus_sign.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -array open '[' -string: 'foo' -bool: true -bool: true -string: 'blue' -string: 'baby where are you?' -string: 'oh boo hoo!' -lexical error: malformed number, a digit is required after the minus sign. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/lonely_number.json b/flojay/lloyd-yajl/test/cases/lonely_number.json deleted file mode 100644 index e2e107a..0000000 --- a/flojay/lloyd-yajl/test/cases/lonely_number.json +++ /dev/null @@ -1 +0,0 @@ -123456789 \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/lonely_number.json.gold b/flojay/lloyd-yajl/test/cases/lonely_number.json.gold deleted file mode 100644 index 181fdfa..0000000 --- a/flojay/lloyd-yajl/test/cases/lonely_number.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -integer: 123456789 -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/low_overflow.json b/flojay/lloyd-yajl/test/cases/low_overflow.json deleted file mode 100644 index 9af921b..0000000 --- a/flojay/lloyd-yajl/test/cases/low_overflow.json +++ /dev/null @@ -1 +0,0 @@ --9223372036854775808 \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/low_overflow.json.gold b/flojay/lloyd-yajl/test/cases/low_overflow.json.gold deleted file mode 100644 index 19c4b77..0000000 --- a/flojay/lloyd-yajl/test/cases/low_overflow.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -parse error: integer overflow -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/map_close.json b/flojay/lloyd-yajl/test/cases/map_close.json deleted file mode 100644 index 5c34318..0000000 --- a/flojay/lloyd-yajl/test/cases/map_close.json +++ /dev/null @@ -1 +0,0 @@ -} diff --git a/flojay/lloyd-yajl/test/cases/map_close.json.gold b/flojay/lloyd-yajl/test/cases/map_close.json.gold deleted file mode 100644 index 972fd39..0000000 --- a/flojay/lloyd-yajl/test/cases/map_close.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -parse error: unallowed token at this point in JSON text -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/missing_integer_after_decimal_point.json b/flojay/lloyd-yajl/test/cases/missing_integer_after_decimal_point.json deleted file mode 100644 index 2369f4b..0000000 --- a/flojay/lloyd-yajl/test/cases/missing_integer_after_decimal_point.json +++ /dev/null @@ -1 +0,0 @@ -10.e2 diff --git a/flojay/lloyd-yajl/test/cases/missing_integer_after_decimal_point.json.gold b/flojay/lloyd-yajl/test/cases/missing_integer_after_decimal_point.json.gold deleted file mode 100644 index c2e7e2e..0000000 --- a/flojay/lloyd-yajl/test/cases/missing_integer_after_decimal_point.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: malformed number, a digit is required after the decimal point. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/missing_integer_after_exponent.json b/flojay/lloyd-yajl/test/cases/missing_integer_after_exponent.json deleted file mode 100644 index a62b45d..0000000 --- a/flojay/lloyd-yajl/test/cases/missing_integer_after_exponent.json +++ /dev/null @@ -1 +0,0 @@ -10e diff --git a/flojay/lloyd-yajl/test/cases/missing_integer_after_exponent.json.gold b/flojay/lloyd-yajl/test/cases/missing_integer_after_exponent.json.gold deleted file mode 100644 index 5089681..0000000 --- a/flojay/lloyd-yajl/test/cases/missing_integer_after_exponent.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: malformed number, a digit is required after the exponent. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/multiple.json b/flojay/lloyd-yajl/test/cases/multiple.json deleted file mode 100644 index b573db0..0000000 --- a/flojay/lloyd-yajl/test/cases/multiple.json +++ /dev/null @@ -1,3 +0,0 @@ - -{} -{} diff --git a/flojay/lloyd-yajl/test/cases/multiple.json.gold b/flojay/lloyd-yajl/test/cases/multiple.json.gold deleted file mode 100644 index 0f6f3df..0000000 --- a/flojay/lloyd-yajl/test/cases/multiple.json.gold +++ /dev/null @@ -1,4 +0,0 @@ -map open '{' -map close '}' -parse error: trailing garbage -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/non_utf8_char_in_string.json b/flojay/lloyd-yajl/test/cases/non_utf8_char_in_string.json deleted file mode 100644 index 253a664..0000000 --- a/flojay/lloyd-yajl/test/cases/non_utf8_char_in_string.json +++ /dev/null @@ -1 +0,0 @@ -{"CoreletAPIVersion":2,"CoreletType":"standalone","documentation":"A corelet that provides the capability to upload a folders contents into a users locker.","functions":[{"documentation":"Displays a dialog box that allows user to select a folder on the local system.","name":"ShowBrowseDialog","parameters":[{"documentation":"The callback function for results.","name":"callback","required":true,"type":"callback"}]},{"documentation":"Uploads all mp3 files in the folder provided.","name":"UploadFolder","parameters":[{"documentation":"The path to upload mp3 files from.","name":"path","required":true,"type":"string"},{"documentation":"The callback function for progress.","name":"callback","required":true,"type":"callback"}]},{"documentation":"Returns the server name to the current locker service.","name":"GetLockerService","parameters":[]},{"documentation":"Changes the name of the locker service.","name":"SetLockerService","parameters":[{"documentation":"The value of the locker service to set active.","name":"LockerService","required":true,"type":"string"}]},{"documentation":"Downloads locker files to the suggested folder.","name":"DownloadFile","parameters":[{"documentation":"The origin path of the locker file.","name":"path","required":true,"type":"string"},{"documentation":"The Window destination path of the locker file.","name":"destination","required":true,"type":"integer"},{"documentation":"The callback function for progress.","name":"callback","required":true,"type":"callback"}]}],"name":"LockerUploader","version":{"major":0,"micro":1,"minor":0},"versionString":"0.0.1"} \ No newline at end of file diff --git a/flojay/lloyd-yajl/test/cases/non_utf8_char_in_string.json.gold b/flojay/lloyd-yajl/test/cases/non_utf8_char_in_string.json.gold deleted file mode 100644 index 5e3c580..0000000 --- a/flojay/lloyd-yajl/test/cases/non_utf8_char_in_string.json.gold +++ /dev/null @@ -1,8 +0,0 @@ -map open '{' -key: 'CoreletAPIVersion' -integer: 2 -key: 'CoreletType' -string: 'standalone' -key: 'documentation' -lexical error: invalid bytes in UTF8 string. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/np_partial_bad.json b/flojay/lloyd-yajl/test/cases/np_partial_bad.json deleted file mode 100644 index 2fbd027..0000000 --- a/flojay/lloyd-yajl/test/cases/np_partial_bad.json +++ /dev/null @@ -1 +0,0 @@ -[ "foo", "bar" diff --git a/flojay/lloyd-yajl/test/cases/np_partial_bad.json.gold b/flojay/lloyd-yajl/test/cases/np_partial_bad.json.gold deleted file mode 100644 index b981bda..0000000 --- a/flojay/lloyd-yajl/test/cases/np_partial_bad.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -array open '[' -string: 'foo' -string: 'bar' -parse error: premature EOF -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/null.json b/flojay/lloyd-yajl/test/cases/null.json deleted file mode 100644 index 19765bd..0000000 --- a/flojay/lloyd-yajl/test/cases/null.json +++ /dev/null @@ -1 +0,0 @@ -null diff --git a/flojay/lloyd-yajl/test/cases/null.json.gold b/flojay/lloyd-yajl/test/cases/null.json.gold deleted file mode 100644 index 94ad0fa..0000000 --- a/flojay/lloyd-yajl/test/cases/null.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -null -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/nulls_and_bools.json b/flojay/lloyd-yajl/test/cases/nulls_and_bools.json deleted file mode 100644 index 65eb01f..0000000 --- a/flojay/lloyd-yajl/test/cases/nulls_and_bools.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "boolean, true": true, - "boolean, false": false, - "null": null -} diff --git a/flojay/lloyd-yajl/test/cases/nulls_and_bools.json.gold b/flojay/lloyd-yajl/test/cases/nulls_and_bools.json.gold deleted file mode 100644 index 51f990b..0000000 --- a/flojay/lloyd-yajl/test/cases/nulls_and_bools.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -map open '{' -key: 'boolean, true' -bool: true -key: 'boolean, false' -bool: false -key: 'null' -null -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/simple.json b/flojay/lloyd-yajl/test/cases/simple.json deleted file mode 100644 index 9ed80c9..0000000 --- a/flojay/lloyd-yajl/test/cases/simple.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "this": "is", - "really": "simple", - "json": "right?" -} diff --git a/flojay/lloyd-yajl/test/cases/simple.json.gold b/flojay/lloyd-yajl/test/cases/simple.json.gold deleted file mode 100644 index 80fcad2..0000000 --- a/flojay/lloyd-yajl/test/cases/simple.json.gold +++ /dev/null @@ -1,9 +0,0 @@ -map open '{' -key: 'this' -string: 'is' -key: 'really' -string: 'simple' -key: 'json' -string: 'right?' -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/simple_with_comments.json b/flojay/lloyd-yajl/test/cases/simple_with_comments.json deleted file mode 100644 index 3b79bba..0000000 --- a/flojay/lloyd-yajl/test/cases/simple_with_comments.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "this": "is", // ignore this - "really": "simple", - /* ignore -this -too * / -** // -(/ -******/ - "json": "right?" -} diff --git a/flojay/lloyd-yajl/test/cases/simple_with_comments.json.gold b/flojay/lloyd-yajl/test/cases/simple_with_comments.json.gold deleted file mode 100644 index d222e9b..0000000 --- a/flojay/lloyd-yajl/test/cases/simple_with_comments.json.gold +++ /dev/null @@ -1,5 +0,0 @@ -map open '{' -key: 'this' -string: 'is' -lexical error: probable comment found in input text, comments are not enabled. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/string_invalid_escape.json b/flojay/lloyd-yajl/test/cases/string_invalid_escape.json deleted file mode 100644 index c554182..0000000 --- a/flojay/lloyd-yajl/test/cases/string_invalid_escape.json +++ /dev/null @@ -1 +0,0 @@ -["\n foo \/ bar \r\f\\\uffff\t\b\"\\ and you can't escape thi\s"] diff --git a/flojay/lloyd-yajl/test/cases/string_invalid_escape.json.gold b/flojay/lloyd-yajl/test/cases/string_invalid_escape.json.gold deleted file mode 100644 index 439df43..0000000 --- a/flojay/lloyd-yajl/test/cases/string_invalid_escape.json.gold +++ /dev/null @@ -1,3 +0,0 @@ -array open '[' -lexical error: inside a string, '\' occurs before a character which it may not. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/string_invalid_hex_char.json b/flojay/lloyd-yajl/test/cases/string_invalid_hex_char.json deleted file mode 100644 index bde7ee9..0000000 --- a/flojay/lloyd-yajl/test/cases/string_invalid_hex_char.json +++ /dev/null @@ -1 +0,0 @@ -"foo foo, blah blah \u0123 \u4567 \u89ab \uc/ef \uABCD \uEFFE bar baz bing" diff --git a/flojay/lloyd-yajl/test/cases/string_invalid_hex_char.json.gold b/flojay/lloyd-yajl/test/cases/string_invalid_hex_char.json.gold deleted file mode 100644 index 8498792..0000000 --- a/flojay/lloyd-yajl/test/cases/string_invalid_hex_char.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: invalid (non-hex) character occurs after '\u' inside string. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/string_with_escapes.json b/flojay/lloyd-yajl/test/cases/string_with_escapes.json deleted file mode 100644 index 59cc940..0000000 --- a/flojay/lloyd-yajl/test/cases/string_with_escapes.json +++ /dev/null @@ -1,3 +0,0 @@ -["\n foo \/ bar \r\f\\\uffff\t\b\"\\", - "\"and this string has an escape at the beginning", - "and this string has no escapes" ] diff --git a/flojay/lloyd-yajl/test/cases/string_with_escapes.json.gold b/flojay/lloyd-yajl/test/cases/string_with_escapes.json.gold deleted file mode 100644 index 086a9dc..0000000 --- a/flojay/lloyd-yajl/test/cases/string_with_escapes.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -array open '[' -string: ' - foo / bar \￿ "\' -string: '"and this string has an escape at the beginning' -string: 'and this string has no escapes' -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/string_with_invalid_newline.json b/flojay/lloyd-yajl/test/cases/string_with_invalid_newline.json deleted file mode 100644 index 0e3ea0d..0000000 --- a/flojay/lloyd-yajl/test/cases/string_with_invalid_newline.json +++ /dev/null @@ -1,2 +0,0 @@ -"la di dah. this is a string, and I can do this, \n, but not this -" diff --git a/flojay/lloyd-yajl/test/cases/string_with_invalid_newline.json.gold b/flojay/lloyd-yajl/test/cases/string_with_invalid_newline.json.gold deleted file mode 100644 index c38bdef..0000000 --- a/flojay/lloyd-yajl/test/cases/string_with_invalid_newline.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -lexical error: invalid character inside string. -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/three_byte_utf8.json b/flojay/lloyd-yajl/test/cases/three_byte_utf8.json deleted file mode 100644 index 9c9e656..0000000 --- a/flojay/lloyd-yajl/test/cases/three_byte_utf8.json +++ /dev/null @@ -1 +0,0 @@ -{"matzue": "松江", "asakusa": "浅草"} diff --git a/flojay/lloyd-yajl/test/cases/three_byte_utf8.json.gold b/flojay/lloyd-yajl/test/cases/three_byte_utf8.json.gold deleted file mode 100644 index 7d95fae..0000000 --- a/flojay/lloyd-yajl/test/cases/three_byte_utf8.json.gold +++ /dev/null @@ -1,7 +0,0 @@ -map open '{' -key: 'matzue' -string: '松江' -key: 'asakusa' -string: '浅草' -map close '}' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/true.json b/flojay/lloyd-yajl/test/cases/true.json deleted file mode 100644 index 27ba77d..0000000 --- a/flojay/lloyd-yajl/test/cases/true.json +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/flojay/lloyd-yajl/test/cases/true.json.gold b/flojay/lloyd-yajl/test/cases/true.json.gold deleted file mode 100644 index 0858bf7..0000000 --- a/flojay/lloyd-yajl/test/cases/true.json.gold +++ /dev/null @@ -1,2 +0,0 @@ -bool: true -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/unescaped_bulgarian.json b/flojay/lloyd-yajl/test/cases/unescaped_bulgarian.json deleted file mode 100644 index f9a70a6..0000000 --- a/flojay/lloyd-yajl/test/cases/unescaped_bulgarian.json +++ /dev/null @@ -1 +0,0 @@ -["Да Му Еба Майката"] diff --git a/flojay/lloyd-yajl/test/cases/unescaped_bulgarian.json.gold b/flojay/lloyd-yajl/test/cases/unescaped_bulgarian.json.gold deleted file mode 100644 index 8db076e..0000000 --- a/flojay/lloyd-yajl/test/cases/unescaped_bulgarian.json.gold +++ /dev/null @@ -1,4 +0,0 @@ -array open '[' -string: 'Да Му Еба Майката' -array close ']' -memory leaks: 0 diff --git a/flojay/lloyd-yajl/test/cases/zerobyte.json b/flojay/lloyd-yajl/test/cases/zerobyte.json deleted file mode 100644 index 09c5044..0000000 --- a/flojay/lloyd-yajl/test/cases/zerobyte.json +++ /dev/null @@ -1 +0,0 @@ -"\u0000" diff --git a/flojay/lloyd-yajl/test/cases/zerobyte.json.gold b/flojay/lloyd-yajl/test/cases/zerobyte.json.gold deleted file mode 100644 index b0c58fc..0000000 Binary files a/flojay/lloyd-yajl/test/cases/zerobyte.json.gold and /dev/null differ diff --git a/flojay/lloyd-yajl/test/run_tests.sh b/flojay/lloyd-yajl/test/run_tests.sh deleted file mode 100755 index 55a665b..0000000 --- a/flojay/lloyd-yajl/test/run_tests.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh - -ECHO=`which echo` - -DIFF_FLAGS="-u" -case "$(uname)" in - *W32*) - DIFF_FLAGS="-wu" - ;; -esac - -if [ -z "$testBin" ]; then - testBin="$1" -fi - -# find test binary on both platforms. allow the caller to force a -# particular test binary (useful for non-cmake build systems). -if [ -z "$testBin" ]; then - testBin="../build/test/Release/yajl_test.exe" - if [ ! -x $testBin ] ; then - testBin="../build/test/Debug/yajl_test.exe" - if [ ! -x $testBin ] ; then - testBin="../build/test/yajl_test" - if [ ! -x $testBin ] ; then - ${ECHO} "cannot execute test binary: '$testBin'" - exit 1; - fi - fi - fi -fi - -${ECHO} "using test binary: $testBin" - -testBinShort=`basename $testBin` - -testsSucceeded=0 -testsTotal=0 - -for file in cases/*.json ; do - allowComments="" - allowGarbage="" - allowMultiple="" - allowPartials="" - - # if the filename starts with dc_, we disallow comments for this test - case $(basename $file) in - ac_*) - allowComments="-c " - ;; - ag_*) - allowGarbage="-g " - ;; - am_*) - allowMultiple="-m "; - ;; - ap_*) - allowPartials="-p "; - ;; - esac - fileShort=`basename $file` - testName=`echo $fileShort | sed -e 's/\.json$//'` - - ${ECHO} -n " test ($testName): " - iter=1 - success="SUCCESS" - - # ${ECHO} -n "$testBinShort $allowPartials$allowComments$allowGarbage$allowMultiple-b $iter < $fileShort > ${fileShort}.test : " - # parse with a read buffer size ranging from 1-31 to stress stream parsing - while [ $iter -lt 32 ] && [ $success = "SUCCESS" ] ; do - $testBin $allowPartials $allowComments $allowGarbage $allowMultiple -b $iter < $file > ${file}.test 2>&1 - diff ${DIFF_FLAGS} ${file}.gold ${file}.test > ${file}.out - if [ $? -eq 0 ] ; then - if [ $iter -eq 31 ] ; then : $(( testsSucceeded += 1)) ; fi - else - success="FAILURE" - iter=32 - ${ECHO} - cat ${file}.out - fi - : $(( iter += 1 )) - rm ${file}.test ${file}.out - done - - ${ECHO} $success - : $(( testsTotal += 1 )) -done - -${ECHO} $testsSucceeded/$testsTotal tests successful - -if [ $testsSucceeded != $testsTotal ] ; then - exit 1 -fi - -exit 0 diff --git a/flojay/lloyd-yajl/test/yajl_test.c b/flojay/lloyd-yajl/test/yajl_test.c deleted file mode 100644 index 5c373d0..0000000 --- a/flojay/lloyd-yajl/test/yajl_test.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (c) 2007-2011, Lloyd Hilaiel - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -#include -#include -#include - -#include - -/* memory debugging routines */ -typedef struct -{ - unsigned int numFrees; - unsigned int numMallocs; - /* XXX: we really need a hash table here with per-allocation - * information */ -} yajlTestMemoryContext; - -/* cast void * into context */ -#define TEST_CTX(vptr) ((yajlTestMemoryContext *) (vptr)) - -static void yajlTestFree(void * ctx, void * ptr) -{ - assert(ptr != NULL); - TEST_CTX(ctx)->numFrees++; - free(ptr); -} - -static void * yajlTestMalloc(void * ctx, size_t sz) -{ - assert(sz != 0); - TEST_CTX(ctx)->numMallocs++; - return malloc(sz); -} - -static void * yajlTestRealloc(void * ctx, void * ptr, size_t sz) -{ - if (ptr == NULL) { - assert(sz != 0); - TEST_CTX(ctx)->numMallocs++; - } else if (sz == 0) { - TEST_CTX(ctx)->numFrees++; - } - - return realloc(ptr, sz); -} - - -/* begin parsing callback routines */ -#define BUF_SIZE 2048 - -static int test_yajl_null(void *ctx) -{ - printf("null\n"); - return 1; -} - -static int test_yajl_boolean(void * ctx, int boolVal) -{ - printf("bool: %s\n", boolVal ? "true" : "false"); - return 1; -} - -static int test_yajl_integer(void *ctx, long long integerVal) -{ - printf("integer: %lld\n", integerVal); - return 1; -} - -static int test_yajl_double(void *ctx, double doubleVal) -{ - printf("double: %g\n", doubleVal); - return 1; -} - -static int test_yajl_string(void *ctx, const unsigned char * stringVal, - size_t stringLen) -{ - printf("string: '"); - fwrite(stringVal, 1, stringLen, stdout); - printf("'\n"); - return 1; -} - -static int test_yajl_map_key(void *ctx, const unsigned char * stringVal, - size_t stringLen) -{ - char * str = (char *) malloc(stringLen + 1); - str[stringLen] = 0; - memcpy(str, stringVal, stringLen); - printf("key: '%s'\n", str); - free(str); - return 1; -} - -static int test_yajl_start_map(void *ctx) -{ - printf("map open '{'\n"); - return 1; -} - - -static int test_yajl_end_map(void *ctx) -{ - printf("map close '}'\n"); - return 1; -} - -static int test_yajl_start_array(void *ctx) -{ - printf("array open '['\n"); - return 1; -} - -static int test_yajl_end_array(void *ctx) -{ - printf("array close ']'\n"); - return 1; -} - -static yajl_callbacks callbacks = { - test_yajl_null, - test_yajl_boolean, - test_yajl_integer, - test_yajl_double, - NULL, - test_yajl_string, - test_yajl_start_map, - test_yajl_map_key, - test_yajl_end_map, - test_yajl_start_array, - test_yajl_end_array -}; - -static void usage(const char * progname) -{ - fprintf(stderr, - "usage: %s [options]\n" - "Parse input from stdin as JSON and ouput parsing details " - "to stdout\n" - " -b set the read buffer size\n" - " -c allow comments\n" - " -g allow *g*arbage after valid JSON text\n" - " -m allows the parser to consume multiple JSON values\n" - " from a single string separated by whitespace\n" - " -p partial JSON documents should not cause errors\n", - progname); - exit(1); -} - -int -main(int argc, char ** argv) -{ - yajl_handle hand; - const char * fileName; - static unsigned char * fileData = NULL; - size_t bufSize = BUF_SIZE; - yajl_status stat; - size_t rd; - int i, j; - - /* memory allocation debugging: allocate a structure which collects - * statistics */ - yajlTestMemoryContext memCtx = { 0,0 }; - - /* memory allocation debugging: allocate a structure which holds - * allocation routines */ - yajl_alloc_funcs allocFuncs = { - yajlTestMalloc, - yajlTestRealloc, - yajlTestFree, - (void *) NULL - }; - - allocFuncs.ctx = (void *) &memCtx; - - /* allocate the parser */ - hand = yajl_alloc(&callbacks, &allocFuncs, NULL); - - /* check arguments. We expect exactly one! */ - for (i=1;i= argc) usage(argv[0]); - - /* validate integer */ - for (j=0;j<(int)strlen(argv[i]);j++) { - if (argv[i][j] <= '9' && argv[i][j] >= '0') continue; - fprintf(stderr, "-b requires an integer argument. '%s' " - "is invalid\n", argv[i]); - usage(argv[0]); - } - - bufSize = atoi(argv[i]); - if (!bufSize) { - fprintf(stderr, "%zu is an invalid buffer size\n", - bufSize); - } - } else if (!strcmp("-g", argv[i])) { - yajl_config(hand, yajl_allow_trailing_garbage, 1); - } else if (!strcmp("-m", argv[i])) { - yajl_config(hand, yajl_allow_multiple_values, 1); - } else if (!strcmp("-p", argv[i])) { - yajl_config(hand, yajl_allow_partial_values, 1); - } else { - fprintf(stderr, "invalid command line option: '%s'\n", - argv[i]); - usage(argv[0]); - } - } - - fileData = (unsigned char *) malloc(bufSize); - - if (fileData == NULL) { - fprintf(stderr, - "failed to allocate read buffer of %zu bytes, exiting.", - bufSize); - yajl_free(hand); - exit(2); - } - - fileName = argv[argc-1]; - - for (;;) { - rd = fread((void *) fileData, 1, bufSize, stdin); - - if (rd == 0) { - if (!feof(stdin)) { - fprintf(stderr, "error reading from '%s'\n", fileName); - } - break; - } - /* read file data, now pass to parser */ - stat = yajl_parse(hand, fileData, rd); - - if (stat != yajl_status_ok) break; - } - - stat = yajl_complete_parse(hand); - if (stat != yajl_status_ok) - { - unsigned char * str = yajl_get_error(hand, 0, fileData, rd); - fflush(stdout); - fprintf(stderr, "%s", (char *) str); - yajl_free_error(hand, str); - } - - yajl_free(hand); - free(fileData); - - /* finally, print out some memory statistics */ - -/* (lth) only print leaks here, as allocations and frees may vary depending - * on read buffer size, causing false failures. - * - * printf("allocations:\t%u\n", memCtx.numMallocs); - * printf("frees:\t\t%u\n", memCtx.numFrees); -*/ - fflush(stderr); - fflush(stdout); - printf("memory leaks:\t%u\n", memCtx.numMallocs - memCtx.numFrees); - - return 0; -} diff --git a/flojay/lloyd-yajl/verify/CMakeLists.txt b/flojay/lloyd-yajl/verify/CMakeLists.txt index 4c296d0..967fca1 100644 --- a/flojay/lloyd-yajl/verify/CMakeLists.txt +++ b/flojay/lloyd-yajl/verify/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2007-2011, Lloyd Hilaiel +# Copyright (c) 2007-2014, Lloyd Hilaiel # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -34,6 +34,4 @@ GET_TARGET_PROPERTY(binPath json_verify LOCATION) ADD_CUSTOM_COMMAND(TARGET json_verify POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${binPath} ${binDir}) -IF (NOT WIN32) - INSTALL(TARGETS json_verify RUNTIME DESTINATION bin) -ENDIF () +INSTALL(TARGETS json_verify RUNTIME DESTINATION bin) diff --git a/flojay/lloyd-yajl/verify/json_verify.c b/flojay/lloyd-yajl/verify/json_verify.c index e01f4fd..01849e0 100644 --- a/flojay/lloyd-yajl/verify/json_verify.c +++ b/flojay/lloyd-yajl/verify/json_verify.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2011, Lloyd Hilaiel + * Copyright (c) 2007-2014, Lloyd Hilaiel * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -25,8 +25,9 @@ usage(const char * progname) { fprintf(stderr, "%s: validate json from stdin\n" "usage: json_verify [options]\n" - " -q quiet mode\n" " -c allow comments\n" + " -q quiet mode\n" + " -s verify a stream of multiple json entities\n" " -u allow invalid utf8 inside strings\n", progname); exit(1); @@ -60,6 +61,9 @@ main(int argc, char ** argv) case 'u': yajl_config(hand, yajl_dont_validate_strings, 1); break; + case 's': + yajl_config(hand, yajl_allow_multiple_values, 1); + break; default: fprintf(stderr, "unrecognized option: '%c'\n\n", argv[a][i]); usage(argv[0]); diff --git a/setup.py b/setup.py index 6b3a7ad..7152227 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,42 @@ #!/usr/bin/env python from setuptools import setup, Extension -yajl_sources = ['flojay/lloyd-yajl/src/' + file_ for file_ in \ - ('yajl.c', 'yajl_gen.c', 'yajl_alloc.c', 'yajl_lex.c', 'yajl_tree.c', \ - 'yajl_encode.c', 'yajl_version.c', 'yajl_buf.c', 'yajl_parser.c')] +YAJL_SOURCE_DIR = 'flojay/lloyd-yajl/src' -flojay = Extension('flojay', - define_macros=[ - ('MAJOR_VERSION', '0'), - ('MINOR_VERSION', '1')], - extra_compile_args=['--std=c99'], - include_dirs=['flojay/lloyd-yajl/src'], - sources=yajl_sources + ['flojay/flojay.c']) +def yajl_sources(): + source_files = ( + 'yajl.c', + 'yajl_gen.c', + 'yajl_alloc.c', + 'yajl_lex.c', + 'yajl_tree.c', + 'yajl_encode.c', + 'yajl_version.c', + 'yajl_buf.c', + 'yajl_parser.c' + ) + return ['{}/{}'.format(YAJL_SOURCE_DIR, f) for f in source_files] +flojay_extension = Extension( + 'flojay', + define_macros=[ + ('MAJOR_VERSION', '0'), + ('MINOR_VERSION', '2') + ], + extra_compile_args=['--std=c99'], + include_dirs=[YAJL_SOURCE_DIR], + sources=['flojay/flojay.c'] + yajl_sources(), +) -setup(name='flojay', - version='0.1', - description='Streaming or event-based JSON parser based on yajl', - author='Robert Church', - author_email='rchurch@myemma.com', - url='', - ext_modules=[flojay], - packages=['flojay'], - install_requires=[ - 'nose==1.1.2', - ]) +setup( + name='flojay', + version='0.2', + description='Streaming and event-based JSON parser based on yajl', + author='Robert Church', + author_email='rchurch@myemma.com', + url="http://github/myemma/flojay", + ext_modules=[flojay_extension], + packages=['flojay'], + install_requires=['nose==1.1.2'], + keywords=["json", "stream"], +)