rename "ArgumentType" to "ArgumentParser"
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
class ArgumentType(object):
|
||||
class ArgumentParser(object):
|
||||
|
||||
def can_parse(token: str) -> bool:
|
||||
raise NotImplementedError()
|
||||
@@ -1,8 +1,8 @@
|
||||
from .ArgumentType import ArgumentType
|
||||
from .ArgumentParser import ArgumentParser
|
||||
from . import Arguments
|
||||
|
||||
|
||||
class Address(ArgumentType):
|
||||
class Address(ArgumentParser):
|
||||
|
||||
NAME = "Address"
|
||||
|
||||
@@ -20,7 +20,7 @@ class Address(ArgumentType):
|
||||
return Address.NAME
|
||||
|
||||
|
||||
class Label(ArgumentType):
|
||||
class Label(ArgumentParser):
|
||||
|
||||
NAME = "Label"
|
||||
|
||||
@@ -39,7 +39,7 @@ class Label(ArgumentType):
|
||||
return Label.NAME
|
||||
|
||||
|
||||
class Register8(ArgumentType):
|
||||
class Register8(ArgumentParser):
|
||||
|
||||
NAME = "Register8"
|
||||
|
||||
@@ -63,7 +63,7 @@ class Register8(ArgumentType):
|
||||
return Register8.NAME
|
||||
|
||||
|
||||
class Register16(ArgumentType):
|
||||
class Register16(ArgumentParser):
|
||||
|
||||
NAME = "Immediate8"
|
||||
|
||||
@@ -83,7 +83,7 @@ class Register16(ArgumentType):
|
||||
return Register16.NAME
|
||||
|
||||
|
||||
class Immediate8(ArgumentType):
|
||||
class Immediate8(ArgumentParser):
|
||||
|
||||
NAME = "Immediate8"
|
||||
|
||||
@@ -100,7 +100,7 @@ class Immediate8(ArgumentType):
|
||||
def get_name(self) -> str:
|
||||
return Immediate8.NAME
|
||||
|
||||
class Immediate16(ArgumentType):
|
||||
class Immediate16(ArgumentParser):
|
||||
|
||||
NAME = "Immediate16"
|
||||
|
||||
@@ -121,7 +121,7 @@ class Immediate16(ArgumentType):
|
||||
return Immediate16.NAME
|
||||
|
||||
|
||||
class Flag(ArgumentType):
|
||||
class Flag(ArgumentParser):
|
||||
|
||||
NAME = "Flag"
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from .ArgumentType import ArgumentType
|
||||
from .ArgumentTypes import Label, Address, Immediate8, Immediate16, Register8, Register16
|
||||
from .ArgumentParser import ArgumentParser
|
||||
from .ArgumentParsers import Label, Address, Immediate8, Immediate16, Register8, Register16
|
||||
from .Arguments import Argument
|
||||
|
||||
@@ -11,7 +11,7 @@ from .instructions.nop import Nop
|
||||
from .instructions.stop import Stop
|
||||
from .instructions.jr import Jr
|
||||
from .instructions.ld import Ld
|
||||
from .arguments import ArgumentType, Argument
|
||||
from .arguments import ArgumentParser, Argument
|
||||
|
||||
from typing import Callable, Dict, List, Optional
|
||||
|
||||
@@ -36,7 +36,7 @@ def build_instruction_map() -> Dict[str, Instruction]:
|
||||
return d
|
||||
|
||||
def try_parse_arguments(args: List[str],
|
||||
arg_types: List[ArgumentType]) -> Optional[List[Argument]]:
|
||||
arg_types: List[ArgumentParser]) -> Optional[List[Argument]]:
|
||||
if len(args) != len(arg_types):
|
||||
return None
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from typing import Callable, List
|
||||
from ..arguments import Argument, ArgumentType
|
||||
from ..arguments import Argument, ArgumentParser
|
||||
|
||||
class Instruction(object):
|
||||
|
||||
def __init__(self, token: str, argument_specs: List[List[ArgumentType]]):
|
||||
def __init__(self, token: str, argument_specs: List[List[ArgumentParser]]):
|
||||
self.token = token
|
||||
self.argument_specs = argument_specs
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from .Instruction import Instruction
|
||||
from ..arguments.ArgumentTypes import Register8, Register16
|
||||
from ..arguments.ArgumentParsers import Register8, Register16
|
||||
from ..arguments import Argument
|
||||
from typing import Callable, List
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from .Instruction import Instruction
|
||||
from ..arguments.ArgumentTypes import Register8, Register16
|
||||
from ..arguments.ArgumentParsers import Register8, Register16
|
||||
from ..arguments import Argument
|
||||
from typing import Callable, List
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from .Instruction import Instruction
|
||||
from ..arguments.ArgumentTypes import Flag, Label
|
||||
from ..arguments.ArgumentParsers import Flag, Label
|
||||
from ..arguments import Argument
|
||||
from typing import Callable, List
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from .Instruction import Instruction
|
||||
from ..arguments.ArgumentTypes import Register16, Immediate16
|
||||
from ..arguments.ArgumentParsers import Register16, Immediate16
|
||||
from ..arguments import Argument
|
||||
from typing import Callable, List
|
||||
|
||||
|
||||
Reference in New Issue
Block a user