Skip to main content

Crate flowjs_parser

Crate flowjs_parser 

Source
Expand description

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

use flow_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§

FlowParser
A reusable Flow parser instance backed by QuickJS.
Identifier
An identifier node.
ObjectTypeIndexer
An indexer on an object type ([key: K]: V).
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.
TypeParameterInstantiation
Type parameter instantiation (<T, U>).
Variance
Variance annotation (+ = plus, - = minus).

Enums§

Declaration
A type-level declaration inside an export statement.
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.
VarianceKind
Variance direction.