boa icon indicating copy to clipboard operation
boa copied to clipboard

Span nodes

Open HalidOdat opened this issue 4 years ago • 3 comments

It would be nice for the nodes to have a Span for better error messages. A Span would contain a start Position and end Position.

HalidOdat avatar Apr 03 '20 06:04 HalidOdat

I think this would be nice, yes, but for this, we would also need that Span for tokens, as we have tokens of more than 1 character.

Razican avatar Apr 03 '20 12:04 Razican

I don't think anything in the tokens needs to change right? You generate these when you generate the Node, at that point you have all the information you need. (first token and last token)

btw I purposely left this functionality out as it caused more complication in the new parser (added scope), but im glad to see an issue for it going forward

jasonwilliams avatar Apr 03 '20 16:04 jasonwilliams

I don't think anything in the tokens needs to change right?

I think it depends on what we consider the span of a Node. The position of the last token is where the last token starts, not where the last token ends.

Razican avatar Apr 03 '20 20:04 Razican