# types/syntax.types.ts

> 32 lines of code and 5 definitions.

Tree: Code Parse
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/code-parse#file-code-parse-types-syntax-types-ts
Source text: https://banes-lab.com/source/code-parse/types/syntax.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/code-parse/types.md), after [types/shell.types.ts](https://banes-lab.com/source/code-parse/types/shell.types.ts.md).

## Definitions

- `CstNode` (interface_declaration, line 1, exported)
- `RawNode` (interface_declaration, line 13, exported)
- `ParseLogger` (interface_declaration, line 25, exported)
- `CodeParseOptions` (interface_declaration, line 29, exported)
- `ParseAttempt` (interface_declaration, line 33, exported)

## Contained in

- [types](https://banes-lab.com/anatomy/code-parse/folder-code-parse-types.md)

## Source

```typescript
export interface CstNode {
    type: string;
    isNamed: boolean;
    childCount: number;
    child: (index: number) => CstNode | null;
    text?: string;
    startPosition?: { row: number; column: number };
    startIndex?: number;
    endIndex?: number;
    childForFieldName?: (field: string) => CstNode | null;
}

export interface RawNode {
    type: string;
    childCount: number;
    isNamed: boolean | (() => boolean);
    child: (index: number) => RawNode | null;
    text?: string;
    startPosition?: { row: number; column: number };
    startIndex: number;
    endIndex: number;
    fieldNameForChild?: (index: number) => string | null;
}

export interface ParseLogger {
    warn: (message: string, detail?: unknown) => void;
}

export interface CodeParseOptions {
    logger?: ParseLogger;
}

export interface ParseAttempt {
    readonly root: CstNode | null;
    readonly complete: boolean;
}
```
