Documentation
¶
Overview ¶
Package parse provides lexical analysis and parsing methods for twtr.
While usable as a stand alone parsing package, the twtr.Client type is better suited to high level applications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommentLine ¶
type CommentLine struct {
// These are the metadata fields of the line, parsed as:
//
// FIELD = VALUE
//
// Note that these are not required and may be empty.
FIELD, VALUE string
// CommentLine extends the Line type
Line
}
CommentLine represents a line, parsed as a comment in a twtxt.txt file.
func NewCommentLine ¶
func NewCommentLine(line string) (comment CommentLine)
NewCommentLine parses a new comment line from the given string.
func (CommentLine) AsCommentLine ¶
func (comment CommentLine) AsCommentLine() (line CommentLine, ok bool)
AsCommentLine reports whether this FeedLine is a CommentLine and casts it appropriately.
func (CommentLine) AsTweetLine ¶
func (comment CommentLine) AsTweetLine() (line TweetLine, ok bool)
AsTweetLine reports whether this FeedLine is a TweetLine and casts it appropriately.
type FeedLine ¶
type FeedLine interface { // AsCommentLine reports whether this FeedLine is a CommentLine and casts it // appropriately AsCommentLine() (line CommentLine, ok bool) // AsTweetLine reports whether this FeedLine is a TweetLine and casts it // appropriately AsTweetLine() (line TweetLine, ok bool) // contains filtered or unexported methods }
FeedLine represents either a CommentLine or a TweetLine, as either may appear in a twtxt.txt feed file.
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line is the basic unit of a parsed line, it represents the original text of the line as it was parsed, as well as any error that occurred during parsing.
type TweetLine ¶
type TweetLine struct { // These are the fields of the line, parsed as: // // TIMESTAMP\tMESSAGE // // Note that any of these may be blank or missing, check the Err() method to // validate the line. TIMESTAMP time.Time MESSAGE string // TweetLine extends the Line type Line }
TweetLine represents a line, parsed as an entry in a twtxt.txt file.
func NewTweetLine ¶
NewTweetLine parses a new tweet line from the given string.
func (TweetLine) AsCommentLine ¶
func (tweet TweetLine) AsCommentLine() (line CommentLine, ok bool)
AsCommentLine reports whether this FeedLine is a CommentLine and casts it appropriately.
func (TweetLine) AsTweetLine ¶
AsTweetLine reports whether this FeedLine is a TweetLine and casts it appropriately.