mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-12-30 14:29:48 +00:00
comment block demo
This commit is contained in:
parent
10e6eea846
commit
a731672efa
6
data/annotated-snake.asm
Normal file
6
data/annotated-snake.asm
Normal file
@ -0,0 +1,6 @@
|
||||
; ___ _ __ ___ __ ___
|
||||
; / __|_ _ __ _| |_____ / /| __|/ \_ )
|
||||
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
|
||||
; |___/_||_\__,_|_\_\___\___/___/\__/___|
|
||||
|
||||
; Change direction: W A S D
|
@ -0,0 +1,10 @@
|
||||
package com.htmlism.firepower.demo
|
||||
|
||||
case class CommentBlock(xs: List[String])
|
||||
|
||||
object CommentBlock:
|
||||
def toParagraph(cb: CommentBlock): Paragraph =
|
||||
Paragraph(cb.xs.map("; " + _))
|
||||
|
||||
def fromMultiline(s: String): CommentBlock =
|
||||
CommentBlock(s.split("\\n").toList)
|
@ -18,10 +18,21 @@ object PrintPrograms extends ZIOAppDefault:
|
||||
.apply(List("foo", "bar")),
|
||||
"two-paragraphs.txt" -> (Line.mkString _)
|
||||
.compose(Paragraph.mkLines)
|
||||
.apply(List(Paragraph("foo", "bar"), Paragraph("alpha", "bravo"))),
|
||||
.apply(
|
||||
List(
|
||||
Paragraph(List("foo", "bar")),
|
||||
Paragraph(List("alpha", "bravo"))
|
||||
)
|
||||
),
|
||||
"annotated-snake.asm" -> (Line.mkString _)
|
||||
.compose(Paragraph.mkLines)
|
||||
.apply(List(Paragraph(asciiArt), Paragraph("Change direction: W A S D")))
|
||||
.compose((xs: List[CommentBlock]) => xs.map(CommentBlock.toParagraph))
|
||||
.apply(
|
||||
List(
|
||||
CommentBlock.fromMultiline(asciiArt),
|
||||
CommentBlock(List("Change direction: W A S D"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
lazy val asciiArt =
|
||||
|
Loading…
Reference in New Issue
Block a user