UNPKG

meld-spec

Version:

Specification for the Meld scripting language

26 lines (25 loc) 662 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateSyntax = validateSyntax; /** * Validate the syntax of a Meld document string * @param parser The parser implementation to use * @param input The Meld document string to validate * @returns The validation result */ function validateSyntax(parser, input) { try { const ast = parser.parse(input); return { valid: true, errors: [], ast }; } catch (error) { return { valid: false, errors: [error instanceof Error ? error.message : String(error)] }; } }