Module syntax

Source
Expand description

Analyzing the syntax of a source file.

This module must hide all AST details from the rest of the codebase.

Modules§

comment
Convenient utilities to match comment in code.
def
Definitions of syntax structures.
import
Import resolution utilities.
matcher
Convenient utilities to match syntax structures of code.

Structs§

ApplyExpr
Represents a function application expression.
ArgsExpr
Represents an arguments expression.
BinInst
A binary operation type.
CommentGroupMatcher
A matcher that groups comments.
ContentRefExpr
Represents a content reference expression.
ContentSeqExpr
Represents a content sequence expression.
DocCommentMatcher
A matcher that collects documentation comments.
DocsDecl
A documentation declaration linking a base declaration with type variables.
ElementExpr
Represents an element expression.
ExprInfo
Information about expressions in a source file.
ExprInfoRepr
Representation of ExprInfo for a specific file.
ForExpr
Represents a for loop expression.
FuncExpr
Represents a function expression.
GeneratedDecl
A generated declaration with a unique definition ID.
IfExpr
Represents a conditional (if) expression.
ImportExpr
Represents an import expression.
IncludeExpr
Represents an include expression.
IndexInfo
The information for the index.
InterpretModeIter
An iterator over the variants of InterpretMode
LetExpr
Represents a let binding expression.
ModuleDecl
A module declaration with name and file ID.
ModuleDependency
The dependency information of a module (file).
NameRangeDecl
A declaration with a name and range information.
PatternSig
Signature pattern for function parameters.
RefExpr
Represents a reference expression.
SelectExpr
Represents a field selection expression.
SetExpr
Represents a set rule expression.
ShowExpr
Represents a show rule expression.
SpanDecl
A span-only declaration for anonymous constructs.
SpannedDecl
A declaration with an associated name and span location.
SurroundingSyntaxIter
An iterator over the variants of SurroundingSyntax
UnInst
A unary operation type.
WhileExpr
Represents a while loop expression.

Enums§

ArgClass
Classes of arguments that can be operated on by IDE functionality.
ArgExpr
Represents different kinds of function arguments.
BadCompletionCursor
The cursor is on an invalid position for completion.
CommentGroupSignal
A signal raised by the comment group matcher.
Decl
Represents different kinds of declarations in the language.
DefClass
Classes of def items that can be operated on by IDE functionality.
DefKind
Kind of a definition.
Expr
Represents different kinds of expressions in the language.
ExprScope
Different types of scopes for expression evaluation.
FieldClass
Classes of field syntax that can be operated on by IDE functionality.
InterpretMode
A mode in which a text document is interpreted.
LexicalKind
The kind of a lexical hierarchy recogized by the analyzers.
LexicalVarKind
The kind of a variable.
Pattern
Represents different kinds of patterns for destructuring.
PreviousDecl
A declaration that is an ancestor of the given node or the previous sibling of some ancestor.
PreviousItem
A node that is an ancestor of the given node or the previous sibling of some ancestor.
SurroundingSyntax
Classes of syntax context (outer syntax) that can be operated on by IDE
SyntaxClass
Classes of syntax that can be operated on by IDE functionality.
SyntaxContext
Classes of syntax context (outer syntax) that can be operated on by IDE functionality.
UnaryOp
The kind of unary operation.
VarClass
Classes of variable (access) syntax that can be operated on by IDE functionality.

Functions§

adjust_expr
Adjusts an expression node to a more suitable one for classification. It is not formal, but the following cases are forbidden:
bad_completion_cursor
Checks if the cursor is on an invalid position for completion.
cast_include_expr
Casts a node to a single include expression.
classify_context
Classifies the context (outer syntax) of the node that can be operated on by IDE functionality.
classify_context_outer
Classifies the context (outer syntax) of the node by the outer node that can be operated on by IDE functionality.
classify_def
Classifies a definition strictly.
classify_def_loosely
Classifies a definition loosely.
classify_syntax
Classifies node’s syntax (inner syntax) that can be operated on by IDE functionality.
construct_module_dependencies
Construct the module dependencies of the given context.
find_module_level_docs
Extracts the module-level documentation from a source.
find_source_by_expr
Finds a source instance by its import node.
first_ancestor_expr
Finds the first ancestor node that is an expression.
get_index_info
Gets the index information for the source.
interpret_mode_at
Determines the interpretation mode at the given position (context-sensitive).
is_ident_like
Checks if the node can be recognized as an identifier.
is_mark
Checks if the node can be recognized as a mark.
node_ancestors
Returns the ancestor iterator of the given node.
previous_decls
Finds the previous declarations starting from the given position. It checks PreviousItem and returns the found declarations.
previous_items
Finds the previous items (in the scope) starting from the given position inclusively. See PreviousItem for the possible items.
resolve_id_by_path
Resolves a file id by its import path.
surrounding_syntax
Determines the surrounding syntax of the node at the given position.

Type Aliases§

BinExpr
Type alias for binary expressions.
BinaryOp
Type alias for binary operation types.
DeclExpr
Type alias for declaration expressions.
ExportMap
Type alias for export maps.
ExprRoute
Maps file identifiers to their lexical scopes for expression analysis routing.
LexicalScope
Type alias for lexical scopes.
UnExpr
Type alias for unary expressions.