rapidyaml: add parsing of ys to integer-based events #209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a parser producing integer events, and integers signifying strings
by indexing into the parsed YS string.
Each event is provided as an integer bitmask. The event bits are
defined in both the C++ side (ysparse_evt_handler.hpp) and the Java
side (org.rapidyaml.Evt), and they need to stay consistent on both
ends. When a string is associated with an event, it is provided as an
integer offset and length.
For example, the YAML
say: 2 + 2
produces the following sequence ofintegers:
Note that the scalar events, ie "say" and "2 + 2", are followed each
by two extra integers encoding the offset and length of the scalar's
string. These two extra integers are present whenever the event has
any of the bits SCLR, ALIA, ANCH or TAG. For ease of use, there is a
bitmask HAS_STR, which enables quick testing by a simple
flags & HAS_STR
.Also, where a string requires filtering, the parser filters it
in-place in the input string, and returns the extra integers
pertaining to the resulting filtered string.
The existing EDN-producing parser was not removed, and the
EVT-producing parser was added both on C++ and on the Java JNI bridge.
Tests were enlarged to cover the new event parsing, both for C++ and
Java.
To benefit from this approach, the YS code should be changed to
Other changes:
JNI. ysparse is a more accurate description of what the library does.
amalgamating into a single header.