Skip to content

parseFile()

PromptScript API


parseFile(filePath, options?): ParseResult

Defined in: parser/src/parse.ts:259

Parse a PromptScript file from disk.

Parameters

filePath

string

Path to the .prs file

options?

Omit<ParseOptions, "filename"> = {}

Parsing options (filename defaults to filePath)

Returns

ParseResult

ParseResult with AST and any errors

Example

const result = parseFile('./project.prs');
if (result.errors.length === 0) {
console.log(result.ast);
}