2018-01-02 22:12:28 +00:00
|
|
|
package comment
|
|
|
|
|
2018-04-15 18:39:26 +00:00
|
|
|
import (
|
|
|
|
"github.com/z7zmey/php-parser/position"
|
|
|
|
)
|
|
|
|
|
2018-04-15 12:55:33 +00:00
|
|
|
// Comment aggrigates information about comment /**
|
|
|
|
type Comment struct {
|
2018-05-27 19:15:27 +00:00
|
|
|
value string
|
|
|
|
position *position.Position
|
|
|
|
tokenName TokenName
|
2018-01-02 22:12:28 +00:00
|
|
|
}
|
2018-01-08 22:30:28 +00:00
|
|
|
|
2018-04-15 12:55:33 +00:00
|
|
|
// NewComment - Comment constructor
|
2018-04-15 18:39:26 +00:00
|
|
|
func NewComment(value string, pos *position.Position) *Comment {
|
2018-04-15 12:55:33 +00:00
|
|
|
return &Comment{
|
|
|
|
value,
|
2018-04-15 18:39:26 +00:00
|
|
|
pos,
|
2018-05-27 19:15:27 +00:00
|
|
|
UnknownToken,
|
2018-04-15 12:55:33 +00:00
|
|
|
}
|
|
|
|
}
|
2018-01-08 22:30:28 +00:00
|
|
|
|
2018-05-27 19:15:27 +00:00
|
|
|
// SetTokenName sets token name
|
|
|
|
func (c *Comment) SetTokenName(tokenName TokenName) {
|
|
|
|
c.tokenName = tokenName
|
|
|
|
}
|
|
|
|
|
|
|
|
// TokenName returns token name
|
|
|
|
func (c *Comment) TokenName() TokenName {
|
|
|
|
return c.tokenName
|
|
|
|
}
|
|
|
|
|
2018-04-15 12:55:33 +00:00
|
|
|
func (c *Comment) String() string {
|
|
|
|
return c.value
|
2018-01-08 22:30:28 +00:00
|
|
|
}
|
2018-04-15 18:39:26 +00:00
|
|
|
|
|
|
|
// Position returns comment position
|
|
|
|
func (c *Comment) Position() *position.Position {
|
|
|
|
return c.position
|
|
|
|
}
|