parglare icon indicating copy to clipboard operation
parglare copied to clipboard

Import grammar from Python package

Open igordejanovic opened this issue 6 years ago • 0 comments

Currently grammar can be imported from file system by giving relative path from the importing grammar. In some use-cases one would want to import grammar deployed with some Python package.

In that case additional import variant could be used in the form:

import some.python.module.grammar as a;

grammar should be a python variable of type string, on the module some.python.module, containing a path to the grammar file, like:

grammar = os.path.join(os.path.dirname(__file__), 'grammar.pg')

igordejanovic avatar May 28 '18 15:05 igordejanovic