Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions goboscript_gdsl/cls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

@dataclass
class UnOp:
variant: str
opcode: str
input: str
fields: dict[str, str]


@dataclass
class BinOp:
variant: str
opcode: str
lhs: str
rhs: str
Expand All @@ -25,6 +27,7 @@ class Menu:

@dataclass
class Block:
variant: str
name: str
opcode: str
args: list[str]
Expand Down
8 changes: 4 additions & 4 deletions goboscript_gdsl/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def parse(self) -> GDSLData:
else:
old_input = inp

ret.un_ops[variant] = UnOp(opcode, inp, fields)
ret.un_ops[variant] = UnOp(variant, opcode, inp, fields)

elif section == "BINARY":
if line.endswith("~"):
Expand All @@ -124,7 +124,7 @@ def parse(self) -> GDSLData:
else:
old_rhs = rhs

ret.bin_ops[variant] = BinOp(opcode, lhs, rhs)
ret.bin_ops[variant] = BinOp(variant, opcode, lhs, rhs)

else:
self.p(line, repr=True)
Expand Down Expand Up @@ -200,10 +200,10 @@ def parse(self) -> GDSLData:
if not isinstance(block, list):
block = [block]

block.append(Block(name, opcode, args, fields, menu))
block.append(Block(variant, name, opcode, args, fields, menu))
container[variant] = block

else:
container[variant] = Block(name, opcode, args, fields, menu)
container[variant] = Block(variant, name, opcode, args, fields, menu)

return ret