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§
- Enum
Boolean Init - Boolean literal init value in a Flow enum member.
- Enum
Number Init - Number literal init value in a Flow enum member.
- Enum
String Init - String literal init value in a Flow enum member.
- Flow
Parser - A reusable Flow parser instance backed by QuickJS.
- Function
Type Param - A parameter in a function type annotation.
- Identifier
- An identifier node.
- Interface
Extends - An
extendsclause in an interface declaration or type. - Object
Type Call Property - A call property on an object type (
{ (x: number): string }). - Object
Type Indexer - An indexer on an object type (
[key: K]: V). - Object
Type Internal Slot - An internal slot on an object type (
{ [[call]](x: number): string }). - Parse
Error - 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.
- Source
Location - Source location attached to a parse error.
- Type
Annotation Wrapper - Wrapper node the Flow parser emits around type annotations in certain positions (e.g., type parameter bounds, function parameter types).
- Type
Parameter - A single type parameter in a declaration.
- Type
Parameter Declaration - Type parameter declaration (
<T: Bound, U = Default>). - Type
Parameter Instantiation - Type parameter instantiation (
<T, U>). - Variance
- Variance annotation (
+= plus,-= minus).
Enums§
- Declaration
- A type-level declaration inside an export statement.
- Enum
Body - Body of a Flow enum declaration.
- Enum
Member - A member of a Flow enum body.
- Error
- Flow parser error.
- Object
Member - A member of an object type annotation.
- Property
Key - Property key — either an identifier or a string literal (for quoted keys).
- Statement
- Top-level statement in a Flow program.
- Type
Annotation - A Flow type annotation node.
- Type
Identifier - A type identifier — either a simple
Identifieror a qualifiedA.Breference. - Variance
Kind - Variance direction.