add tag span

This commit is contained in:
Josh Thomas 2025-01-06 22:39:16 -06:00
parent 43e6ea8054
commit fdf1ebb8db
10 changed files with 20 additions and 18 deletions

View file

@ -93,13 +93,15 @@ impl Parser {
.map(String::from)
.collect();
let tag_name = bits.first().ok_or(ParserError::EmptyTag)?.clone();
let span = Span::from(token);
let tag_span = Span::new(*span.start(), tag_name.len() as u32);
let tag = Tag {
name: tag_name.clone(),
bits: bits.clone(),
span,
tag_span: span,
tag_span,
assignment: None,
};

View file

@ -17,7 +17,7 @@ nodes:
length: 8
tag_span:
start: 3
length: 8
length: 2
assignment: ~
nodes:
- Text:
@ -39,7 +39,7 @@ nodes:
length: 10
tag_span:
start: 25
length: 10
length: 4
assignment: ~
nodes:
- Text:

View file

@ -17,7 +17,7 @@ nodes:
length: 17
tag_span:
start: 3
length: 17
length: 3
assignment: ~
nodes:
- Variable:

View file

@ -15,7 +15,7 @@ nodes:
length: 24
tag_span:
start: 3
length: 24
length: 2
assignment: ~
nodes:
- Text:

View file

@ -20,7 +20,7 @@ nodes:
length: 24
tag_span:
start: 12
length: 24
length: 2
assignment: ~
nodes:
- Variable:
@ -56,7 +56,7 @@ nodes:
length: 24
tag_span:
start: 89
length: 24
length: 3
assignment: ~
nodes:
- Block:
@ -71,7 +71,7 @@ nodes:
length: 16
tag_span:
start: 128
length: 16
length: 2
assignment: ~
nodes:
- Text:
@ -113,7 +113,7 @@ nodes:
length: 19
tag_span:
start: 196
length: 19
length: 2
assignment: ~
nodes:
- Text:
@ -146,7 +146,7 @@ nodes:
length: 15
tag_span:
start: 243
length: 15
length: 2
assignment: ~
nodes:
- Text:

View file

@ -17,7 +17,7 @@ nodes:
length: 17
tag_span:
start: 3
length: 17
length: 3
assignment: ~
nodes:
- Block:
@ -32,7 +32,7 @@ nodes:
length: 14
tag_span:
start: 26
length: 14
length: 2
assignment: ~
nodes:
- Variable:

View file

@ -25,7 +25,7 @@ nodes:
length: 24
tag_span:
start: 51
length: 24
length: 2
assignment: ~
nodes:
- Comment:
@ -75,7 +75,7 @@ nodes:
length: 17
tag_span:
start: 255
length: 17
length: 3
assignment: ~
nodes:
- Text:

View file

@ -17,7 +17,7 @@ nodes:
length: 17
tag_span:
start: 3
length: 17
length: 3
assignment: ~
nodes:
- Variable:

View file

@ -15,7 +15,7 @@ nodes:
length: 24
tag_span:
start: 3
length: 24
length: 2
assignment: ~
nodes:
- Text:

View file

@ -105,7 +105,7 @@ nodes:
length: 24
tag_span:
start: 466
length: 24
length: 2
assignment: ~
nodes:
- Comment:
@ -154,7 +154,7 @@ nodes:
length: 16
tag_span:
start: 624
length: 16
length: 2
assignment: ~
nodes:
- Text: