Do not export a location in the build directory as a build interface.
This location is not created until the build step is run and can
interfere with the CMake configuration step if including in another
project.
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
In jsoncpp-namspaced-targets.cmake, it creates JsonCpp::JsonCpp imported
library without first checking whether it was already created by former
call to find_package(JsonCpp). As CMake allows repeated call to
find_package(), the error of "another target with the same name already
exists" should be fixed.
Co-authored-by: xiazuoling.xzl <xiazuoling.xzl@alibaba-inc.com>
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
* Introduce CharReaderBuilder::ecma404Mode
* Bump micro version
---------
Co-authored-by: Jordan Bayles <jophba@chromium.org>
Co-authored-by: Billy Donahue <BillyDonahue@users.noreply.github.com>
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
* Create a jsoncppConfig.cmake file, even if building under meson
* Hardcode many fewer things in the meson-generated cmake files
* use join_paths for constructing paths in the output Config.cmake
---------
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
* Opportunistically take advantage of C++20 move-out-of stringstream
* Opportunistically take advantage of C++20 move-in/out-of stringstream
---------
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
Currently removeIndex copies the removed value into removed and then
destructs the original, which can cause significant performance overhead.
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
* CharReader: Add Structured Error
Add getStructuredError to CharReader
* run clang format
---------
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
Co-authored-by: Jordan Bayles <jophba@chromium.org>
If you really want to be sure to always find python3 when running Meson (and not some other implementation like [Muon](https://muon.build)) it is a bit better to use `find_program('python3')`, as described in https://mesonbuild.com/Reference-manual_functions.html#find_program : "if the "python3" program is requested and it is not found in the system, Meson will return its current interpreter
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
* add a valueToQuotedString overload to take a string length to support things like a string_view more directly.
* Apply suggestions from code review
Co-authored-by: Billy Donahue <BillyDonahue@users.noreply.github.com>
---------
Co-authored-by: Billy Donahue <BillyDonahue@users.noreply.github.com>
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
The existing asserts seem to not be what was intended; they appear to have been mistranslated in pull/877.
The first assert for `comment.empty()` was previously a check that a provided `const char*` parameter was not null. The function this replaced accepted empty strings, and the if() statement at the start of this function handles them.
The second assert for `comment[0] == '\0'` was written when `comment` was a `const char*`, and was testing for empty c-string input. This PR replaces it with `comment.empty()` to match the original intent.
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
getLocationLIneAndColumn would read past the end of the provided buffer if generating an error message at the end of the stream, if the final character was `\r`.
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
* Fix a parser bug where tokens are misidentified as commas.
In the old and new readers, when parsing an object, a comment
followed by any non-`}` token is treated as a comma.
The new unit test required changing the runjsontests.py
flag regime so that failure tests could be run with default settings.
* Honor allowComments==false mode.
Much of the comment handling in the parsers is bespoke, and does not
honor this flag. By unfiying it under a common API, the parser is
simplified and strict mode is now more correctly strict.
Note that allowComments mode does not allow for comments in
arbitrary locations; they are allowed only in certain positions.
Rectifying this is a bigger effort, since collectComments mode requires
storing the comments somewhere, and it's not immediately clear
where in the DOM all such comments should live.
---------
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>