You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How do I import lark grammar written in one python project into another.
E.g.
project A has A/grammar.lark file
project B can import A
But
// file called B/superset.py with inline grammar
...
%import A.grammar.SOME_TERMINAL
fails with FileNotFoundError: [Errno 2] No such file or directory: 'A/grammar.lark'
Explain what you're trying to do, and what is obstructing your progress.
I am not sure if there is a nice way to do this. We are able to %import common.<TERMINAL> so I would like to think there should be a way to do this.
The text was updated successfully, but these errors were encountered:
manjrekarom
changed the title
Import lark grammar written in one project into another
Import lark grammar written in one python project into another
Mar 26, 2024
'' can be replaced by a relative path if your grammar files aren't in the top level of the package's folder. You would then import this with %import grammar.SOME_TERMINAL, not %import A.grammar.SOME_TERMINAL.
If A is just a folder somewhere, you can instead provide a path inside of import_paths: Lark(..., import_paths['/some/absolute/path'])
What is your question?
How do I import lark grammar written in one python project into another.
E.g.
project A has
A/grammar.lark
fileproject B can import A
But
fails with
FileNotFoundError: [Errno 2] No such file or directory: 'A/grammar.lark'
Explain what you're trying to do, and what is obstructing your progress.
I am not sure if there is a nice way to do this. We are able to
%import common.<TERMINAL>
so I would like to think there should be a way to do this.The text was updated successfully, but these errors were encountered: