Crate oxc_ast

Source
Expand description

§Oxc AST (Abstract Syntax Tree) Nodes

Supports JavaScript, TypeScript and JSX.

§Types

AST types are similar to estree and typescript-eslint’s definition, with a few notable exceptions:

Field order of types follows “Evaluation order” defined by ECMAScript spec. For TypeScript types, we follow how field order is defined in tsc.

Oxc’s visitors (Visit, VisitMut, Traverse) visit AST node fields in same order as they are defined in the types here.

§Parsing

You can obtain an AST by parsing source code with a Parser from oxc_parser.

§Cargo Features

  • "serialize" enables support for serialization to ESTree JSON

Modules§

ast
AST Definitions
ast_builder
AST node factories
ast_kind
precedence
Expression precedence trait implementations.

Macros§

match_assignment_target
Macro for matching AssignmentTarget’s variants. Includes SimpleAssignmentTarget’s and AssignmentTargetPattern’s variants.
match_assignment_target_pattern
Macro for matching AssignmentTargetPattern’s variants.
match_declaration
Macro for matching Declaration’s variants.
match_expression
Macro for matching Expression’s variants. Includes MemberExpression’s variants.
match_member_expression
Macro for matching MemberExpression’s variants.
match_module_declaration
Macro for matching ModuleDeclaration’s variants.
match_simple_assignment_target
Macro for matching SimpleAssignmentTarget’s variants. Includes MemberExpression’s variants
match_ts_type
Macro for matching TSType’s variants.
match_ts_type_name
Macro for matching TSTypeName’s variants.

Structs§

AstBuilder
AST builder for creating AST nodes
Comment
A comment in source code.
CommentsRange
Double-ended iterator over a range of comments, by starting position.
NONE
Type that can be used in any AST builder method call which requires an IntoIn<'a, Anything<'a>>. Pass NONE instead of None::<Anything<'a>>.

Enums§

AstKind
Untyped AST Node Kind
AstType
CommentAnnotation
Annotation comment that has special meaning.
CommentKind
Indicates a line or block comment.
CommentPosition
Information about a comment’s position relative to a token.

Functions§

comments_range
has_comments_between