parseOrThrow()
parseOrThrow(
source,options?):Program
Defined in: parser/src/parse.ts:231
Parse PromptScript source code into an AST, throwing on error.
Parameters
source
string
The PromptScript source code to parse
options?
Parsing options
Returns
The parsed Program AST
Throws
If parsing fails
Example
try { const ast = parseOrThrow(source, { filename: 'project.prs' }); console.log(ast.meta?.fields.id);} catch (error) { console.error('Parse failed:', error);}