-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support of comments in JSON input (issue #88)
- Loading branch information
Showing
8 changed files
with
242 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright Benoit Blanchon 2014-2015 | ||
// MIT License | ||
// | ||
// Arduino JSON library | ||
// https://github.com/bblanchon/ArduinoJson | ||
|
||
#pragma once | ||
|
||
namespace ArduinoJson { | ||
namespace Internals { | ||
const char *skipSpacesAndComments(const char *ptr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
#!/bin/bash | ||
|
||
ZIP="C:\Program Files\7-Zip\7z.exe" | ||
TAG=$(git describe) | ||
OUTPUT="ArduinoJson-$TAG.zip" | ||
|
||
cd ../.. | ||
|
||
# remove existing file | ||
rm -f $OUTPUT | ||
|
||
# create zip | ||
"$ZIP" a $OUTPUT \ | ||
ArduinoJson/CHANGELOG.md \ | ||
ArduinoJson/examples \ | ||
ArduinoJson/include \ | ||
ArduinoJson/keywords.txt \ | ||
ArduinoJson/library.properties \ | ||
ArduinoJson/LICENSE.md \ | ||
ArduinoJson/README.md \ | ||
ArduinoJson/src \ | ||
-x!ArduinoJson/src/CMakeLists.txt | ||
#!/bin/bash | ||
|
||
TAG=$(git describe) | ||
OUTPUT="ArduinoJson-$TAG.zip" | ||
|
||
cd $(dirname $0)/../.. | ||
|
||
# remove existing file | ||
rm -f $OUTPUT | ||
|
||
# create zip | ||
7z a $OUTPUT \ | ||
ArduinoJson/CHANGELOG.md \ | ||
ArduinoJson/examples \ | ||
ArduinoJson/include \ | ||
ArduinoJson/keywords.txt \ | ||
ArduinoJson/library.properties \ | ||
ArduinoJson/LICENSE.md \ | ||
ArduinoJson/README.md \ | ||
ArduinoJson/src \ | ||
-x!ArduinoJson/src/CMakeLists.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright Benoit Blanchon 2014-2015 | ||
// MIT License | ||
// | ||
// Arduino JSON library | ||
// https://github.com/bblanchon/ArduinoJson | ||
|
||
#include "../../include/ArduinoJson/Internals/Comments.hpp" | ||
|
||
inline static const char *skipCStyleComment(const char *ptr) { | ||
ptr += 2; | ||
for (;;) { | ||
if (ptr[0] == '\0') return ptr; | ||
if (ptr[0] == '*' && ptr[1] == '/') return ptr + 2; | ||
ptr++; | ||
} | ||
} | ||
|
||
inline static const char *skipCppStyleComment(const char *ptr) { | ||
ptr += 2; | ||
for (;;) { | ||
if (ptr[0] == '\0' || ptr[0] == '\n') return ptr; | ||
ptr++; | ||
} | ||
} | ||
|
||
const char *ArduinoJson::Internals::skipSpacesAndComments(const char *ptr) { | ||
for (;;) { | ||
switch (ptr[0]) { | ||
case ' ': | ||
case '\t': | ||
case '\r': | ||
case '\n': | ||
ptr++; | ||
continue; | ||
case '/': | ||
switch (ptr[1]) { | ||
case '*': | ||
ptr = skipCStyleComment(ptr); | ||
break; | ||
case '/': | ||
ptr = skipCppStyleComment(ptr); | ||
break; | ||
default: | ||
return ptr; | ||
} | ||
break; | ||
default: | ||
return ptr; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters