asciigoat's core library
https://asciigoat.org/core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
458 B
32 lines
458 B
1 year ago
|
package parser
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"asciigoat.org/core/lexer"
|
||
|
)
|
||
|
|
||
|
// Token ...
|
||
|
type Token struct {
|
||
|
lexer.Position
|
||
|
|
||
|
Type uint
|
||
|
Value string
|
||
|
}
|
||
|
|
||
|
// Len ...
|
||
|
func (t Token) Len() int {
|
||
|
return len(t.Value)
|
||
|
}
|
||
|
|
||
|
// String generates the '%v' value
|
||
|
func (t Token) String() string {
|
||
|
return t.Value
|
||
|
}
|
||
|
|
||
|
// GoString generates the '%#v' value
|
||
|
func (t Token) GoString() string {
|
||
|
return fmt.Sprintf("Token{Position{%v,%v}, %v, %q}",
|
||
|
t.Line, t.Column, t.Type, t.Value)
|
||
|
}
|