Documentation
¶
Index ¶
- func IsBlock(nodeType string) bool
- func IsCall(nodeType string) bool
- func IsComment(nodeType string) bool
- func IsDeclaration(nodeType string) bool
- func IsDelimiter(nodeType, label string) bool
- func IsFlattened(nodeType string) bool
- func IsFlattenedType(nodeType string) bool
- func IsIdentifier(nodeType string) bool
- func IsKeyword(nodeType, label string) bool
- func IsOperatorLiteral(nodeType string) bool
- func IsScaffolding(nodeType string) bool
- type Rules
- func (r *Rules) Alias(nodeType, label string) (string, bool)
- func (r *Rules) AreTypesEquivalent(t1, t2 string) bool
- func (r *Rules) CompileSets()
- func (r *Rules) DefaultRootType() string
- func (r *Rules) IsBlock(nodeType string) bool
- func (r *Rules) IsCall(nodeType string) bool
- func (r *Rules) IsComment(nodeType string) bool
- func (r *Rules) IsDeclaration(nodeType string) bool
- func (r *Rules) IsDelimiter(nodeType, label string) bool
- func (r *Rules) IsFlattened(nodeType string) bool
- func (r *Rules) IsIdentifier(nodeType string) bool
- func (r *Rules) IsIgnored(nodeType, label string) bool
- func (r *Rules) IsKeyword(nodeType, label string) bool
- func (r *Rules) IsLabelIgnored(nodeType string) bool
- func (r *Rules) IsOperatorLiteral(nodeType string) bool
- func (r *Rules) IsScaffolding(nodeType string) bool
- func (r *Rules) IsScopedDeclaration(nodeType string) bool
- func (r *Rules) IsUnordered(nodeType string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsComment ¶
IsComment reports whether nodeType is configured as a comment in any language rule set.
func IsDeclaration ¶
IsDeclaration reports whether nodeType is configured as a declaration in any language rule set.
func IsDelimiter ¶
IsDelimiter reports whether nodeType or label is a delimiter token (semicolon or comma).
func IsFlattened ¶
IsFlattened reports whether nodeType is configured as flattened in any language rule set.
func IsFlattenedType ¶
IsFlattenedType reports whether nodeType is configured as flattened in any language rule set.
func IsIdentifier ¶
IsIdentifier reports whether nodeType is configured as an identifier in any language rule set.
func IsKeyword ¶
IsKeyword reports whether nodeType or label is configured as a keyword in any language rule set.
func IsOperatorLiteral ¶
IsOperatorLiteral reports whether nodeType is configured as an operator literal in any language rule set.
func IsScaffolding ¶
IsScaffolding reports whether nodeType is configured as scaffolding in any language rule set.
Types ¶
type Rules ¶
type Rules struct {
Flattened []string
Ignored []string
Aliased map[string]string
LabelIgnored []string
Scaffolding []string
Keywords []string
Declarations []string
Identifiers []string
Blocks []string
Pairs []string
Unordered []string
EquivalentTypes [][]string
Comments []string
Calls []string
ScopedDeclarations []string
// contains filtered or unexported fields
}
Rules configures language-specific AST transformations and node matching.
func Get ¶
Get returns the compiled AST rules for a language, or a default empty rule set if none exist.
func (*Rules) Alias ¶
Alias returns the replacement node type if one exists for the label or node type.
func (*Rules) AreTypesEquivalent ¶
AreTypesEquivalent reports whether t1 and t2 belong to the same equivalent_types group.
func (*Rules) CompileSets ¶
func (r *Rules) CompileSets()
CompileSets builds the internal lookup sets for fast querying.
func (*Rules) DefaultRootType ¶
DefaultRootType returns the top-level root AST node type for the language.
func (*Rules) IsDeclaration ¶
IsDeclaration reports whether nodeType is a declaration.
func (*Rules) IsDelimiter ¶
IsDelimiter reports whether nodeType or label is a delimiter token (semicolon or comma).
func (*Rules) IsFlattened ¶
IsFlattened checks if intermediate nodes of this type should merge into their parent.
func (*Rules) IsIdentifier ¶
IsIdentifier reports whether nodeType is an identifier token.
func (*Rules) IsIgnored ¶
IsIgnored checks if a node type or label is filtered out when building the AST.
func (*Rules) IsLabelIgnored ¶
IsLabelIgnored checks if node labels should be dropped for this type.
func (*Rules) IsOperatorLiteral ¶
IsOperatorLiteral reports whether nodeType is an aliased operator literal.
func (*Rules) IsScaffolding ¶
IsScaffolding reports whether nodeType is scaffolding.
func (*Rules) IsScopedDeclaration ¶
IsScopedDeclaration reports whether nodeType is a declaration with an explicit signature receiver or scope.
func (*Rules) IsUnordered ¶
IsUnordered checks if child order doesn't matter for this container.