diff --git a/wasm/rico/README.md b/wasm/rico/README.md index a6924f8..a0cb866 100644 --- a/wasm/rico/README.md +++ b/wasm/rico/README.md @@ -28,7 +28,7 @@ async function main() { try { // Parse Thrift IDL to AST with full type information - const ast: Document = await Rico.parse(input); + const ast: Document = await Rico.parse(input, false); // Type-safe access to AST properties ast.members.forEach(member => { @@ -96,7 +96,8 @@ Rico provides a comprehensive type system that exactly matches the Rust AST defi - `Field`: Field definitions in structs/unions/exceptions - `FieldType`: Union type of all possible field types - `CommonType`: Basic types (string, i32, etc.) - - `CollectionType`: Lists and sets + - `FieldSetType`: Sets + - `FieldListType`: Lists - `MapType`: Map types with key and value types ### Value Types @@ -126,7 +127,7 @@ interface Span { ### Type Safety Example ```typescript -import { Document, Struct, Field, FieldType } from '@rico/wasm'; +import { Document, Struct, Field, FieldType } from '@rico-core/parser'; function processStruct(struct: Struct) { // All fields are properly typed diff --git a/wasm/rico/package.json b/wasm/rico/package.json index 1aba054..992ec59 100644 --- a/wasm/rico/package.json +++ b/wasm/rico/package.json @@ -1,6 +1,6 @@ { "name": "@rico-core/parser", - "version": "0.0.3", + "version": "0.0.4", "description": "WebAssembly bindings for Rico - A high-performance Apache Thrift IDL parser", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/wasm/rico/src/types.ts b/wasm/rico/src/types.ts index 7673778..9be35ab 100644 --- a/wasm/rico/src/types.ts +++ b/wasm/rico/src/types.ts @@ -167,8 +167,15 @@ export interface Service extends BaseNode { members: Function[]; } -export interface FieldCollectionType { - kind: 'CollectionType'; +export interface FieldListType { + kind: 'ListType'; + loc: LOC; + value: string; + valueType: FieldType; +} + +export interface FieldSetType { + kind: 'SetType'; loc: LOC; value: string; valueType: FieldType; @@ -184,7 +191,8 @@ export interface FieldMapType { export type FieldType = | { kind: 'CommonType'; value: string; loc: LOC } - | FieldCollectionType + | FieldListType + | FieldSetType | FieldMapType; export interface ConstList {