add nescant

This commit is contained in:
Mark Canlas 2020-08-28 02:18:25 -04:00
parent 5fe085e09a
commit 151f68a55d
10 changed files with 65 additions and 1 deletions

View File

@ -13,6 +13,8 @@
* IndirectX: argument is an 8-bit address; find a value at this address incremented by the value X
* IndirectY: argument is an 8-bit address; find a value at this address; increment the value by Y
## TODO - Nescant
## TODO
1. operand support should be derived from enum support

View File

@ -8,3 +8,7 @@ lazy val root =
.withCats
.withTesting
.withOrganizeImports
.aggregate(nescant)
lazy val nescant =
project.withCats.withTesting.withOrganizeImports

View File

@ -0,0 +1,5 @@
package com.htmlism.nescant
object GlobalAddress {}
case class GlobalAddress(n: Int)

View File

@ -0,0 +1,7 @@
package com.htmlism.nescant
sealed trait Operand
case class LiteralOperand(value: String) extends Operand
case class NamedOperand(name: String, value: String) extends Operand

View File

@ -0,0 +1,7 @@
package com.htmlism.nescant
trait Sink[A]
object Sink {
// TODO int cannot be a source
}

View File

@ -0,0 +1,8 @@
package com.htmlism.nescant
trait Source[A]
object Source {
// TODO int can be a source
// TODO a volitile device can be a source
}

View File

@ -0,0 +1,5 @@
package com.htmlism.nescant
object ZeroPageAddress {}
case class ZeroPageAddress(n: Int)

View File

@ -0,0 +1,11 @@
package com.htmlism.nescant
package object dsl {
implicit class AddressOps(n: Int) {
def z: ZeroPageAddress =
ZeroPageAddress(n)
def g: GlobalAddress =
GlobalAddress(n)
}
}

View File

@ -0,0 +1,15 @@
package com.htmlism.nescant
package dsl
import org.scalatest.flatspec._
import org.scalatest.matchers._
class PostFixOpsSpec extends AnyFlatSpec with should.Matchers {
"Numbers" should "support zero page ops" in {
123.z shouldBe ZeroPageAddress(123)
}
it should "support global address ops" in {
123.g shouldBe GlobalAddress(123)
}
}

View File

@ -5,7 +5,7 @@ object LintingPlugin extends AutoPlugin {
override def trigger = allRequirements
override lazy val globalSettings =
addCommandAlias("fmt", List("all", "scalafmtSbt", "compile:scalafmt", "test:scalafmt").mkString(" ")) ++
addCommandAlias("fmt", "scalafmtAll") ++
addCommandAlias("fix", "scalafixAll")
object autoImport {