Documentation
¶
Overview ¶
Package parser implements routines for reading the input files.
Index ¶
- Variables
- func Filter(s string, filters []*regexp.Regexp) bool
- func FilterCommentedCode(words []sf.Word, text *tui.TextBuffer, comments []CommentRange, ...) []sf.Word
- func IsWord(s string) bool
- func LexerStateInfoName(info int) string
- func LexerTokenKindName(kind TokenKindType) string
- func Parse(fileName, source string, commentStyle CommentStyle, speller aspell.Speller, ...) sf.SourceFile
- func TrimSymbols(s string) (string, string, string)
- type CommentRange
- type Dfa
- type DfaState
- type Lexer
- type State
- type Token
- type TokenKindType
- type Transition
Constants ¶
This section is empty.
Variables ¶
var TokenKind = struct { Code TokenKindType Style TokenKindType CommentBegin TokenKindType CommentWord TokenKindType CommentEnd TokenKindType Newline TokenKindType EOF TokenKindType }{0, 1, 2, 3, 4, 6, 7}
TokenKind acts as a namespace for token types.
Functions ¶
func FilterCommentedCode ¶
func FilterCommentedCode( words []sf.Word, text *tui.TextBuffer, comments []CommentRange, lineBeginTokens []string, ) []sf.Word
FilterCommentedCode attemps to identify commented out code and to remove all matches words inside those comments. This is based on line ending characters and is mainly intended for languages using curly braces and/or semicolons to terminate lines. This also does not work well in continuous lines comments are used instead of block comments as they are all considered separate comments.
func IsWord ¶
IsWord returns true if the string contains at least 2 letters and at most one aposthrophe for words like "don't".
func LexerStateInfoName ¶
func LexerTokenKindName ¶
func LexerTokenKindName(kind TokenKindType) string
Types ¶
type CommentRange ¶
type CommentRange struct {
// contains filtered or unexported fields
}
func (*CommentRange) Contains ¶
func (self *CommentRange) Contains(index tui.SliceIndex) bool
type Dfa ¶
type Dfa struct {
// contains filtered or unexported fields
}
func (*Dfa) CurrentState ¶
func (*Dfa) ForceState ¶
ForceState sets the current state and resets the token.
type DfaState ¶
type DfaState struct {
// contains filtered or unexported fields
}
func (*DfaState) AddTransition ¶
func (*DfaState) MakeRecursive ¶
MakeRecursive turns this state into a recursive state. The descent token increases the recursion depth and ascent decreases it. Either of these do not count as state changes.
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
func (*Token) Kind ¶
func (self *Token) Kind() TokenKindType
type TokenKindType ¶
type TokenKindType int
TokenKindType is the underlying type for the values in TokenKind.
type Transition ¶
type Transition struct {
// contains filtered or unexported fields
}