Extend parse tree with range and position indices in input query string #2
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.
Only cosmetic changes:
cql.js
code (Visual Studio Code default Javascript settings)cql.js
in a module manner, e.g. react etc.Adding position/range computation:
CQLError
to track more state (currently only actual inputquery
,pos
ition in string and some parsing context) to help with interpreting queries. Still needs some more manual work e.g. providing hints for fixing the query or some positioning in the query string.Note: forgot
let _qi = this.qi;
which was added in 5d05ecf around line 360@pos
) / range (@range
) of terms and operators in original query. May be used for highlighting etc. Added fifth output box in demo HTML page to demonstrate the extra range properties.Note: only serialized in the
FQ
methods (ignored when loading withcql.js
but might introduce incompatibilities with other tools or libraries that just take any JSON key as some modifier.)NOTE: Indizes in
@pos
or@range
are inclusive and start with1
.I tried to test as many possible variants I could think of. There might be some issues but I hope I found and fixed most.
The original parsing code was left untouched, so nothing should be broken there.