Skip to content
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
merged 2 commits into from Jun 13, 2022
Merged

Improvement: adds optional source position tracking #1790

merged 2 commits into from Jun 13, 2022

Conversation

jhy
Copy link
Owner

@jhy jhy commented Jun 13, 2022

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.

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.
@jhy jhy added the feature label Jun 13, 2022
@jhy jhy added this to the 1.15.2 milestone Jun 13, 2022
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.
@jhy jhy merged commit 5abf30a into master Jun 13, 2022
@jhy jhy deleted the pos branch June 13, 2022 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant