2017-12-03 18:49:18 +00:00
|
|
|
package token
|
|
|
|
|
2017-12-08 09:37:32 +00:00
|
|
|
type TokenInterface interface {
|
|
|
|
GetValue() string
|
|
|
|
GetStartLine() int
|
|
|
|
GetEndLine() int
|
|
|
|
}
|
|
|
|
|
2017-12-03 18:49:18 +00:00
|
|
|
type Token struct {
|
|
|
|
Value string
|
|
|
|
StartLine int
|
|
|
|
EndLine int
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewToken(value []byte, startLine int, endLine int) Token {
|
|
|
|
return Token{string(value), startLine, endLine}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t Token) String() string {
|
|
|
|
return string(t.Value)
|
|
|
|
}
|
2017-12-08 09:37:32 +00:00
|
|
|
|
|
|
|
func (t Token) GetValue() string {
|
|
|
|
return t.Value
|
|
|
|
}
|
|
|
|
func (t Token) GetStartLine() int {
|
|
|
|
return t.StartLine
|
|
|
|
}
|
|
|
|
func (t Token) GetEndLine() int {
|
|
|
|
return t.EndLine
|
|
|
|
}
|