zignet
Version:
MCP server for Zig — AI-powered code analysis, validation, and documentation with fine-tuned LLM
152 lines (150 loc) • 2.9 kB
TypeScript
import { t as Program } from "./ast-DVcyx7L5.js";
import { n as Token } from "./lexer-ZF4wP4Kq.js";
//#region src/parser.d.ts
/**
* Parser error class
*/
declare class ParseError extends Error {
token: Token;
constructor(message: string, token: Token);
toString(): string;
}
/**
* Parser class
*/
declare class Parser {
private tokens;
private position;
constructor(tokens: Token[]);
/**
* Parse the entire program
*/
parse(): Program;
/**
* Parse a top-level declaration
*/
private parseDeclaration;
/**
* Parse function declaration
*/
private parseFunctionDeclaration;
/**
* Parse function parameters
*/
private parseParameters;
/**
* Parse variable declaration
*/
private parseVariableDeclaration;
/**
* Parse type annotation
*/
private parseTypeAnnotation;
/**
* Parse block statement
*/
private parseBlockStatement;
/**
* Parse statement
*/
private parseStatement;
/**
* Parse return statement
*/
private parseReturnStatement;
/**
* Parse if statement
*/
private parseIfStatement;
/**
* Parse while statement
*/
private parseWhileStatement;
/**
* Parse comptime statement
*/
private parseComptimeStatement;
/**
* Parse expression statement
*/
private parseExpressionStatement;
/**
* Parse expression (starting point for precedence climbing)
*/
private parseExpression;
/**
* Parse assignment expression
*/
private parseAssignment;
/**
* Parse logical OR expression
*/
private parseLogicalOr;
/**
* Parse logical AND expression
*/
private parseLogicalAnd;
/**
* Parse equality expression (==, !=)
*/
private parseEquality;
/**
* Parse comparison expression (<, >, <=, >=)
*/
private parseComparison;
/**
* Parse addition/subtraction expression
*/
private parseAddition;
/**
* Parse multiplication/division expression
*/
private parseMultiplication;
/**
* Parse unary expression (-, !)
*/
private parseUnary;
/**
* Parse postfix expression (call, member access, index)
*/
private parsePostfix;
/**
* Parse primary expression (literals, identifiers, grouped expressions)
*/
private parsePrimary;
/**
* Check if current token matches any of the given types
*/
private match;
/**
* Check if current token is of given type
*/
private check;
/**
* Consume current token if it matches expected type, otherwise throw error
*/
private consume;
/**
* Advance to next token
*/
private advance;
/**
* Check if at end of token stream
*/
private isAtEnd;
/**
* Get current token
*/
private current;
/**
* Get previous token
*/
private previous;
/**
* Create a parse error
*/
private error;
}
//#endregion
export { ParseError, Parser };
//# sourceMappingURL=parser.d.ts.map