Skip to content

Commit 9b7fa9f

Browse files
committed
Move core namespace to .core
1 parent da96558 commit 9b7fa9f

6 files changed

Lines changed: 18 additions & 20 deletions

File tree

src/api/global_.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
# ----------------------------------------------------------------------
121121
# CORE namespace (for core runtime library, like FP Calc)
122122
# ----------------------------------------------------------------------
123-
CORE_NAMESPACE = 'core'
123+
CORE_NAMESPACE = '.core'
124124

125125
# ----------------------------------------------------------------------
126126
# DATA Labels namespace
@@ -135,8 +135,8 @@
135135
# ----------------------------------------------------------------------
136136
# USER DATA LABELS
137137
# ----------------------------------------------------------------------
138-
ZXBASIC_USER_DATA = f".{CORE_NAMESPACE}.ZXBASIC_USER_DATA"
139-
ZXBASIC_USER_DATA_LEN = f".{CORE_NAMESPACE}.ZXBASIC_USER_DATA_LEN"
138+
ZXBASIC_USER_DATA = f"{CORE_NAMESPACE}.ZXBASIC_USER_DATA"
139+
ZXBASIC_USER_DATA_LEN = f"{CORE_NAMESPACE}.ZXBASIC_USER_DATA_LEN"
140140

141141

142142
# ----------------------------------------------------------------------

src/arch/zx48k/backend/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
END_LABEL = f'{NAMESPACE}.__END_PROGRAM'
125125
CALL_BACK = f'{NAMESPACE}.__CALL_BACK__'
126126
MAIN_LABEL = f'{NAMESPACE}.__MAIN_PROGRAM__'
127-
DATA_LABEL = global_.ZXBASIC_USER_DATA.lstrip('.')
128-
DATA_END_LABEL = f'{DATA_LABEL}_END'.lstrip('.')
127+
DATA_LABEL = global_.ZXBASIC_USER_DATA
128+
DATA_END_LABEL = f'{DATA_LABEL}_END'
129129

130130
# Whether to use the FunctionExit scheme
131131
FLAG_use_function_exit = False

src/arch/zx48k/library-asm/heapinit.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
; An init directive is useful for initialization routines.
6666
; They will be added automatically if needed.
6767

68-
#init "core.__MEM_INIT"
68+
#init ".core.__MEM_INIT"
6969

7070

7171
; ---------------------------------------------------------------------

src/arch/zx48k/library-asm/print.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
; Putting a comment starting with @INIT <address>
2222
; will make the compiler to add a CALL to <address>
2323
; It is useful for initialization routines.
24-
#init core.__PRINT_INIT
24+
#init .core.__PRINT_INIT
2525

2626
push namespace core
2727

src/zxbasm/asmparse.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
import os
1515

16+
from typing import Any
1617
from typing import List
1718
from typing import Optional
1819
from typing import Tuple
20+
from typing import NamedTuple
1921

2022
import src.ply.yacc as yacc
2123
import src.api.utils
@@ -192,15 +194,11 @@ def argval(self):
192194
return super(Asm, self).argval()
193195

194196

195-
class Container(object):
197+
class Container(NamedTuple):
196198
""" Single class container
197199
"""
198-
199-
def __init__(self, item, lineno):
200-
""" Item to store
201-
"""
202-
self.item = item
203-
self.lineno = lineno
200+
item: Any
201+
lineno: int
204202

205203

206204
class Expr(Ast):
@@ -329,7 +327,7 @@ def makenode(cls, symbol, *nexts):
329327
return result
330328

331329

332-
class Label(object):
330+
class Label:
333331
""" A class to store Label information (NAME, linenumber and Address)
334332
"""
335333

@@ -384,7 +382,7 @@ def name(self):
384382
return self._name
385383

386384

387-
class Memory(object):
385+
class Memory:
388386
""" A class to describe memory
389387
"""
390388

@@ -763,13 +761,13 @@ def p_LOCAL(p):
763761
def p_idlist(p):
764762
""" id_list : ID
765763
"""
766-
p[0] = ((p[1], p.lineno(1)),)
764+
p[0] = (Container(p[1], p.lineno(1)),)
767765

768766

769767
def p_idlist_id(p):
770768
""" id_list : id_list COMMA ID
771769
"""
772-
p[0] = p[1] + ((p[3], p.lineno(3)),)
770+
p[0] = p[1] + (Container(p[3], p.lineno(3)),)
773771

774772

775773
def p_DEFB(p): # Define bytes
@@ -1531,7 +1529,7 @@ def p_preprocessor_line_line_file(p):
15311529
def p_preproc_line_init(p):
15321530
""" preproc_line : _INIT STRING
15331531
"""
1534-
INITS.append((p[2].strip('"'), p.lineno(2)))
1532+
INITS.append(Container(p[2].strip('"'), p.lineno(2)))
15351533

15361534

15371535
# --- YYERROR

src/zxbc/zxbc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from . import args_parser
2929

3030

31-
RE_INIT = re.compile(r'^#[ \t]*init[ \t]+((?:[_a-zA-Z][._a-zA-Z0-9]*)|(?:"[_a-zA-Z][._a-zA-Z0-9]*"))[ \t]*$',
31+
RE_INIT = re.compile(r'^#[ \t]*init[ \t]+((?:[._a-zA-Z][._a-zA-Z0-9]*)|(?:"[._a-zA-Z][._a-zA-Z0-9]*"))[ \t]*$',
3232
re.IGNORECASE)
3333

3434

0 commit comments

Comments
 (0)