Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
fbf7cb84
Commit
fbf7cb84
authored
Nov 08, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил команду update-json
parent
8e133a62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
395 additions
and
222 deletions
+395
-222
Makefile.am
include/Makefile.am
+3
-0
json.hpp
include/json.hpp
+392
-222
No files found.
include/Makefile.am
View file @
fbf7cb84
...
@@ -11,5 +11,8 @@ devel_includedir = $(pkgincludedir)
...
@@ -11,5 +11,8 @@ devel_includedir = $(pkgincludedir)
all-local
:
all-local
:
test
-L
extensions
||
ln
-s
../extensions/include extensions
test
-L
extensions
||
ln
-s
../extensions/include extensions
update-json
:
wget
-O
$(top_builddir)
/include/json.hpp https://github.com/nlohmann/json/raw/master/src/json.hpp
include
$(top_builddir)/include.mk
include
$(top_builddir)/include.mk
include/json.hpp
View file @
fbf7cb84
/*
/*
__ _____ _____ _____
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
__| | __| | | | JSON for Modern C++
| | |__ | | | | | | version 2.0.
6
| | |__ | | | | | | version 2.0.
7
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
...
@@ -29,32 +29,32 @@ SOFTWARE.
...
@@ -29,32 +29,32 @@ SOFTWARE.
#ifndef NLOHMANN_JSON_HPP
#ifndef NLOHMANN_JSON_HPP
#define NLOHMANN_JSON_HPP
#define NLOHMANN_JSON_HPP
#include <algorithm>
#include <algorithm>
// all_of, for_each, transform
#include <array>
#include <array>
// array
#include <cassert>
#include <cassert>
// assert
#include <cctype>
#include <cctype>
// isdigit
#include <ciso646>
#include <ciso646>
// and, not, or
#include <cmath>
#include <cmath>
// isfinite, signbit
#include <cstddef>
#include <cstddef>
// nullptr_t, ptrdiff_t, size_t
#include <cstdint>
#include <cstdint>
// int64_t, uint64_t
#include <cstdlib>
#include <cstdlib>
// strtod, strtof, strtold, strtoul
#include <cstring>
#include <cstring>
// strlen
#include <functional>
#include <functional>
// function, hash, less
#include <initializer_list>
#include <initializer_list>
// initializer_list
#include <iomanip>
#include <iomanip>
// setw
#include <iostream>
#include <iostream>
// istream, ostream
#include <iterator>
#include <iterator>
// advance, begin, bidirectional_iterator_tag, distance, end, inserter, iterator, iterator_traits, next, random_access_iterator_tag, reverse_iterator
#include <limits>
#include <limits>
// numeric_limits
#include <locale>
#include <locale>
// locale, numpunct
#include <map>
#include <map>
// map
#include <memory>
#include <memory>
// addressof, allocator, allocator_traits, unique_ptr
#include <numeric>
#include <numeric>
// accumulate
#include <sstream>
#include <sstream>
// stringstream
#include <stdexcept>
#include <stdexcept>
// domain_error, invalid_argument, out_of_range
#include <string>
#include <string>
// getline, stoi, string, to_string
#include <type_traits>
#include <type_traits>
// add_pointer, enable_if, is_arithmetic, is_base_of, is_const, is_constructible, is_convertible, is_floating_point, is_integral, is_nothrow_move_assignable, std::is_nothrow_move_constructible, std::is_pointer, std::is_reference, std::is_same, remove_const, remove_pointer, remove_reference
#include <utility>
#include <utility>
// declval, forward, make_pair, move, pair, swap
#include <vector>
#include <vector>
// vector
// exclude unsupported compilers
// exclude unsupported compilers
#if defined(__clang__)
#if defined(__clang__)
...
@@ -7620,6 +7620,14 @@ class basic_json
...
@@ -7620,6 +7620,14 @@ class basic_json
{
{
// fill buffer
// fill buffer
fill_line_buffer
();
fill_line_buffer
();
// skip UTF-8 byte-order mark
if
(
m_line_buffer
.
size
()
>=
3
and
m_line_buffer
.
substr
(
0
,
3
)
==
"
\xEF\xBB\xBF
"
)
{
m_line_buffer
[
0
]
=
' '
;
m_line_buffer
[
1
]
=
' '
;
m_line_buffer
[
2
]
=
' '
;
}
}
}
// switch off unwanted functions (due to pointer members)
// switch off unwanted functions (due to pointer members)
...
@@ -7809,33 +7817,33 @@ class basic_json
...
@@ -7809,33 +7817,33 @@ class basic_json
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
128
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
};
};
if
((
m_limit
-
m_cursor
)
<
5
)
if
((
m_limit
-
m_cursor
)
<
5
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
5
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yybm
[
0
+
yych
]
&
32
)
if
(
yybm
[
0
+
yych
]
&
32
)
{
{
goto
basic_json_parser_6
;
goto
basic_json_parser_6
;
}
}
if
(
yych
<=
'
\\
'
)
if
(
yych
<=
'
[
'
)
{
{
if
(
yych
<=
'-'
)
if
(
yych
<=
'-'
)
{
{
...
@@ -7884,62 +7892,58 @@ class basic_json
...
@@ -7884,62 +7892,58 @@ class basic_json
{
{
goto
basic_json_parser_17
;
goto
basic_json_parser_17
;
}
}
if
(
yych
==
'[
'
)
if
(
yych
<=
'Z
'
)
{
{
goto
basic_json_parser_
19
;
goto
basic_json_parser_
4
;
}
}
goto
basic_json_parser_
4
;
goto
basic_json_parser_
19
;
}
}
}
}
}
}
else
else
{
{
if
(
yych
<=
'
t
'
)
if
(
yych
<=
'
n
'
)
{
{
if
(
yych
<=
'
f
'
)
if
(
yych
<=
'
e
'
)
{
{
if
(
yych
<
=
']'
)
if
(
yych
=
=
']'
)
{
{
goto
basic_json_parser_21
;
goto
basic_json_parser_21
;
}
}
if
(
yych
<=
'e'
)
goto
basic_json_parser_4
;
{
goto
basic_json_parser_4
;
}
goto
basic_json_parser_23
;
}
}
else
else
{
{
if
(
yych
==
'n
'
)
if
(
yych
<=
'f
'
)
{
{
goto
basic_json_parser_2
4
;
goto
basic_json_parser_2
3
;
}
}
if
(
yych
<=
'
s
'
)
if
(
yych
<=
'
m
'
)
{
{
goto
basic_json_parser_4
;
goto
basic_json_parser_4
;
}
}
goto
basic_json_parser_2
5
;
goto
basic_json_parser_2
4
;
}
}
}
}
else
else
{
{
if
(
yych
<=
'
|
'
)
if
(
yych
<=
'
z
'
)
{
{
if
(
yych
==
'
{
'
)
if
(
yych
==
'
t
'
)
{
{
goto
basic_json_parser_2
6
;
goto
basic_json_parser_2
5
;
}
}
goto
basic_json_parser_4
;
goto
basic_json_parser_4
;
}
}
else
else
{
{
if
(
yych
<=
'
}
'
)
if
(
yych
<=
'
{
'
)
{
{
goto
basic_json_parser_2
8
;
goto
basic_json_parser_2
6
;
}
}
if
(
yych
==
0xEF
)
if
(
yych
==
'}'
)
{
{
goto
basic_json_parser_
30
;
goto
basic_json_parser_
28
;
}
}
goto
basic_json_parser_4
;
goto
basic_json_parser_4
;
}
}
...
@@ -7962,7 +7966,7 @@ basic_json_parser_6:
...
@@ -7962,7 +7966,7 @@ basic_json_parser_6:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yybm
[
0
+
yych
]
&
32
)
if
(
yybm
[
0
+
yych
]
&
32
)
...
@@ -7979,7 +7983,19 @@ basic_json_parser_9:
...
@@ -7979,7 +7983,19 @@ basic_json_parser_9:
{
{
goto
basic_json_parser_5
;
goto
basic_json_parser_5
;
}
}
goto
basic_json_parser_32
;
if
(
yych
<=
0x7F
)
{
goto
basic_json_parser_31
;
}
if
(
yych
<=
0xC1
)
{
goto
basic_json_parser_5
;
}
if
(
yych
<=
0xF4
)
{
goto
basic_json_parser_31
;
}
goto
basic_json_parser_5
;
basic_json_parser_10
:
basic_json_parser_10
:
++
m_cursor
;
++
m_cursor
;
{
{
...
@@ -8008,18 +8024,18 @@ basic_json_parser_13:
...
@@ -8008,18 +8024,18 @@ basic_json_parser_13:
{
{
if
(
yych
==
'.'
)
if
(
yych
==
'.'
)
{
{
goto
basic_json_parser_
37
;
goto
basic_json_parser_
43
;
}
}
}
}
else
else
{
{
if
(
yych
<=
'E'
)
if
(
yych
<=
'E'
)
{
{
goto
basic_json_parser_
38
;
goto
basic_json_parser_
44
;
}
}
if
(
yych
==
'e'
)
if
(
yych
==
'e'
)
{
{
goto
basic_json_parser_
38
;
goto
basic_json_parser_
44
;
}
}
}
}
basic_json_parser_14
:
basic_json_parser_14
:
...
@@ -8032,7 +8048,7 @@ basic_json_parser_15:
...
@@ -8032,7 +8048,7 @@ basic_json_parser_15:
m_marker
=
++
m_cursor
;
m_marker
=
++
m_cursor
;
if
((
m_limit
-
m_cursor
)
<
3
)
if
((
m_limit
-
m_cursor
)
<
3
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
3
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yybm
[
0
+
yych
]
&
64
)
if
(
yybm
[
0
+
yych
]
&
64
)
...
@@ -8043,7 +8059,7 @@ basic_json_parser_15:
...
@@ -8043,7 +8059,7 @@ basic_json_parser_15:
{
{
if
(
yych
==
'.'
)
if
(
yych
==
'.'
)
{
{
goto
basic_json_parser_
37
;
goto
basic_json_parser_
43
;
}
}
goto
basic_json_parser_14
;
goto
basic_json_parser_14
;
}
}
...
@@ -8051,11 +8067,11 @@ basic_json_parser_15:
...
@@ -8051,11 +8067,11 @@ basic_json_parser_15:
{
{
if
(
yych
<=
'E'
)
if
(
yych
<=
'E'
)
{
{
goto
basic_json_parser_
38
;
goto
basic_json_parser_
44
;
}
}
if
(
yych
==
'e'
)
if
(
yych
==
'e'
)
{
{
goto
basic_json_parser_
38
;
goto
basic_json_parser_
44
;
}
}
goto
basic_json_parser_14
;
goto
basic_json_parser_14
;
}
}
...
@@ -8082,7 +8098,7 @@ basic_json_parser_23:
...
@@ -8082,7 +8098,7 @@ basic_json_parser_23:
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
==
'a'
)
if
(
yych
==
'a'
)
{
{
goto
basic_json_parser_
39
;
goto
basic_json_parser_
45
;
}
}
goto
basic_json_parser_5
;
goto
basic_json_parser_5
;
basic_json_parser_24
:
basic_json_parser_24
:
...
@@ -8090,7 +8106,7 @@ basic_json_parser_24:
...
@@ -8090,7 +8106,7 @@ basic_json_parser_24:
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
==
'u'
)
if
(
yych
==
'u'
)
{
{
goto
basic_json_parser_4
0
;
goto
basic_json_parser_4
6
;
}
}
goto
basic_json_parser_5
;
goto
basic_json_parser_5
;
basic_json_parser_25
:
basic_json_parser_25
:
...
@@ -8098,7 +8114,7 @@ basic_json_parser_25:
...
@@ -8098,7 +8114,7 @@ basic_json_parser_25:
yych
=
*
(
m_marker
=
++
m_cursor
);
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
==
'r'
)
if
(
yych
==
'r'
)
{
{
goto
basic_json_parser_4
1
;
goto
basic_json_parser_4
7
;
}
}
goto
basic_json_parser_5
;
goto
basic_json_parser_5
;
basic_json_parser_26
:
basic_json_parser_26
:
...
@@ -8114,35 +8130,71 @@ basic_json_parser_28:
...
@@ -8114,35 +8130,71 @@ basic_json_parser_28:
break
;
break
;
}
}
basic_json_parser_30
:
basic_json_parser_30
:
yyaccept
=
0
;
yych
=
*
(
m_marker
=
++
m_cursor
);
if
(
yych
==
0xBB
)
{
goto
basic_json_parser_42
;
}
goto
basic_json_parser_5
;
basic_json_parser_31
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
basic_json_parser_3
2
:
basic_json_parser_3
1
:
if
(
yybm
[
0
+
yych
]
&
128
)
if
(
yybm
[
0
+
yych
]
&
128
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
if
(
yych
<=
0x
1F
)
if
(
yych
<=
0x
E0
)
{
{
goto
basic_json_parser_33
;
if
(
yych
<=
'\\'
)
{
if
(
yych
<=
0x1F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
'"'
)
{
goto
basic_json_parser_33
;
}
goto
basic_json_parser_35
;
}
else
{
if
(
yych
<=
0xC1
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0xDF
)
{
goto
basic_json_parser_36
;
}
goto
basic_json_parser_37
;
}
}
}
if
(
yych
<=
'"'
)
else
{
{
goto
basic_json_parser_34
;
if
(
yych
<=
0xEF
)
{
if
(
yych
==
0xED
)
{
goto
basic_json_parser_39
;
}
goto
basic_json_parser_38
;
}
else
{
if
(
yych
<=
0xF0
)
{
goto
basic_json_parser_40
;
}
if
(
yych
<=
0xF3
)
{
goto
basic_json_parser_41
;
}
if
(
yych
<=
0xF4
)
{
goto
basic_json_parser_42
;
}
}
}
}
goto
basic_json_parser_36
;
basic_json_parser_32
:
basic_json_parser_33
:
m_cursor
=
m_marker
;
m_cursor
=
m_marker
;
if
(
yyaccept
==
0
)
if
(
yyaccept
==
0
)
{
{
...
@@ -8152,17 +8204,17 @@ basic_json_parser_33:
...
@@ -8152,17 +8204,17 @@ basic_json_parser_33:
{
{
goto
basic_json_parser_14
;
goto
basic_json_parser_14
;
}
}
basic_json_parser_3
4
:
basic_json_parser_3
3
:
++
m_cursor
;
++
m_cursor
;
{
{
last_token_type
=
token_type
::
value_string
;
last_token_type
=
token_type
::
value_string
;
break
;
break
;
}
}
basic_json_parser_3
6
:
basic_json_parser_3
5
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yych
<=
'e'
)
if
(
yych
<=
'e'
)
...
@@ -8171,13 +8223,13 @@ basic_json_parser_36:
...
@@ -8171,13 +8223,13 @@ basic_json_parser_36:
{
{
if
(
yych
==
'"'
)
if
(
yych
==
'"'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
if
(
yych
<=
'.'
)
if
(
yych
<=
'.'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
else
else
{
{
...
@@ -8185,17 +8237,17 @@ basic_json_parser_36:
...
@@ -8185,17 +8237,17 @@ basic_json_parser_36:
{
{
if
(
yych
<=
'['
)
if
(
yych
<=
'['
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
else
else
{
{
if
(
yych
==
'b'
)
if
(
yych
==
'b'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
}
}
}
}
...
@@ -8205,13 +8257,13 @@ basic_json_parser_36:
...
@@ -8205,13 +8257,13 @@ basic_json_parser_36:
{
{
if
(
yych
<=
'f'
)
if
(
yych
<=
'f'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
if
(
yych
==
'n'
)
if
(
yych
==
'n'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
else
else
{
{
...
@@ -8219,130 +8271,235 @@ basic_json_parser_36:
...
@@ -8219,130 +8271,235 @@ basic_json_parser_36:
{
{
if
(
yych
<=
'r'
)
if
(
yych
<=
'r'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
else
else
{
{
if
(
yych
<=
't'
)
if
(
yych
<=
't'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
if
(
yych
<=
'u'
)
if
(
yych
<=
'u'
)
{
{
goto
basic_json_parser_4
3
;
goto
basic_json_parser_4
8
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
}
}
}
}
basic_json_parser_36
:
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
{
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
yych
=
*
m_cursor
;
if
(
yych
<=
0x7F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0xBF
)
{
goto
basic_json_parser_30
;
}
goto
basic_json_parser_32
;
basic_json_parser_37
:
basic_json_parser_37
:
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
{
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
yych
=
*
m_cursor
;
if
(
yych
<=
0x9F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0xBF
)
{
goto
basic_json_parser_36
;
}
goto
basic_json_parser_32
;
basic_json_parser_38
:
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
{
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
yych
=
*
m_cursor
;
if
(
yych
<=
0x7F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0xBF
)
{
goto
basic_json_parser_36
;
}
goto
basic_json_parser_32
;
basic_json_parser_39
:
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
{
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
yych
=
*
m_cursor
;
if
(
yych
<=
0x7F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0x9F
)
{
goto
basic_json_parser_36
;
}
goto
basic_json_parser_32
;
basic_json_parser_40
:
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
{
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
yych
=
*
m_cursor
;
if
(
yych
<=
0x8F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0xBF
)
{
goto
basic_json_parser_38
;
}
goto
basic_json_parser_32
;
basic_json_parser_41
:
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
{
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
yych
=
*
m_cursor
;
if
(
yych
<=
0x7F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0xBF
)
{
goto
basic_json_parser_38
;
}
goto
basic_json_parser_32
;
basic_json_parser_42
:
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
{
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
yych
=
*
m_cursor
;
if
(
yych
<=
0x7F
)
{
goto
basic_json_parser_32
;
}
if
(
yych
<=
0x8F
)
{
goto
basic_json_parser_38
;
}
goto
basic_json_parser_32
;
basic_json_parser_43
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_4
4
;
goto
basic_json_parser_4
9
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
basic_json_parser_
38
:
basic_json_parser_
44
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
<=
','
)
if
(
yych
<=
','
)
{
{
if
(
yych
==
'+'
)
if
(
yych
==
'+'
)
{
{
goto
basic_json_parser_
46
;
goto
basic_json_parser_
51
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
else
else
{
{
if
(
yych
<=
'-'
)
if
(
yych
<=
'-'
)
{
{
goto
basic_json_parser_
46
;
goto
basic_json_parser_
51
;
}
}
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_
47
;
goto
basic_json_parser_
52
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
basic_json_parser_
39
:
basic_json_parser_
45
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
==
'l'
)
if
(
yych
==
'l'
)
{
{
goto
basic_json_parser_
49
;
goto
basic_json_parser_
54
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
basic_json_parser_4
0
:
basic_json_parser_4
6
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
==
'l'
)
if
(
yych
==
'l'
)
{
{
goto
basic_json_parser_5
0
;
goto
basic_json_parser_5
5
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
basic_json_parser_4
1
:
basic_json_parser_4
7
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
==
'u'
)
if
(
yych
==
'u'
)
{
{
goto
basic_json_parser_51
;
goto
basic_json_parser_56
;
}
goto
basic_json_parser_33
;
basic_json_parser_42
:
yych
=
*++
m_cursor
;
if
(
yych
==
0xBF
)
{
goto
basic_json_parser_52
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
basic_json_parser_4
3
:
basic_json_parser_4
8
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_5
4
;
goto
basic_json_parser_5
7
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
else
else
{
{
if
(
yych
<=
'F'
)
if
(
yych
<=
'F'
)
{
{
goto
basic_json_parser_5
4
;
goto
basic_json_parser_5
7
;
}
}
if
(
yych
<=
'`'
)
if
(
yych
<=
'`'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'f'
)
if
(
yych
<=
'f'
)
{
{
goto
basic_json_parser_5
4
;
goto
basic_json_parser_5
7
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
basic_json_parser_4
4
:
basic_json_parser_4
9
:
yyaccept
=
1
;
yyaccept
=
1
;
m_marker
=
++
m_cursor
;
m_marker
=
++
m_cursor
;
if
((
m_limit
-
m_cursor
)
<
3
)
if
((
m_limit
-
m_cursor
)
<
3
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
3
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yych
<=
'D'
)
if
(
yych
<=
'D'
)
...
@@ -8353,7 +8510,7 @@ basic_json_parser_44:
...
@@ -8353,7 +8510,7 @@ basic_json_parser_44:
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_4
4
;
goto
basic_json_parser_4
9
;
}
}
goto
basic_json_parser_14
;
goto
basic_json_parser_14
;
}
}
...
@@ -8361,29 +8518,29 @@ basic_json_parser_44:
...
@@ -8361,29 +8518,29 @@ basic_json_parser_44:
{
{
if
(
yych
<=
'E'
)
if
(
yych
<=
'E'
)
{
{
goto
basic_json_parser_
38
;
goto
basic_json_parser_
44
;
}
}
if
(
yych
==
'e'
)
if
(
yych
==
'e'
)
{
{
goto
basic_json_parser_
38
;
goto
basic_json_parser_
44
;
}
}
goto
basic_json_parser_14
;
goto
basic_json_parser_14
;
}
}
basic_json_parser_
46
:
basic_json_parser_
51
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
>=
':'
)
if
(
yych
>=
':'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
basic_json_parser_
47
:
basic_json_parser_
52
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
...
@@ -8392,164 +8549,159 @@ basic_json_parser_47:
...
@@ -8392,164 +8549,159 @@ basic_json_parser_47:
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_
47
;
goto
basic_json_parser_
52
;
}
}
goto
basic_json_parser_14
;
goto
basic_json_parser_14
;
basic_json_parser_
49
:
basic_json_parser_
54
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
==
's'
)
if
(
yych
==
's'
)
{
{
goto
basic_json_parser_5
5
;
goto
basic_json_parser_5
8
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
basic_json_parser_5
0
:
basic_json_parser_5
5
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
==
'l'
)
if
(
yych
==
'l'
)
{
{
goto
basic_json_parser_5
6
;
goto
basic_json_parser_5
9
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
basic_json_parser_5
1
:
basic_json_parser_5
6
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
==
'e'
)
if
(
yych
==
'e'
)
{
{
goto
basic_json_parser_58
;
goto
basic_json_parser_61
;
}
goto
basic_json_parser_33
;
basic_json_parser_52
:
++
m_cursor
;
{
continue
;
}
}
basic_json_parser_54
:
goto
basic_json_parser_32
;
basic_json_parser_57
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_6
0
;
goto
basic_json_parser_6
3
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
else
else
{
{
if
(
yych
<=
'F'
)
if
(
yych
<=
'F'
)
{
{
goto
basic_json_parser_6
0
;
goto
basic_json_parser_6
3
;
}
}
if
(
yych
<=
'`'
)
if
(
yych
<=
'`'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'f'
)
if
(
yych
<=
'f'
)
{
{
goto
basic_json_parser_6
0
;
goto
basic_json_parser_6
3
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
basic_json_parser_5
5
:
basic_json_parser_5
8
:
yych
=
*++
m_cursor
;
yych
=
*++
m_cursor
;
if
(
yych
==
'e'
)
if
(
yych
==
'e'
)
{
{
goto
basic_json_parser_6
1
;
goto
basic_json_parser_6
4
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
basic_json_parser_5
6
:
basic_json_parser_5
9
:
++
m_cursor
;
++
m_cursor
;
{
{
last_token_type
=
token_type
::
literal_null
;
last_token_type
=
token_type
::
literal_null
;
break
;
break
;
}
}
basic_json_parser_
58
:
basic_json_parser_
61
:
++
m_cursor
;
++
m_cursor
;
{
{
last_token_type
=
token_type
::
literal_true
;
last_token_type
=
token_type
::
literal_true
;
break
;
break
;
}
}
basic_json_parser_6
0
:
basic_json_parser_6
3
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_6
3
;
goto
basic_json_parser_6
6
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
else
else
{
{
if
(
yych
<=
'F'
)
if
(
yych
<=
'F'
)
{
{
goto
basic_json_parser_6
3
;
goto
basic_json_parser_6
6
;
}
}
if
(
yych
<=
'`'
)
if
(
yych
<=
'`'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'f'
)
if
(
yych
<=
'f'
)
{
{
goto
basic_json_parser_6
3
;
goto
basic_json_parser_6
6
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
basic_json_parser_6
1
:
basic_json_parser_6
4
:
++
m_cursor
;
++
m_cursor
;
{
{
last_token_type
=
token_type
::
literal_false
;
last_token_type
=
token_type
::
literal_false
;
break
;
break
;
}
}
basic_json_parser_6
3
:
basic_json_parser_6
6
:
++
m_cursor
;
++
m_cursor
;
if
(
m_limit
<=
m_cursor
)
if
(
m_limit
<=
m_cursor
)
{
{
fill_line_buffer
(
);
fill_line_buffer
(
1
);
// LCOV_EXCL_LINE
}
}
yych
=
*
m_cursor
;
yych
=
*
m_cursor
;
if
(
yych
<=
'@'
)
if
(
yych
<=
'@'
)
{
{
if
(
yych
<=
'/'
)
if
(
yych
<=
'/'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'9'
)
if
(
yych
<=
'9'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
else
else
{
{
if
(
yych
<=
'F'
)
if
(
yych
<=
'F'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
if
(
yych
<=
'`'
)
if
(
yych
<=
'`'
)
{
{
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
if
(
yych
<=
'f'
)
if
(
yych
<=
'f'
)
{
{
goto
basic_json_parser_3
1
;
goto
basic_json_parser_3
0
;
}
}
goto
basic_json_parser_3
3
;
goto
basic_json_parser_3
2
;
}
}
}
}
...
@@ -8586,7 +8738,7 @@ basic_json_parser_63:
...
@@ -8586,7 +8738,7 @@ basic_json_parser_63:
m_start
m_start
m_content
m_content
*/
*/
void
fill_line_buffer
()
void
fill_line_buffer
(
size_t
n
=
0
)
{
{
// number of processed characters (p)
// number of processed characters (p)
const
auto
offset_start
=
m_start
-
m_content
;
const
auto
offset_start
=
m_start
-
m_content
;
...
@@ -8598,17 +8750,21 @@ basic_json_parser_63:
...
@@ -8598,17 +8750,21 @@ basic_json_parser_63:
// no stream is used or end of file is reached
// no stream is used or end of file is reached
if
(
m_stream
==
nullptr
or
m_stream
->
eof
())
if
(
m_stream
==
nullptr
or
m_stream
->
eof
())
{
{
// copy unprocessed characters to line buffer
// skip this part if we are already using the line buffer
m_line_buffer
.
clear
();
if
(
m_start
!=
reinterpret_cast
<
const
lexer_char_t
*>
(
m_line_buffer
.
data
()))
for
(
m_cursor
=
m_start
;
m_cursor
!=
m_limit
;
++
m_cursor
)
{
{
m_line_buffer
.
append
(
1
,
static_cast
<
const
char
>
(
*
m_cursor
));
// copy unprocessed characters to line buffer
m_line_buffer
.
clear
();
for
(
m_cursor
=
m_start
;
m_cursor
!=
m_limit
;
++
m_cursor
)
{
m_line_buffer
.
append
(
1
,
static_cast
<
const
char
>
(
*
m_cursor
));
}
}
}
// append
5 characters (size of longest keyword "false") to
// append
n characters to make sure that there is sufficient
//
make sure that there is sufficient space between m_cursor
//
space between m_cursor and m_limit
// and m_limit
m_line_buffer
.
append
(
1
,
'\x00'
);
m_line_buffer
.
append
(
5
,
'\0
'
);
m_line_buffer
.
append
(
n
-
1
,
'\x01
'
);
}
}
else
else
{
{
...
@@ -8616,7 +8772,7 @@ basic_json_parser_63:
...
@@ -8616,7 +8772,7 @@ basic_json_parser_63:
m_line_buffer
.
erase
(
0
,
static_cast
<
size_t
>
(
offset_start
));
m_line_buffer
.
erase
(
0
,
static_cast
<
size_t
>
(
offset_start
));
// read next line from input stream
// read next line from input stream
std
::
string
line
;
std
::
string
line
;
std
::
getline
(
*
m_stream
,
line
);
std
::
getline
(
*
m_stream
,
line
,
'\n'
);
// add line with newline symbol to the line buffer
// add line with newline symbol to the line buffer
m_line_buffer
+=
line
+
"
\n
"
;
m_line_buffer
+=
line
+
"
\n
"
;
}
}
...
@@ -8778,6 +8934,11 @@ basic_json_parser_63:
...
@@ -8778,6 +8934,11 @@ basic_json_parser_63:
// skip the next 10 characters (xxxx\uyyyy)
// skip the next 10 characters (xxxx\uyyyy)
i
+=
10
;
i
+=
10
;
}
}
else
if
(
codepoint
>=
0xDC00
and
codepoint
<=
0xDFFF
)
{
// we found a lone low surrogate
throw
std
::
invalid_argument
(
"missing high surrogate"
);
}
else
else
{
{
// add unicode character(s)
// add unicode character(s)
...
@@ -8960,6 +9121,13 @@ basic_json_parser_63:
...
@@ -8960,6 +9121,13 @@ basic_json_parser_63:
{
{
// parse with strtod
// parse with strtod
result
.
m_value
.
number_float
=
str_to_float_t
(
static_cast
<
number_float_t
*>
(
nullptr
),
NULL
);
result
.
m_value
.
number_float
=
str_to_float_t
(
static_cast
<
number_float_t
*>
(
nullptr
),
NULL
);
// replace infinity and NAN by null
if
(
not
std
::
isfinite
(
result
.
m_value
.
number_float
))
{
type
=
value_t
::
null
;
result
.
m_value
=
basic_json
::
json_value
();
}
}
}
// save the type
// save the type
...
@@ -8996,7 +9164,7 @@ basic_json_parser_63:
...
@@ -8996,7 +9164,7 @@ basic_json_parser_63:
/// a parser reading from a string literal
/// a parser reading from a string literal
parser
(
const
char
*
buff
,
const
parser_callback_t
cb
=
nullptr
)
parser
(
const
char
*
buff
,
const
parser_callback_t
cb
=
nullptr
)
:
callback
(
cb
),
:
callback
(
cb
),
m_lexer
(
reinterpret_cast
<
const
typename
lexer
::
lexer_char_t
*>
(
buff
),
strlen
(
buff
))
m_lexer
(
reinterpret_cast
<
const
typename
lexer
::
lexer_char_t
*>
(
buff
),
st
d
::
st
rlen
(
buff
))
{}
{}
/// a parser reading from an input stream
/// a parser reading from an input stream
...
@@ -10590,13 +10758,14 @@ can be used by adding `"_json"` to a string literal and returns a JSON object
...
@@ -10590,13 +10758,14 @@ can be used by adding `"_json"` to a string literal and returns a JSON object
if no parse error occurred.
if no parse error occurred.
@param[in] s a string representation of a JSON object
@param[in] s a string representation of a JSON object
@param[in] n the length of string @a s
@return a JSON object
@return a JSON object
@since version 1.0.0
@since version 1.0.0
*/
*/
inline
nlohmann
::
json
operator
""
_json
(
const
char
*
s
,
std
::
size_t
)
inline
nlohmann
::
json
operator
""
_json
(
const
char
*
s
,
std
::
size_t
n
)
{
{
return
nlohmann
::
json
::
parse
(
s
);
return
nlohmann
::
json
::
parse
(
s
,
s
+
n
);
}
}
/*!
/*!
...
@@ -10607,13 +10776,14 @@ can be used by adding `"_json_pointer"` to a string literal and returns a JSON p
...
@@ -10607,13 +10776,14 @@ can be used by adding `"_json_pointer"` to a string literal and returns a JSON p
object if no parse error occurred.
object if no parse error occurred.
@param[in] s a string representation of a JSON Pointer
@param[in] s a string representation of a JSON Pointer
@param[in] n the length of string @a s
@return a JSON pointer object
@return a JSON pointer object
@since version 2.0.0
@since version 2.0.0
*/
*/
inline
nlohmann
::
json
::
json_pointer
operator
""
_json_pointer
(
const
char
*
s
,
std
::
size_t
)
inline
nlohmann
::
json
::
json_pointer
operator
""
_json_pointer
(
const
char
*
s
,
std
::
size_t
n
)
{
{
return
nlohmann
::
json
::
json_pointer
(
s
);
return
nlohmann
::
json
::
json_pointer
(
s
td
::
string
(
s
,
n
)
);
}
}
// restore GCC/clang diagnostic settings
// restore GCC/clang diagnostic settings
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment