Skip to content

Commit

Permalink
doc: update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
xnmeet committed Jan 6, 2025
1 parent 37f1575 commit df540c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 4 additions & 3 deletions wasm/rico/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion wasm/rico/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
14 changes: 11 additions & 3 deletions wasm/rico/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -184,7 +191,8 @@ export interface FieldMapType {

export type FieldType =
| { kind: 'CommonType'; value: string; loc: LOC }
| FieldCollectionType
| FieldListType
| FieldSetType
| FieldMapType;

export interface ConstList {
Expand Down

0 comments on commit df540c6

Please sign in to comment.