mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-06-15 17:29:45 +00:00
allow many paragraph output
This commit is contained in:
parent
a7ab58f660
commit
c9ac5ee14b
|
@ -5,6 +5,4 @@
|
|||
|
||||
; Change direction: W A S D
|
||||
|
||||
|
||||
|
||||
labeled:
|
||||
|
|
|
@ -29,7 +29,7 @@ object PrintPrograms extends ZIOAppDefault:
|
|||
),
|
||||
"annotated-snake.asm" -> (Line.mkString _)
|
||||
.compose(Paragraph.mkLines)
|
||||
.compose((xs: List[AsmBlock]) => xs.map(AsmBlock.toParagraph))
|
||||
.compose((xs: List[AsmBlock]) => xs.flatMap(AsmBlock.toParagraphs))
|
||||
.apply(
|
||||
List(
|
||||
CommentBlock.fromMultiline(asciiArt),
|
||||
|
|
|
@ -11,18 +11,22 @@ case class NamedCodeBlock(name: String, intents: List[AsmBlock.Intent]) extends
|
|||
case class AnonymousCodeBlock(intents: List[AsmBlock.Intent]) extends AsmBlock
|
||||
|
||||
object AsmBlock:
|
||||
def toParagraph(xs: AsmBlock): Paragraph =
|
||||
def toParagraphs(xs: AsmBlock): List[Paragraph] =
|
||||
xs match
|
||||
case CommentBlock(ys) =>
|
||||
Paragraph(ys.map("; " + _))
|
||||
List(
|
||||
Paragraph(ys.map("; " + _))
|
||||
)
|
||||
|
||||
case NamedCodeBlock(label, _) =>
|
||||
Paragraph(
|
||||
List(label + ":")
|
||||
List(
|
||||
Paragraph(
|
||||
List(label + ":")
|
||||
)
|
||||
)
|
||||
|
||||
case AnonymousCodeBlock(_) =>
|
||||
Paragraph("")
|
||||
Nil
|
||||
|
||||
case class Intent(label: Option[String], instructions: List[Intent.Instruction])
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user