fixes for more edge cases in raw tokenizer#43
Open
mdelah wants to merge 1 commit into
Open
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #43 +/- ##
==========================================
- Coverage 99.00% 98.54% -0.47%
==========================================
Files 2 2
Lines 302 343 +41
==========================================
+ Hits 299 338 +39
- Misses 2 4 +2
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR closes out the remaining issues from #35.
As discussed:
<!--and not part of the closing-->are considered part of the comment, andRawToken)I also realized there was a similar issue with
<? ... ?>tags, so made some fixes there too.I had to rearrange
RawTokena bit to get this to work efficiently. It now calls out to a new functionfindTokenEndto locate the closing>, which returns -1 if it's not within the current buffer. ThefindTokenEndhas logic to skip past>that occur within comments or quoted values. It calls itself to skip past nested tags (such as may appear inside<!DOCTYPE [ ... ] >.I took the opportunity to replace some of the byte-by-byte iteration with
bytes.IndexByte, which gives a moderate performance boost in some of the benchmarks.