2018-04-15 11:47:40 +00:00
|
|
|
package scanner
|
2017-12-03 18:49:18 +00:00
|
|
|
|
2018-01-05 15:03:59 +00:00
|
|
|
import (
|
2019-02-13 20:18:07 +00:00
|
|
|
"github.com/z7zmey/php-parser/freefloating"
|
|
|
|
"github.com/z7zmey/php-parser/position"
|
2018-01-05 15:03:59 +00:00
|
|
|
)
|
|
|
|
|
2018-01-11 18:49:00 +00:00
|
|
|
// Token value returned by lexer
|
2017-12-03 18:49:18 +00:00
|
|
|
type Token struct {
|
2019-02-13 20:18:07 +00:00
|
|
|
Value string
|
|
|
|
FreeFloating []freefloating.String
|
|
|
|
StartLine int
|
|
|
|
EndLine int
|
|
|
|
StartPos int
|
|
|
|
EndPos int
|
2017-12-03 18:49:18 +00:00
|
|
|
}
|
|
|
|
|
2018-04-15 19:56:20 +00:00
|
|
|
func (t *Token) String() string {
|
2017-12-03 18:49:18 +00:00
|
|
|
return string(t.Value)
|
|
|
|
}
|
2019-02-13 20:18:07 +00:00
|
|
|
|
|
|
|
func (t *Token) GetFreeFloatingToken() []freefloating.String {
|
|
|
|
return []freefloating.String{
|
|
|
|
{
|
|
|
|
StringType: freefloating.TokenType,
|
|
|
|
Value: t.Value,
|
|
|
|
Position: &position.Position{
|
|
|
|
StartLine: t.StartLine,
|
|
|
|
EndLine: t.EndLine,
|
|
|
|
StartPos: t.StartPos,
|
|
|
|
EndPos: t.EndPos,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|