Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
34255279
Unverified
Commit
34255279
authored
Mar 26, 2017
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔨
added code for locale-independent number parsing
parent
06e2a291
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
errors.txt
errors.txt
+0
-7
src/json.hpp
src/json.hpp
+21
-4
No files found.
errors.txt
deleted
100644 → 0
View file @
06e2a291
- test/test-class_parser
- 617 failed
- test/test-regression
- 11 failed
- test/test-testsuites
- 43 failed
src/json.hpp
View file @
34255279
...
...
@@ -10517,12 +10517,13 @@ class basic_json
}
explicit
lexer
(
std
::
istream
&
i
)
// : ia(new input_stream_adapter(i))
:
ia
(
new
cached_input_stream_adapter
(
i
))
:
ia
(
new
cached_input_stream_adapter
(
i
)),
decimal_point_char
(
get_decimal_point
(
))
{}
lexer
(
const
char
*
buff
,
const
size_t
len
)
:
ia
(
new
input_buffer_adapter
(
buff
,
len
))
:
ia
(
new
input_buffer_adapter
(
buff
,
len
)),
decimal_point_char
(
get_decimal_point
())
{}
~
lexer
()
...
...
@@ -10536,6 +10537,18 @@ class basic_json
lexer
operator
=
(
const
lexer
&
)
=
delete
;
private:
/////////////////////
// locales
/////////////////////
/// return the locale-dependent decimal point
static
char
get_decimal_point
()
noexcept
{
const
auto
loc
=
localeconv
();
assert
(
loc
!=
nullptr
);
return
(
loc
->
decimal_point
==
nullptr
)
?
'.'
:
loc
->
decimal_point
[
0
];
}
/////////////////////
// scan functions
/////////////////////
...
...
@@ -10815,7 +10828,8 @@ class basic_json
return
token_type
::
parse_error
;
}
add
(
current
);
// add current character and fix decimal point
add
((
state
==
4
)
?
decimal_point_char
:
current
);
get
();
old_state
=
state
;
state
=
lookup
[
state
][
static_cast
<
unsigned
char
>
(
current
)];
...
...
@@ -11103,6 +11117,9 @@ class basic_json
long
long
value_integer
=
0
;
unsigned
long
long
value_unsigned
=
0
;
double
value_float
=
0
;
// the decimal point
const
char
decimal_point_char
=
'\0'
;
};
/*!
...
...
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