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/parser.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'driver/parser/parser.go') diff --git a/driver/parser/parser.go b/driver/parser/parser.go index 05f7d38..2eaa678 100644 --- a/driver/parser/parser.go +++ b/driver/parser/parser.go @@ -64,6 +64,10 @@ type VToken interface { // Invalid returns true when a token is invalid. Invalid() bool + // BytePosition returns (position, length) pair. + // `position` is a byte position where a token appears and `length` is a length in bytes. + BytePosition() (int, int) + // Position returns (row, column) pair. Position() (int, int) } -- cgit v1.2.3