Skip to content

Commit 7120d60

Browse files
committed
Move symbols into src package
Part of the refact
1 parent 7c23ece commit 7120d60

63 files changed

Lines changed: 69 additions & 72 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

arch/zx48k/translator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
from . import backend
2727
from .backend.__float import _float
2828

29-
import symbols
30-
from symbols.type_ import Type
29+
from src import symbols
30+
from src.symbols.type_ import Type
3131
from .translatorvisitor import TranslatorVisitor
3232

3333
import arch.zx48k # TODO: put this in global

arch/zx48k/translatorinstvisitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
from src.api.constants import TYPE
4-
import symbols
4+
from src import symbols
55

66
from ast_ import NodeVisitor
77
from .backend import Quad, MEMORY

arch/zx48k/translatorvisitor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
from src.api.constants import SCOPE
1212
import src.api.global_ as gl
1313

14-
from symbols.symbol_ import Symbol
15-
from symbols.type_ import Type
14+
from src.symbols.symbol_ import Symbol
15+
from src.symbols.type_ import Type
1616

1717
from . import backend
18-
import symbols
18+
from src import symbols
1919

2020
from src.api.errors import InvalidOperatorError
2121

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ packages = [
3737
{ include = "ast_" },
3838
{ include = "outfmt" },
3939
{ include = "ply" },
40-
{ include = "symbols" },
4140
{ include = "libzxbasm" },
4241
{ include = "libzxbpp" },
4342
]

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
'libzxbpp',
1515
'libzxbpp.prepro',
1616
'outfmt',
17-
'ply',
18-
'symbols'
17+
'ply'
1918
]
2019

2120
# The directory containing this file

src/api/check.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def check_is_declared_explicit(lineno, id_, classname='variable'):
7878

7979

8080
def check_type_is_explicit(lineno: int, id_: str, type_):
81-
from symbols.type_ import SymbolTYPE
81+
from src.symbols.type_ import SymbolTYPE
8282
assert isinstance(type_, SymbolTYPE)
8383
if type_.implicit:
8484
if config.OPTIONS.strict:
@@ -114,7 +114,7 @@ def check_call_arguments(lineno, id_, args):
114114
return False
115115

116116
if param.byref:
117-
from symbols.var import SymbolVAR
117+
from src.symbols.var import SymbolVAR
118118
if not isinstance(arg.value, SymbolVAR):
119119
error(lineno, "Expected a variable name, not an expression (parameter By Reference)")
120120
return False
@@ -210,7 +210,7 @@ def is_null(*symbols):
210210
""" True if no nodes or all the given nodes are either
211211
None, NOP or empty blocks. For blocks this applies recursively
212212
"""
213-
from symbols.symbol_ import Symbol
213+
from src.symbols.symbol_ import Symbol
214214

215215
for sym in symbols:
216216
if sym is None:
@@ -231,7 +231,7 @@ def is_SYMBOL(token, *symbols):
231231
""" Returns True if ALL of the given argument are AST nodes
232232
of the given token (e.g. 'BINARY')
233233
"""
234-
from symbols.symbol_ import Symbol
234+
from src.symbols.symbol_ import Symbol
235235
assert all(isinstance(x, Symbol) for x in symbols)
236236
for sym in symbols:
237237
if sym.token != token:
@@ -295,7 +295,7 @@ def is_var(*p):
295295

296296

297297
def is_integer(*p):
298-
from symbols.type_ import Type
298+
from src.symbols.type_ import Type
299299

300300
try:
301301
for i in p:
@@ -312,7 +312,7 @@ def is_integer(*p):
312312
def is_unsigned(*p):
313313
""" Returns false unless all types in p are unsigned
314314
"""
315-
from symbols.type_ import Type
315+
from src.symbols.type_ import Type
316316

317317
try:
318318
for i in p:
@@ -329,7 +329,7 @@ def is_unsigned(*p):
329329
def is_signed(*p):
330330
""" Returns false unless all types in p are signed
331331
"""
332-
from symbols.type_ import Type
332+
from src.symbols.type_ import Type
333333

334334
try:
335335
for i in p:
@@ -346,7 +346,7 @@ def is_signed(*p):
346346
def is_numeric(*p):
347347
""" Returns false unless all elements in p are of numerical type
348348
"""
349-
from symbols.type_ import Type
349+
from src.symbols.type_ import Type
350350

351351
try:
352352
for i in p:
@@ -379,7 +379,7 @@ def is_dynamic(*p): # TODO: Explain this better
379379
""" True if all args are dynamic (e.g. Strings, dynamic arrays, etc)
380380
The use a ptr (ref) and it might change during runtime.
381381
"""
382-
from symbols.type_ import Type
382+
from src.symbols.type_ import Type
383383

384384
try:
385385
for i in p:
@@ -397,7 +397,7 @@ def is_dynamic(*p): # TODO: Explain this better
397397
def is_callable(*p):
398398
""" True if all the args are functions and / or subroutines
399399
"""
400-
import symbols
400+
from .. import symbols
401401
return all(isinstance(x, symbols.FUNCTION) for x in p)
402402

403403

@@ -427,9 +427,9 @@ def common_type(a, b):
427427
""" Returns a type which is common for both a and b types.
428428
Returns None if no common types allowed.
429429
"""
430-
from symbols.type_ import SymbolBASICTYPE as BASICTYPE
431-
from symbols.type_ import Type as TYPE
432-
from symbols.type_ import SymbolTYPE
430+
from src.symbols.type_ import SymbolBASICTYPE as BASICTYPE
431+
from src.symbols.type_ import Type as TYPE
432+
from src.symbols.type_ import SymbolTYPE
433433

434434
if a is None or b is None:
435435
return None

src/api/optimize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import src.api.check as chk
99
from src.api.constants import TYPE, SCOPE, CLASS
1010
import src.api.global_ as gl
11-
import symbols
11+
from .. import symbols
1212
import types
1313
from src.api.debug import __DEBUG__
1414
from src.api.errmsg import warning_not_used

src/api/symboltable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
from .debug import __DEBUG__
1515

16-
import symbols
17-
from symbols.symbol_ import Symbol
16+
from .. import symbols
17+
from src.symbols.symbol_ import Symbol
1818

1919
from . import global_
2020
from .config import OPTIONS

src/api/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
from . import errmsg
1414
from . import check
1515

16-
import symbols
17-
16+
from .. import symbols
1817

1918
__all__ = [
2019
'read_txt_file',

src/libzxbc/zxbparser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
import src.api.utils
4848

4949
# Symbol Classes
50-
import symbols
51-
from symbols.type_ import Type as TYPE
52-
from symbols.symbol_ import Symbol
50+
from src import symbols
51+
from src.symbols.type_ import Type as TYPE
52+
from src.symbols.symbol_ import Symbol
5353

5454
# Global containers
5555
from src.api import global_ as gl

0 commit comments

Comments
 (0)