function createParseErrorFromTextAndCursor
createParseErrorFromTextAndCursor(
text: Text,
cursor: TreeCursor,
): SyntacticParseError

Helper function to create a SyntacticParseError from the text and a cursor positioned at an error node. As the cursor from a parse tree is available, details on missing or unexpected tokens can be extracted.

Parameters

text: Text

The text to parse.

cursor: TreeCursor

The cursor position in the text which should be at an error node.

Return Type

Usage

import { createParseErrorFromTextAndCursor } from ".";