Documentation ¶
Index ¶
- Variables
- func NewLogger() *zap.SugaredLogger
- func RegisterLang(langType LangType, lang *sitter.Language, suffix string)
- type FileUnit
- type KindRepr
- type LangType
- type Parser
- type Point
- type Query
- type Runner
- type Span
- type Unit
- func DebugDfs(unit *Unit, layer int) *Unit
- func FindAll(unit *Unit) []*Unit
- func FindAllByKindInParent(unit *Unit, kind KindRepr) []*Unit
- func FindAllByKindInSubs(unit *Unit, kind string) []*Unit
- func FindAllByKindInSubsWithBfs(unit *Unit, kind KindRepr) []*Unit
- func FindAllByKindInSubsWithDfs(unit *Unit, kind KindRepr) []*Unit
- func FindAllByKindsInSubs(unit *Unit, kinds ...string) []*Unit
- func FindAllByOneOfKindInParent(unit *Unit, kinds ...KindRepr) []*Unit
- func FindFirstByFieldInSubs(unit *Unit, fieldName string) *Unit
- func FindFirstByFieldInSubsWithBfs(unit *Unit, fieldName string) *Unit
- func FindFirstByFieldInSubsWithDfs(unit *Unit, fieldName string) *Unit
- func FindFirstByKindInParent(unit *Unit, kind KindRepr) *Unit
- func FindFirstByKindInSubsWithBfs(unit *Unit, kind KindRepr) *Unit
- func FindFirstByKindInSubsWithDfs(unit *Unit, kind KindRepr) *Unit
- func FindFirstByOneOfKindInParent(unit *Unit, kinds ...KindRepr) *Unit
- type UnitCache
Constants ¶
This section is empty.
Variables ¶
View Source
var Log = NewLogger()
View Source
var SupportedLangs = []LangType{ LangJava, LangGo, LangPython, LangKotlin, LangJavaScript, }
Functions ¶
func NewLogger ¶
func NewLogger() *zap.SugaredLogger
Types ¶
type LangType ¶
type LangType string
func LangTypeValueOf ¶
func (LangType) GetFileSuffix ¶
func (LangType) GetLanguage ¶
func (LangType) IsSupported ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser
- get almost all the nodes - convert them to units
type Query ¶
type Query struct { IsDfs bool IsTop2Bottom bool Kinds []string FieldNames []string // contains filtered or unexported fields }
func (*Query) Bottom2Top ¶
func (*Query) MatchField ¶
func (*Query) Top2Bottom ¶
type Unit ¶
type Unit struct { Kind KindRepr `json:"kind"` Span Span `json:"span"` FieldName string `json:"fieldName"` Content string `json:"content"` // double linked ParentUnit *Unit SubUnits []*Unit }
Unit
almost a node, but with enough data for analyzer. no need to access raw byte data again
func FindAllByKindInParent ¶
func FindAllByKindInSubs ¶
func FindAllByKindsInSubs ¶
func FindFirstByFieldInSubs ¶
func FindFirstByKindInParent ¶
type UnitCache ¶ added in v0.12.0
type UnitCache struct {
// contains filtered or unexported fields
}
UnitCache
current cache is unlimited
func NewUnitCache ¶ added in v0.12.0
func NewUnitCache() *UnitCache
func (*UnitCache) CreateByData ¶ added in v0.12.0
func (*UnitCache) ReadByData ¶ added in v0.12.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.