How do you use externalTokenizers / ContextTrackers with an in-memory buildParser?


I am trying to use an in-memory parser for playing around with the lezer indent example.

The problem I have come to is the line import {indent, dedent} from "./indent.grammar.terms.

Since the indent.grammar.terms file isnt being generated with buildParser, how do you access indent/dedent in the tokens.js file?

Thank you for the help.

You generally don’t want to use buildParser in production, since parser generation should really be an ahead-of-time process. That function is mostly there to make testing easier. buildParserFile builds both a parser and a terms file. But if you really want to, you can use the terms argument to the functions passed as options to buildParser to get access to the term table.

1 Like

Thank you!