diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2022-11-13 14:03:19 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2022-11-13 14:23:10 +0900 |
commit | 16a433b0681a19985c0134d5f9719f0fcdfe634a (patch) | |
tree | 67ccababc0e79106a9c55bf529ae7ecee78a9f80 /driver/parser/token_stream.go | |
parent | Fix typo (diff) | |
download | urubu-16a433b0681a19985c0134d5f9719f0fcdfe634a.tar.gz urubu-16a433b0681a19985c0134d5f9719f0fcdfe634a.tar.xz |
Add byte position to nodes of a syntax tree
Diffstat (limited to 'driver/parser/token_stream.go')
-rw-r--r-- | driver/parser/token_stream.go | 4 |
1 files changed, 4 insertions, 0 deletions
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 } |