Documentation ¶
Index ¶
- Constants
- Variables
- func BuildToken(tok string, b string, e string) string
- func ToString(x StringList) string
- func UpdateResults(r *Results, s string, u string) bool
- type CFParser
- type CFTErr
- type CFToken
- type Collect
- func (l *Collect) CheckParaGraphStatus()
- func (s Collect) GetMatchToken() StringList
- func (s Collect) GetPatternDirective(i int) Directive
- func (s Collect) GetSentence() StringList
- func (s Collect) IsParagraphComplete() bool
- func (s Collect) IsPatternComplete() bool
- func (s Collect) IsSentenceComplete() bool
- func (s *Collect) MatchCollectSentence(t CFToken) bool
- func (o Collect) PutStr()
- type CollectFuncs
- type CollectLine
- type CollectList
- type CollectNext
- type CollectQuote
- type Command
- type Directive
- type DirectiveList
- type Mbuf
- type Page
- func (pg Page) CheckDirectives() bool
- func (pg Page) GetPageDirective() Directive
- func (pg Page) GetParagraphCnt() int
- func (pg *Page) ProcessPage(f *token.FileSet, s scanner.Scanner, t CFToken) (scanner.Scanner, bool)
- func (pg *Page) ProcessParagraph(f *token.FileSet, s scanner.Scanner, t CFToken) (scanner.Scanner, bool)
- func (pg *Page) ProcessSentence(f *token.FileSet, s scanner.Scanner, t CFToken) (scanner.Scanner, bool)
- func (p Page) String() string
- type Paragraph
- type ParagraphList
- type Pattern
- func (pt Pattern) GetMatchNextToken() StringList
- func (pt Pattern) GetPatternDirective(i int) Directive
- func (pt Pattern) GetPatternDirectiveList() DirectiveList
- func (sent Pattern) GetSentenceDirective() Directive
- func (sent Pattern) GetSentenceName() string
- func (pat Pattern) PatternDirectiveTotal() Directive
- func (stc Pattern) String() string
- type PatternList
- type Results
- type StringList
Constants ¶
const ( PAGE = iota PARAGRAPH = iota SENTENCE = iota PATTERN = iota KW_SINGLE = "'" MBUFSIZE = 512 )
const ( COLLECTQUOTE = iota COLLECTLINE = iota COLLECTNEXT = iota ENDOFBUFFER = "jxLmZJ7gPY" )
const ( KW_PARAGRAPH_CAPACITY = 10 KW_PARAGRAPH_EXTEND = 5 )
const ( KW_COLON = ":" KW_LBRACE = "{" KW_RBRACE = "}" KW_DQUOTE = "\"" KW_SQUOTE = "'" KW_DRSTART = KW_COLON KW_TFOUND = true KW_NFOUND = false KW_TOKSEP = "-" KW_DEFINED = 1 KW_SEMI = ";" KW_EQUAL = "=" )
const ( INSEQUENCE = 2 * 1 << iota UNSEQUENCE = 2 * 1 << iota PGMIXED = 2 * 1 << iota PGLOWER = 2 * 1 << iota )
Page Constants
const ( ONEOF = 2 * 1 << iota SOMEOF = 2 * 1 << iota ANYOF = 2 * 1 << iota ALLOF = 2 * 1 << iota BEGIN = 2 * 1 << iota END = 2 * 1 << iota PAMIXED = 2 * 1 << iota PALOWER = 2 * 1 << iota )
Paragraph Constants
const ( COLLECT_QUOTE = 2 * 1 << iota COLLECT_LINE = 2 * 1 << iota COLLECT_NEXT = 2 * 1 << iota COLLECT = 2 * 1 << iota COLLECT_COMMA = 2 * 1 << iota CONCAT_TAB = 2 * 1 << iota CONCAT = 2 * 1 << iota COMPLETE = 2 * 1 << iota ISTHERE = 2 * 1 << iota EXACT = 2 * 1 << iota ANY = 2 * 1 << iota EXCLUDE = 2 * 1 << iota FOLLOW = 2 * 1 << iota REGARDLESS = 2 * 1 << iota STMIXED = 2 * 1 << iota STLOWER = 2 * 1 << iota START = 2 * 1 << iota )
Sentence Constants
Variables ¶
var ( Seqidx = 0 SeqInc = func() { Seqidx++ } MatchTok = func(s StringList) { matchP = matchP[0:0] matchP = append(matchP, s...) } )
var ( ParaIdx = -1 IncPara = func() { ParaIdx++ SentIdx = -1 } SentIdx = -1 /* Set to something stupid to shutup compiler */ IncSent = func() { SentIdx++ SrchIdx = -1 } SrchIdx = -1 IncSrch = func() { SrchIdx++ } )
var (
Fset *token.FileSet
)
Functions ¶
func ToString ¶
func ToString(x StringList) string
Types ¶
type Collect ¶
type Collect struct {
// contains filtered or unexported fields
}
func NewCollection ¶
func (*Collect) CheckParaGraphStatus ¶
func (l *Collect) CheckParaGraphStatus()
CheckParaGraphStatus - Checks the pattern bit status and if set then sets CheckParaGraphStatus - sentence/paragrpah bit.
func (Collect) GetMatchToken ¶
func (s Collect) GetMatchToken() StringList
func (Collect) GetPatternDirective ¶
func (Collect) GetSentence ¶
func (s Collect) GetSentence() StringList
func (Collect) IsParagraphComplete ¶
func (Collect) IsPatternComplete ¶
func (Collect) IsSentenceComplete ¶
func (*Collect) MatchCollectSentence ¶
type CollectFuncs ¶
type CollectFuncs Command
type CollectLine ¶
type CollectLine struct{}
type CollectList ¶
type CollectList []Collect
func InitEngine ¶
func InitEngine(pg Page) CollectList
func (*CollectList) ClearPatternStatus ¶
func (s *CollectList) ClearPatternStatus()
type CollectNext ¶
type CollectNext struct{}
type CollectQuote ¶
type CollectQuote struct{}
type Directive ¶
type Directive uint
func (Directive) ClearDirective ¶
func (Directive) IsDirectiveSet ¶
func (Directive) SetDirective ¶
type DirectiveList ¶
type DirectiveList []Directive
type Mbuf ¶
type Mbuf []byte
func (*Mbuf) GetBuffer ¶
GetBuffer: Reads a buffer full of data and returns the buffer ending at GetBuffer: a whitespace character. It returns 0 if the end of file is reached.
func (Mbuf) IsWhiteSpace ¶
func (Mbuf) NewKwScanner ¶
func (*Mbuf) NextDataToken ¶
func (b *Mbuf) NextDataToken(df *os.File, f *token.FileSet, t *CFToken, s scanner.Scanner) (*token.FileSet, scanner.Scanner)
NextDataToken: Takes a scanner object and returns the next token NextDataToken: and updated Scanner position. If the line number NextDataToken: changes then a NewLine token is returned and the NextDataToken: subsequent call returns the cached token.
type Page ¶
type Page struct { Paras ParagraphList // contains filtered or unexported fields }
func (Page) CheckDirectives ¶
func (Page) GetPageDirective ¶
func (Page) GetParagraphCnt ¶
func (*Page) ProcessPage ¶
ProcessPage takes a token and determines if it contains the start to the page command and then proccesses the command. ProcessPage returns true if successful. Otherwise ProcessPage returns false.
func (*Page) ProcessParagraph ¶
func (*Page) ProcessSentence ¶
type Paragraph ¶
type Paragraph struct { Stc PatternList // Sentences Stcnt int // contains filtered or unexported fields }
func MakeParagraph ¶
func (Paragraph) GetParagraphDirective ¶
type ParagraphList ¶
type ParagraphList []Paragraph
func (*ParagraphList) AddParagraph ¶
func (p *ParagraphList) AddParagraph(np ...Paragraph)
type Pattern ¶
type Pattern struct { Pt StringList // pattern to match Nt StringList // Match next token // contains filtered or unexported fields }
func (Pattern) GetMatchNextToken ¶
func (pt Pattern) GetMatchNextToken() StringList
func (Pattern) GetPatternDirective ¶
func (Pattern) GetPatternDirectiveList ¶
func (pt Pattern) GetPatternDirectiveList() DirectiveList
func (Pattern) GetSentenceDirective ¶
func (Pattern) GetSentenceName ¶
func (Pattern) PatternDirectiveTotal ¶
type PatternList ¶
type PatternList []Pattern
func (*PatternList) AddPattern ¶
func (p *PatternList) AddPattern(i func(), idx *int, np ...Pattern)
func AddPattern(p []Pattern, i func(), idx *int, np ...Pattern) []Pattern {
type Results ¶
type Results struct {
// contains filtered or unexported fields
}
func (*Results) AddResults ¶
func (*Results) PutResults ¶
func (rs *Results) PutResults()
type StringList ¶
type StringList []string
func MakeTokenString ¶
func MakeTokenString(tokestr string) StringList
func (*StringList) AddSearch ¶
func (p *StringList) AddSearch(np ...string)