From 16a433b0681a19985c0134d5f9719f0fcdfe634a Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sun, 13 Nov 2022 14:03:19 +0900 Subject: Add byte position to nodes of a syntax tree --- driver/parser/token_stream.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'driver/parser/token_stream.go') diff --git a/driver/parser/token_stream.go b/driver/parser/token_stream.go index 0bc9e32..929b733 100644 --- a/driver/parser/token_stream.go +++ b/driver/parser/token_stream.go @@ -28,6 +28,10 @@ func (t *vToken) Invalid() bool { return t.tok.Invalid } +func (t *vToken) BytePosition() (int, int) { + return t.tok.BytePos, t.tok.ByteLen +} + func (t *vToken) Position() (int, int) { return t.tok.Row, t.tok.Col } -- cgit v1.2.3