Wraps a parser so that its result includes span information (start and end positions). Useful for building ASTs with location data for language servers / editors. Requires setInputStr to have been called with the full input.
setInputStr
const locatedWord = withSpan(word);// Result: { value: "hello", span: { start: { offset: 0, line: 0, column: 0 }, end: { offset: 5, line: 0, column: 5 } } } Copy
const locatedWord = withSpan(word);// Result: { value: "hello", span: { start: { offset: 0, line: 0, column: 0 }, end: { offset: 5, line: 0, column: 5 } } }
Generated using TypeDoc
Wraps a parser so that its result includes span information (start and end positions). Useful for building ASTs with location data for language servers / editors. Requires
setInputStrto have been called with the full input.