Skip to content

Commit 118bd14

Browse files
committed
refactor: move grammar file into module
1 parent 7b270f7 commit 118bd14

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
include grammar/*.lark
1+
include lc3asm/grammar/*.lark
22
include requirements.txt
File renamed without changes.

lc3asm/parsing.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
from pathlib import Path
2+
13
from lark import Lark, Tree
24

35

46
def _create_parser() -> Lark:
5-
with open('./grammar/lc3_assembly.lark', 'r') as file:
7+
base_path = Path(__file__).parent.resolve()
8+
with open(base_path / 'grammar/lc3_assembly.lark', 'r') as file:
69
lc3_asm_grammar = file.read()
710
return Lark(lc3_asm_grammar)
811

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setup(
1616
name='lc3asm',
17-
version='0.0.1',
17+
version='0.0.2',
1818
author='d0rj',
1919
python_requires='>=3.6',
2020
classifiers=[
@@ -36,4 +36,5 @@
3636
'grammar': ['grammar/lc3_assembly.lark'],
3737
'requirements': ['requirements.txt']
3838
},
39+
include_package_data=True,
3940
)

0 commit comments

Comments
 (0)