Conversation
|
actually, inclusive span could be bad because that means you can never use it with Parser0 which may parse nothing, so an inclusive range could fail there, but then again, maybe that is a feature? Maybe you only want the Span of a Parser? |
Codecov Report
@@ Coverage Diff @@
## main #301 +/- ##
==========================================
+ Coverage 96.43% 96.65% +0.21%
==========================================
Files 8 9 +1
Lines 1011 1404 +393
Branches 81 133 +52
==========================================
+ Hits 975 1357 +382
- Misses 36 47 +11
Continue to review full report at Codecov.
|
| } | ||
|
|
||
| def toCaret(offset: Int): Option[Caret] = | ||
| if (offset < 0 || offset > input.length) None |
There was a problem hiding this comment.
🎨 this condition is popping a few times would a isValidOffset be worth?
There was a problem hiding this comment.
good idea. I've made that change (and avoid checking it so many times).
This does the caret part of #238
related to #234
I did not add Span, just Caret.
My concern was that the span methods are a bit less clear. For instance, we may want an inclusive upper bound range, or maybe we do want exclusive. Inclusive is a bit more complex to implement however.
To sidestep this concern for now while we think about the design, I just added getting the
Caretitself.cc @re-xyr