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:
Identifier
is replaced with explicitBindingIdentifier
,IdentifierReference
,IdentifierName
, per ECMAScript Specification.AssignmentExpression
.left
Pattern
is replaced withAssignmentTarget
.Literal
is replaced withBooleanLiteral
,NumericLiteral
,StringLiteral
etc.
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. IncludesSimpleAssignmentTarget
’s andAssignmentTargetPattern
’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. IncludesMemberExpression
’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. IncludesMemberExpression
’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.
- Comments
Range - 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>>
. PassNONE
instead ofNone::<Anything<'a>>
.
Enums§
- AstKind
- Untyped AST Node Kind
- AstType
- Comment
Annotation - Annotation comment that has special meaning.
- Comment
Kind - Indicates a line or block comment.
- Comment
Position - Information about a comment’s position relative to a token.