Skip to content

Commit

Permalink
more mypyc
Browse files Browse the repository at this point in the history
  • Loading branch information
x0r committed Apr 23, 2024
1 parent 7c4298b commit 8878da1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion masm2c/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def next_pass(self, counter: int) -> None:
self.flow_terminated = True
self.need_label = True

self.structures: OrderedDict[str, Optional[Struct]] = OrderedDict()
self.structures: OrderedDict[str, Struct] = OrderedDict()
self.macro_names_stack: set[str] = set()
self.proc_list: list[str] = []
self.proc = None
Expand Down Expand Up @@ -979,6 +979,7 @@ def add_structinstance(self, label: str, type: str, args: list[Any | Tree], raw:
if isinstance(args, list) and len(args) > 2 and isinstance(args[1], str) and args[1] == "dup":
cpp = cpp_module.Cpp(self)
expr = Token_.find_tokens(args[0],"expr")
assert isinstance(expr, Expression)
number = literal_eval(cpp.render_instruction_argument(expr))
args = args[3]
args = Token_.remove_tokens(args, ["structinstance"])
Expand Down
4 changes: 2 additions & 2 deletions masm2c/pgparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import lark.tree
from lark.visitors import _DiscardType

from masm2c.op import Data, _assignment, baseop
from masm2c.op import Data, _assignment, baseop, Struct
from masm2c.Token import Expression

if TYPE_CHECKING:
Expand Down Expand Up @@ -54,7 +54,7 @@ def process(self, stream: Iterator[lark.Token]) -> Iterator[lark.Token]:

if self.last_type == "LABEL" and t.type == "STRUCTHDR":
assert self.last
self.context.structures[self.last.lower()] = None
self.context.structures[self.last.lower()] = Struct("", "")

# if t.type == "STRUCTHDR":
if self.context.structures and self.last_type == "LABEL" \
Expand Down

0 comments on commit 8878da1

Please sign in to comment.