Replace Label synonym with String in some parsers
The Label type synonym (which is used to identify labels in assembly), is used as a plane String in cInstrDest, cInstrJump and cInstrAluOps parsers. This doesn't cause any compilation or run-time problems because Label is just a type synonym for String, but is ugly and breaks the intended meaning of the Label type. Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
parent
4f9ee54c3a
commit
48a171e6c9
|
@ -79,7 +79,7 @@ aInstr = do
|
||||||
aInstrAddr <|> aInstrSym
|
aInstrAddr <|> aInstrSym
|
||||||
|
|
||||||
-- | TODO: Documentation
|
-- | TODO: Documentation
|
||||||
cInstrDest :: GenParser Char st (Label, String)
|
cInstrDest :: GenParser Char st (String, String)
|
||||||
cInstrDest =
|
cInstrDest =
|
||||||
choice [ char 'D' >> return ("D", "010")
|
choice [ char 'D' >> return ("D", "010")
|
||||||
, char 'M' >>
|
, char 'M' >>
|
||||||
|
@ -93,7 +93,7 @@ cInstrDest =
|
||||||
, return ("A", "100") ]]
|
, return ("A", "100") ]]
|
||||||
|
|
||||||
-- | TODO: Documentation
|
-- | TODO: Documentation
|
||||||
cInstrJump :: GenParser Char st (Label, String)
|
cInstrJump :: GenParser Char st (String, String)
|
||||||
cInstrJump = char 'J' >>
|
cInstrJump = char 'J' >>
|
||||||
choice [ string "MP" >> return ("JMP", "111")
|
choice [ string "MP" >> return ("JMP", "111")
|
||||||
, string "NE" >> return ("JNE", "101")
|
, string "NE" >> return ("JNE", "101")
|
||||||
|
@ -107,7 +107,7 @@ cInstrJump = char 'J' >>
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | TODO: Documentation
|
-- | TODO: Documentation
|
||||||
cInstrAluOps :: GenParser Char st (Label, String)
|
cInstrAluOps :: GenParser Char st (String, String)
|
||||||
cInstrAluOps =
|
cInstrAluOps =
|
||||||
choice [ char '0' >> return ("0", "0101010")
|
choice [ char '0' >> return ("0", "0101010")
|
||||||
, char '1' >> return ("1", "0111111")
|
, char '1' >> return ("1", "0111111")
|
||||||
|
|
Loading…
Reference in New Issue