You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

json_tokener.h 2.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * $Id: json_tokener.h,v 1.6 2005/06/14 22:41:51 mclark Exp $
  3. *
  4. * Copyright Metaparadigm Pte. Ltd. 2004.
  5. * Michael Clark <michael@metaparadigm.com>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public (LGPL)
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details: http://www.gnu.org/
  16. *
  17. */
  18. #ifndef _json_tokener_h_
  19. #define _json_tokener_h_
  20. #include "config.h"
  21. #include "json_object.h"
  22. enum json_tokener_error {
  23. json_tokener_success,
  24. json_tokener_error_parse_unexpected,
  25. json_tokener_error_parse_null,
  26. json_tokener_error_parse_boolean,
  27. json_tokener_error_parse_number,
  28. json_tokener_error_parse_array,
  29. json_tokener_error_parse_object,
  30. json_tokener_error_parse_string,
  31. json_tokener_error_parse_comment,
  32. json_tokener_error_parse_eof,
  33. };
  34. enum json_tokener_state {
  35. json_tokener_state_eatws,
  36. json_tokener_state_start,
  37. json_tokener_state_finish,
  38. json_tokener_state_null,
  39. json_tokener_state_comment_start,
  40. json_tokener_state_comment,
  41. json_tokener_state_comment_eol,
  42. json_tokener_state_comment_end,
  43. json_tokener_state_string,
  44. json_tokener_state_string_escape,
  45. json_tokener_state_escape_unicode,
  46. json_tokener_state_boolean,
  47. json_tokener_state_number,
  48. json_tokener_state_array,
  49. json_tokener_state_array_sep,
  50. json_tokener_state_object,
  51. json_tokener_state_object_field_start,
  52. json_tokener_state_object_field,
  53. json_tokener_state_object_field_end,
  54. json_tokener_state_object_value,
  55. json_tokener_state_object_sep,
  56. };
  57. struct json_tokener
  58. {
  59. char *source;
  60. int pos;
  61. struct printbuf *pb;
  62. };
  63. #if !HAVE_STRNCASECMP && defined(_MSC_VER)
  64. /* MSC has the version as _strnicmp */
  65. # define strncasecmp _strnicmp
  66. #elif !HAVE_STRNCASECMP
  67. # error You do not have strncasecmp on your system.
  68. #endif /* HAVE_STRNCASECMP */
  69. #if !HAVE_STRNDUP
  70. char* strndup(const char* str, size_t n);
  71. #endif /* !HAVE_STRNDUP */
  72. extern struct json_object* json_tokener_parse(char *s);
  73. #endif

No Description

Contributors (1)