diff options
Diffstat (limited to 'MoonParser/pegtl/contrib/json.hpp')
-rw-r--r-- | MoonParser/pegtl/contrib/json.hpp | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/MoonParser/pegtl/contrib/json.hpp b/MoonParser/pegtl/contrib/json.hpp deleted file mode 100644 index 688f607..0000000 --- a/MoonParser/pegtl/contrib/json.hpp +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | // Copyright (c) 2014-2017 Dr. Colin Hirsch and Daniel Frey | ||
2 | // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/ | ||
3 | |||
4 | #ifndef TAOCPP_PEGTL_INCLUDE_CONTRIB_JSON_HPP | ||
5 | #define TAOCPP_PEGTL_INCLUDE_CONTRIB_JSON_HPP | ||
6 | |||
7 | #include "../ascii.hpp" | ||
8 | #include "../config.hpp" | ||
9 | #include "../rules.hpp" | ||
10 | #include "../utf8.hpp" | ||
11 | |||
12 | #include "abnf.hpp" | ||
13 | |||
14 | namespace tao | ||
15 | { | ||
16 | namespace TAOCPP_PEGTL_NAMESPACE | ||
17 | { | ||
18 | namespace json | ||
19 | { | ||
20 | // JSON grammar according to RFC 7159 (for UTF-8 encoded JSON only). | ||
21 | |||
22 | // clang-format off | ||
23 | struct ws : one< ' ', '\t', '\n', '\r' > {}; | ||
24 | |||
25 | template< typename R, typename P = ws > | ||
26 | struct padr : internal::seq< R, internal::star< P > > {}; | ||
27 | |||
28 | struct begin_array : padr< one< '[' > > {}; | ||
29 | struct begin_object : padr< one< '{' > > {}; | ||
30 | struct end_array : one< ']' > {}; | ||
31 | struct end_object : one< '}' > {}; | ||
32 | struct name_separator : pad< one< ':' >, ws > {}; | ||
33 | struct value_separator : padr< one< ',' > > {}; | ||
34 | |||
35 | struct false_ : TAOCPP_PEGTL_STRING( "false" ) {}; | ||
36 | struct null : TAOCPP_PEGTL_STRING( "null" ) {}; | ||
37 | struct true_ : TAOCPP_PEGTL_STRING( "true" ) {}; | ||
38 | |||
39 | struct digits : plus< abnf::DIGIT > {}; | ||
40 | struct exp : seq< one< 'e', 'E' >, opt< one< '-', '+'> >, must< digits > > {}; | ||
41 | struct frac : if_must< one< '.' >, digits > {}; | ||
42 | struct int_ : sor< one< '0' >, digits > {}; | ||
43 | struct number : seq< opt< one< '-' > >, int_, opt< frac >, opt< exp > > {}; | ||
44 | |||
45 | struct xdigit : abnf::HEXDIG {}; | ||
46 | struct unicode : list< seq< one< 'u' >, rep< 4, must< xdigit > > >, one< '\\' > > {}; | ||
47 | struct escaped_char : one< '"', '\\', '/', 'b', 'f', 'n', 'r', 't' > {}; | ||
48 | struct escaped : sor< escaped_char, unicode > {}; | ||
49 | struct unescaped : utf8::range< 0x20, 0x10FFFF > {}; | ||
50 | struct char_ : if_then_else< one< '\\' >, must< escaped >, unescaped > {}; | ||
51 | |||
52 | struct string_content : until< at< one< '"' > >, must< char_ > > {}; | ||
53 | struct string : seq< one< '"' >, must< string_content >, any > | ||
54 | { | ||
55 | using content = string_content; | ||
56 | }; | ||
57 | |||
58 | struct key_content : until< at< one< '"' > >, must< char_ > > {}; | ||
59 | struct key : seq< one< '"' >, must< key_content >, any > | ||
60 | { | ||
61 | using content = key_content; | ||
62 | }; | ||
63 | |||
64 | struct value; | ||
65 | |||
66 | struct array_element; | ||
67 | struct array_content : opt< list_must< array_element, value_separator > > {}; | ||
68 | struct array : seq< begin_array, array_content, must< end_array > > | ||
69 | { | ||
70 | using begin = begin_array; | ||
71 | using end = end_array; | ||
72 | using element = array_element; | ||
73 | using content = array_content; | ||
74 | }; | ||
75 | |||
76 | struct member : if_must< key, name_separator, value > {}; | ||
77 | struct object_content : opt< list_must< member, value_separator > > {}; | ||
78 | struct object : seq< begin_object, object_content, must< end_object > > | ||
79 | { | ||
80 | using begin = begin_object; | ||
81 | using end = end_object; | ||
82 | using element = member; | ||
83 | using content = object_content; | ||
84 | }; | ||
85 | |||
86 | struct value : padr< sor< string, number, object, array, false_, true_, null > > {}; | ||
87 | struct array_element : seq< value > {}; | ||
88 | |||
89 | struct text : seq< star< ws >, value > {}; | ||
90 | // clang-format on | ||
91 | |||
92 | } // namespace json | ||
93 | |||
94 | } // namespace TAOCPP_PEGTL_NAMESPACE | ||
95 | |||
96 | } // namespace tao | ||
97 | |||
98 | #endif | ||