Makde the amalgamated single include file and ran the C++ prettifier on it all.

This commit is contained in:
Bruno Nicoletti 2018-03-26 16:32:47 +01:00
parent cb6b2faab1
commit 72e556ef92
2 changed files with 76 additions and 26 deletions

View File

@ -1194,35 +1194,43 @@ scan_number_done:
while (current == ' ' or current == '\t' or current == '\n' or current == '\r'); while (current == ' ' or current == '\t' or current == '\n' or current == '\r');
#else #else
// skip white space and comments if comment stripping enabled // skip white space and comments if comment stripping enabled
while(true) { while (true)
// first skip any whitespace {
do { // first skip any whitespace
get(); do
} {
while (current == ' ' || current == '\t' || current == '\n' || current == '\r');
// next, skip any comment
if(current == '/') {
get();
// really a comment?
if (current == '/') {
// skip to the end of line/file
do {
get(); get();
} while (! (current == '\n' ||
current == '\r' ||
current == std::char_traits<char>::eof()));
} }
else { while (current == ' ' || current == '\t' || current == '\n' || current == '\r');
// not a comment, leave it up to the rest of the code to deal with the '/'
unget(); // next, skip any comment
break; if (current == '/')
{
get();
// really a comment?
if (current == '/')
{
// skip to the end of line/file
do
{
get();
}
while (! (current == '\n' ||
current == '\r' ||
current == std::char_traits<char>::eof()));
}
else
{
// not a comment, leave it up to the rest of the code to deal with the '/'
unget();
break;
}
}
else
{
// not a comment at all, break out of the loop
break;
} }
}
else {
// not a comment at all, break out of the loop
break;
}
} }
#endif #endif

View File

@ -3024,12 +3024,54 @@ scan_number_done:
token_type scan() token_type scan()
{ {
#ifndef JSON_STRIP_COMMENTS
// read next character and ignore whitespace // read next character and ignore whitespace
do do
{ {
get(); get();
} }
while (current == ' ' or current == '\t' or current == '\n' or current == '\r'); while (current == ' ' or current == '\t' or current == '\n' or current == '\r');
#else
// skip white space and comments if comment stripping enabled
while (true)
{
// first skip any whitespace
do
{
get();
}
while (current == ' ' || current == '\t' || current == '\n' || current == '\r');
// next, skip any comment
if (current == '/')
{
get();
// really a comment?
if (current == '/')
{
// skip to the end of line/file
do
{
get();
}
while (! (current == '\n' ||
current == '\r' ||
current == std::char_traits<char>::eof()));
}
else
{
// not a comment, leave it up to the rest of the code to deal with the '/'
unget();
break;
}
}
else
{
// not a comment at all, break out of the loop
break;
}
}
#endif
switch (current) switch (current)
{ {