New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvement: adds optional source position tracking #1790
Merged
Conversation
This file contains 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
Updated the Tokeniser to optionally track the input source character ranges for nodes, and the end tags for Elements. This gives the ability to (for example) visually link an editor to the parsed DOM.
this.state = state; | ||
void transition(TokeniserState newState) { | ||
// track markup / data position on state transitions | ||
switch (newState) { |
Check warning
Code scanning / CodeQL
Missing enum case in switch
Switch statement does not have a case for [CdataSection](1).
Switch statement does not have a case for [BogusDoctype](2).
Switch statement does not have a case for [AfterDoctypeSystemIdentifier](3).
Switch statement does not have a case for [DoctypeSystemIdentifier_singleQuoted](4).
Switch statement does not have a case for [DoctypeSystemIdentifier_doubleQuoted](5).
Switch statement does not have a case for [BeforeDoctypeSystemIdentifier](6).
Switch statement does not have a case for [AfterDoctypeSystemKeyword](7).
Switch statement does not have a case for [BetweenDoctypePublicAndSystemIdentifiers](8).
Switch statement does not have a case for [AfterDoctypePublicIdentifier](9).
Switch statement does not have a case for [DoctypePublicIdentifier_singleQuoted](10).
Switch statement does not have a case for [DoctypePublicIdentifier_doubleQuoted](11).
Switch statement does not have a case for [BeforeDoctypePublicIdentifier](12).
Switch statement does not have a case for [AfterDoctypePublicKeyword](13).
Switch statement does not have a case for [AfterDoctypeName](14).
Switch statement does not have a case for [DoctypeName](15).
Switch statement does not have a case for [BeforeDoctypeName](16).
Switch statement does not have a case for [Doctype](17).
Switch statement does not have a case for [CommentEndBang](18).
Switch statement does not have a case for [CommentEnd](19).
Switch statement does not have a case for [CommentEndDash](20).
Switch statement does not have a case for [Comment](21).
Switch statement does not have a case for [CommentStartDash](22).
Switch statement does not have a case for [CommentStart](23).
Switch statement does not have a case for [MarkupDeclarationOpen](24).
Switch statement does not have a case for [BogusComment](25).
Switch statement does not have a case for [SelfClosingStartTag](26).
Switch statement does not have a case for [AfterAttributeValue_quoted](27).
Switch statement does not have a case for [AttributeValue_unquoted](28).
Switch statement does not have a case for [AttributeValue_singleQuoted](29).
Switch statement does not have a case for [AttributeValue_doubleQuoted](30).
Switch statement does not have a case for [BeforeAttributeValue](31).
Switch statement does not have a case for [AfterAttributeName](32).
Switch statement does not have a case for [AttributeName](33).
Switch statement does not have a case for [BeforeAttributeName](34).
Switch statement does not have a case for [ScriptDataDoubleEscapeEnd](35).
Switch statement does not have a case for [ScriptDataDoubleEscapedLessthanSign](36).
Switch statement does not have a case for [ScriptDataDoubleEscapedDashDash](37).
Switch statement does not have a case for [ScriptDataDoubleEscapedDash](38).
Switch statement does not have a case for [ScriptDataDoubleEscaped](39).
Switch statement does not have a case for [ScriptDataDoubleEscapeStart](40).
Switch statement does not have a case for [ScriptDataEscapedEndTagName](41).
Switch statement does not have a case for [ScriptDataEscapedEndTagOpen](42).
Switch statement does not have a case for [ScriptDataEscapedLessthanSign](43).
Switch statement does not have a case for [ScriptDataEscapedDashDash](44).
Switch statement does not have a case for [ScriptDataEscapedDash](45).
Switch statement does not have a case for [ScriptDataEscaped](46).
Switch statement does not have a case for [ScriptDataEscapeStartDash](47).
Switch statement does not have a case for [ScriptDataEscapeStart](48).
Switch statement does not have a case for [ScriptDataEndTagName](49).
Switch statement does not have a case for [ScriptDataEndTagOpen](50).
Switch statement does not have a case for [ScriptDataLessthanSign](51).
Switch statement does not have a case for [RawtextEndTagName](52).
Switch statement does not have a case for [RawtextEndTagOpen](53).
Switch statement does not have a case for [RawtextLessthanSign](54).
Switch statement does not have a case for [RCDATAEndTagName](55).
Switch statement does not have a case for [RCDATAEndTagOpen](56).
Switch statement does not have a case for [RcdataLessthanSign](57).
Switch st
/** | ||
Functional tests for the Position tracking behavior (across nodes, treebuilder, etc.) | ||
*/ | ||
class PositionTest { |
Check notice
Code scanning / CodeQL
Unused classes and interfaces
Unused class: PositionTest is not referenced within this codebase. If not used as an external API it should be removed.
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.
Updated the Tokeniser to optionally track the input source character ranges for nodes, and the end tags for Elements. This gives the ability to (for example) visually link an editor to the parsed DOM.