# Class AST

- Defined in src/core/parse/ast/ast.js:23

##### Index

### Constructors

constructor

### Properties

lexer
selfReferential
text
tokens

### Methods

additive
arrayDeclaration
assignment
ast
constant
consume
equality
expect
expressionStatement
filter
filterChain
identifier
logicalAND
logicalOR
multiplicative
object
parseArguments
peek
peekAhead
peekToken
primary
program
relational
ternary
throwError
unary

## Constructors

### constructor

- new AST(lexer: Lexer): AST

  #### Parameters

  - lexer: Lexer

    The lexer instance for tokenizing input

  #### Returns AST

  - Defined in src/core/parse/ast/ast.js:27

## Properties

### lexer

lexer: Lexer

- Defined in src/core/parse/ast/ast.js:29

### selfReferential

selfReferential: { $locals: { type: number }; this: { type: number } }

- Defined in src/core/parse/ast/ast.js:30

### text

text: string

- Defined in src/core/parse/ast/ast.js:42

### tokens

tokens: Token[]

- Defined in src/core/parse/ast/ast.js:43

## Methods

### additive

- additive(): ASTNode

  Parses an additive expression.

  #### Returns ASTNode

  The additive expression node.

  - Defined in src/core/parse/ast/ast.js:209

### arrayDeclaration

- arrayDeclaration(): ASTNode

  Parses an array declaration.

  #### Returns ASTNode

  The array declaration node.

  - Defined in src/core/parse/ast/ast.js:401

### assignment

- assignment(): ASTNode

  Parses an assignment expression.

  #### Returns ASTNode

  The assignment expression node.

  - Defined in src/core/parse/ast/ast.js:95

### ast

- ast(text: string): ASTNode

  Parses the input text and generates an AST.

  #### Parameters

  - text: string

    The input text to parse.

  #### Returns ASTNode

  The root node of the AST.

  - Defined in src/core/parse/ast/ast.js:41

### constant

- constant(): ASTNode

  Parses a constant.

  #### Returns ASTNode

  The constant node.

  - Defined in src/core/parse/ast/ast.js:392

### consume

- consume(e1?: string): Token

  Consumes a token if it matches the expected type.

  #### Parameters

  - `Optional` e1: string

    The expected token type.

  #### Returns Token

  The consumed token.

  - Defined in src/core/parse/ast/ast.js:497

### equality

- equality(): ASTNode

  Parses an equality expression.

  #### Returns ASTNode

  The equality expression node.

  - Defined in src/core/parse/ast/ast.js:173

### expect

- expect(...expected?: string[]): boolean | Token

  Consumes the next token if it matches any of the expected types.

  #### Parameters

  - `Optional`...expected: string[]

    The expected token types.

  #### Returns boolean | Token

  The consumed token if it matches, otherwise false.

  - Defined in src/core/parse/ast/ast.js:566

### expressionStatement

- expressionStatement(): ASTNode

  Parses an expression statement.

  #### Returns ASTNode

  The expression statement node.

  - Defined in src/core/parse/ast/ast.js:72

### filter

- filter(baseExpression: ASTNode): ASTNode

  Parses a filter.

  #### Parameters

  - baseExpression: ASTNode

    The base expression to apply the filter to.

  #### Returns ASTNode

  The filter node.

  - Defined in src/core/parse/ast/ast.js:344

### filterChain

- filterChain(): ASTNode

  Parses a filter chain.

  #### Returns ASTNode

  The filter chain node.

  - Defined in src/core/parse/ast/ast.js:83

### identifier

- identifier(): ASTNode

  Parses an identifier.

  #### Returns ASTNode

  The identifier node.

  - Defined in src/core/parse/ast/ast.js:380

### logicalAND

- logicalAND(): ASTNode

  Parses a logical AND expression.

  #### Returns ASTNode

  The logical AND expression node.

  - Defined in src/core/parse/ast/ast.js:156

### logicalOR

- logicalOR(): ASTNode

  Parses a logical OR expression.

  #### Returns ASTNode

  The logical OR expression node.

  - Defined in src/core/parse/ast/ast.js:139

### multiplicative

- multiplicative(): ASTNode

  Parses a multiplicative expression.

  #### Returns ASTNode

  The multiplicative expression node.

  - Defined in src/core/parse/ast/ast.js:227

### object

- object(): ASTNode

  Parses an object.

  #### Returns ASTNode

  The object node.

  - Defined in src/core/parse/ast/ast.js:422

### parseArguments

- parseArguments(): ASTNode[]

  Parses function arguments.

  #### Returns ASTNode[]

  The arguments array.

  - Defined in src/core/parse/ast/ast.js:365

### peek

- peek(...expected?: string[]): boolean | Token

  Checks if the next token matches any of the expected types.

  #### Parameters

  - `Optional`...expected: string[]

    The expected token types.

  #### Returns boolean | Token

  The next token if it matches, otherwise false.

  - Defined in src/core/parse/ast/ast.js:537

### peekAhead

- peekAhead(i: number, ...expected?: string[]): boolean | Token

  Checks if the token at the specified index matches any of the expected types.

  #### Parameters

  - i: number

    The index to check.

  - `Optional`...expected: string[]

    The expected token types.

  #### Returns boolean | Token

  The token at the specified index if it matches, otherwise false.

  - Defined in src/core/parse/ast/ast.js:547

### peekToken

- peekToken(): Token

  Returns the next token without consuming it.

  #### Returns Token

  The next token.

  - Defined in src/core/parse/ast/ast.js:521

### primary

- primary(): ASTNode

  Parses a primary expression.

  #### Returns ASTNode

  The primary expression node.

  - Defined in src/core/parse/ast/ast.js:262

### program

- program(): ASTNode

  Parses a program.

  #### Returns ASTNode

  The program node.

  - Defined in src/core/parse/ast/ast.js:55

### relational

- relational(): ASTNode

  Parses a relational expression.

  #### Returns ASTNode

  The relational expression node.

  - Defined in src/core/parse/ast/ast.js:191

### ternary

- ternary(): ASTNode

  Parses a ternary expression.

  #### Returns ASTNode

  The ternary expression node.

  - Defined in src/core/parse/ast/ast.js:116

### throwError

- throwError(msg: string, token?: Token): void

  Throws a syntax error.

  #### Parameters

  - msg: string

    The error message.

  - `Optional` token: Token

    The token that caused the error.

  #### Returns void

  - Defined in src/core/parse/ast/ast.js:480

### unary

- unary(): ASTNode

  Parses a unary expression.

  #### Returns ASTNode

  The unary expression node.

  - Defined in src/core/parse/ast/ast.js:245