parseFileOrThrow()
parseFileOrThrow(
filePath,options?):Program
Defined in: parser/src/parse.ts:336
Parse a PromptScript file from disk, throwing on error.
Parameters
filePath
string
Path to the .prs file
options?
Omit<ParseOptions, "filename"> = {}
Parsing options
Returns
The parsed Program AST
Throws
If reading or parsing fails
Example
try { const ast = parseFileOrThrow('./project.prs'); console.log(ast.meta?.fields.id);} catch (error) { console.error('Failed:', error);}