feat: add start column and end column to position struct

This commit is contained in:
Laytan Laats
2023-03-26 01:54:00 +01:00
parent 92019441d0
commit 7c12f73974
19 changed files with 316 additions and 109 deletions

View File

@@ -148,6 +148,8 @@ func (v *Dumper) dumpPosition(pos *position.Position) {
v.print(v.indent, "StartLine: "+strconv.Itoa(pos.StartLine)+",\n")
v.print(v.indent, "EndLine: "+strconv.Itoa(pos.EndLine)+",\n")
v.print(v.indent, "StartCol: "+strconv.Itoa(pos.StartCol)+",\n")
v.print(v.indent, "EndCol: "+strconv.Itoa(pos.EndCol)+",\n")
v.print(v.indent, "StartPos: "+strconv.Itoa(pos.StartPos)+",\n")
v.print(v.indent, "EndPos: "+strconv.Itoa(pos.EndPos)+",\n")

View File

@@ -2,10 +2,11 @@ package dumper_test
import (
"bytes"
"testing"
"github.com/VKCOM/php-parser/pkg/position"
"github.com/VKCOM/php-parser/pkg/token"
"github.com/VKCOM/php-parser/pkg/visitor/dumper"
"testing"
"github.com/VKCOM/php-parser/pkg/ast"
)
@@ -45,6 +46,8 @@ func TestDumper_root(t *testing.T) {
Position: &position.Position{
StartLine: 1,
EndLine: 2,
StartCol: 0,
EndCol: 0,
StartPos: 3,
EndPos: 4,
},
@@ -60,6 +63,8 @@ func TestDumper_root(t *testing.T) {
Position: &position.Position{
StartLine: 1,
EndLine: 2,
StartCol: 0,
EndCol: 0,
StartPos: 3,
EndPos: 4,
},