Update token string func.

This commit is contained in:
zhouzhihong 2022-08-25 21:49:42 +08:00
parent 574794507e
commit d2362be35b

View File

@ -55,7 +55,20 @@ func (t *Token) Equals(other *Token) bool {
// String formats the token in a human readable form.
func (t *Token) String() string {
return fmt.Sprintf("%d %q %d (%d, %d)-(%d, %d)", t.Type, t.Value, t.TC, t.StartLine, t.StartColumn, t.EndLine, t.EndColumn)
return fmt.Sprintf(
"%d %q %d (%d, %d)-(%d, %d) (%d, %d)-(%d, %d)",
t.Type,
t.Value,
t.TC,
t.StartLine,
t.StartColumn,
t.EndLine,
t.EndColumn,
t.TSLine,
t.TSColumn,
t.TELine,
t.TEColumn,
)
}
// An Action is a function which get called when the Scanner finds a match