Skip to main content

Crate flowjs_parser

Crate flowjs_parser 

Source
Expand description

Typed Rust bindings for Facebook’s Flow parser via QuickJS.

use flowjs_parser::FlowParser;

let parser = FlowParser::new().unwrap();

// Parse and get a typed AST
let ast = parser.parse("type Foo = string;").unwrap();

// Validate that source is syntactically valid Flow
parser.validate("type Bar = {| +x: number |}").unwrap();

Structs§

EnumBooleanInit
Boolean literal init value in a Flow enum member.
EnumNumberInit
Number literal init value in a Flow enum member.
EnumStringInit
String literal init value in a Flow enum member.
FlowParser
A reusable Flow parser instance backed by QuickJS.
FunctionTypeParam
A parameter in a function type annotation.
Identifier
An identifier node.
InterfaceExtends
An extends clause in an interface declaration or type.
ObjectTypeCallProperty
A call property on an object type ({ (x: number): string }).
ObjectTypeIndexer
An indexer on an object type ([key: K]: V).
ObjectTypeInternalSlot
An internal slot on an object type ({ [[call]](x: number): string }).
ParseError
A parse error reported by the Flow parser.
Position
Line and column (both 1-based for line, 0-based for column, matching Flow convention).
Program
Root AST node returned by the Flow parser.
SourceLocation
Source location attached to a parse error.
TypeAnnotationWrapper
Wrapper node the Flow parser emits around type annotations in certain positions (e.g., type parameter bounds, function parameter types).
TypeParameter
A single type parameter in a declaration.
TypeParameterDeclaration
Type parameter declaration (<T: Bound, U = Default>).
TypeParameterInstantiation
Type parameter instantiation (<T, U>).
Variance
Variance annotation (+ = plus, - = minus).

Enums§

Declaration
A type-level declaration inside an export statement.
EnumBody
Body of a Flow enum declaration.
EnumMember
A member of a Flow enum body.
Error
Flow parser error.
ObjectMember
A member of an object type annotation.
PropertyKey
Property key — either an identifier or a string literal (for quoted keys).
Statement
Top-level statement in a Flow program.
TypeAnnotation
A Flow type annotation node.
TypeIdentifier
A type identifier — either a simple Identifier or a qualified A.B reference.
VarianceKind
Variance direction.