php-parser/meta/comment.go

40 lines
749 B
Go
Raw Normal View History

package meta
2018-01-02 22:12:28 +00:00
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-06-25 12:38:31 +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{
2018-06-25 12:38:31 +00:00
Value: value,
Position: pos,
TokenName: UnknownToken,
2018-04-15 12:55:33 +00:00
}
}
2018-01-08 22:30:28 +00:00
// SetTokenName sets token name
func (c *Comment) SetTokenName(tokenName TokenName) {
2018-06-25 12:38:31 +00:00
c.TokenName = tokenName
}
// GetTokenName returns token name
func (c *Comment) GetTokenName() TokenName {
return c.TokenName
}
2018-04-15 12:55:33 +00:00
func (c *Comment) String() string {
2018-06-25 12:38:31 +00:00
return c.Value
2018-04-15 18:39:26 +00:00
}
func (c *Comment) GetPosition() *position.Position {
return c.Position
}