Added ARDUINOJSON_ENABLE_COMMENTS to enable support for comments

This commit is contained in:
Benoit Blanchon
2020-01-13 18:16:02 +01:00
parent f9cfea244a
commit 04fe7e1a27
11 changed files with 488 additions and 393 deletions

View File

@ -165,6 +165,11 @@
#define ARDUINOJSON_DECODE_UNICODE 0
#endif
// Ignore comments in input
#ifndef ARDUINOJSON_ENABLE_COMMENTS
#define ARDUINOJSON_ENABLE_COMMENTS 0
#endif
// Support NaN in JSON
#ifndef ARDUINOJSON_ENABLE_NAN
#define ARDUINOJSON_ENABLE_NAN 0

View File

@ -357,6 +357,7 @@ class JsonDeserializer {
move();
continue;
#if ARDUINOJSON_ENABLE_COMMENTS
// comments
case '/':
move(); // skip '/'
@ -394,6 +395,7 @@ class JsonDeserializer {
return DeserializationError::InvalidInput;
}
break;
#endif
default:
return DeserializationError::Ok;

View File

@ -14,13 +14,14 @@
#define ARDUINOJSON_CONCAT8(A, B, C, D, E, F, G, H) \
ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT4(A, B, C, D), \
ARDUINOJSON_CONCAT4(E, F, G, H))
#define ARDUINOJSON_CONCAT11(A, B, C, D, E, F, G, H, I, J, K) \
ARDUINOJSON_CONCAT8(A, B, C, D, E, F, G, ARDUINOJSON_CONCAT4(H, I, J, K))
#define ARDUINOJSON_CONCAT12(A, B, C, D, E, F, G, H, I, J, K, L) \
ARDUINOJSON_CONCAT8(A, B, C, D, E, F, G, \
ARDUINOJSON_CONCAT4(H, I, J, ARDUINOJSON_CONCAT2(K, L)))
#define ARDUINOJSON_NAMESPACE \
ARDUINOJSON_CONCAT11( \
ARDUINOJSON_CONCAT12( \
ArduinoJson, ARDUINOJSON_VERSION_MAJOR, ARDUINOJSON_VERSION_MINOR, \
ARDUINOJSON_VERSION_REVISION, _, ARDUINOJSON_USE_LONG_LONG, \
ARDUINOJSON_USE_DOUBLE, ARDUINOJSON_DECODE_UNICODE, \
ARDUINOJSON_ENABLE_NAN, ARDUINOJSON_ENABLE_INFINITY, \
ARDUINOJSON_ENABLE_PROGMEM)
ARDUINOJSON_ENABLE_PROGMEM, ARDUINOJSON_ENABLE_COMMENTS)