Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
almibe committed May 29, 2024
1 parent e10271d commit 49abca4
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 39 deletions.
4 changes: 2 additions & 2 deletions gaze/src/main/scala/dev/ligature/gaze/Nibblers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def takeUntil[I](toMatch: I): Nibbler[I, Seq[I]] =
if (v == toMatch) {
matched = true
} else {
gaze.next()
val _ = gaze.next()
result.append(v)
}
case None =>
Expand All @@ -162,7 +162,7 @@ def takeUntil[I](toMatch: Nibbler[I, I]): Nibbler[I, Seq[I]] =
check match {
case Result.Match(_) => matched = true
case Result.NoMatch =>
gaze.next()
val _ = gaze.next()
result.append(v)
case Result.EmptyMatch => ???
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import dev.ligature.wander.modules.std
// import dev.ligature.inmemory.LigatureInMemory
// import dev.ligature.Ligature

private class LigatureZeroMQ(val port: Int)
extends Runnable
with AutoCloseable {
private class LigatureZeroMQ(val port: Int) extends Runnable with AutoCloseable {
val logger = Logger("LigatureZeroMQ")
private val zContext = ZContext()

Expand Down
2 changes: 1 addition & 1 deletion ligature/src/main/scala/dev/ligature/wander/Bend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def printStatementValue(value: LigatureValue): String =
case value: LigatureValue.Identifier => printIdentifier(value)
case LigatureValue.IntegerValue(value) => value.toString()
case LigatureValue.StringValue(value) => printString(value)
case LigatureValue.Record(values) =>
case LigatureValue.Record(values) =>
"{" + values
.map((field, value) => field + " = " + printStatementValue(value))
.mkString(", ") + "}"
Expand Down
6 changes: 3 additions & 3 deletions ligature/src/main/scala/dev/ligature/wander/Environment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ case class Environment(
}
(lastResult, err) match {
case (_, err: WanderError) => Left(err)
case (None, _) => Right((WanderValue.Module(Map()), env))
case (Some(value), _) => Right((value, env))
case (None, _) => Right((WanderValue.Module(Map()), env))
case (Some(value), _) => Right((value, env))
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ case class Environment(

def importModule(fieldPath: FieldPath): Either[WanderError, Environment] =
var currentEnvironemnt = this
boundary:
val _ = boundary:
this.read(fieldPath) match
case Right(None) => ???
case Left(value) => break(Left(value))
Expand Down
10 changes: 6 additions & 4 deletions ligature/src/main/scala/dev/ligature/wander/Interpreter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ def interpolateString(
case Left(err) =>
break(Left(err))
case Right((WanderValue.String(value), _)) => val _ = sb.append(value)
case _ => ???
case _ => ???
case _ =>
break(
Left(
WanderError("Syntax error, in an interpolated String `$` must be followed by `(`.")
WanderError(
"Syntax error, in an interpolated String `$` must be followed by `(`."
)
)
)
case c => val _ = sb.append(c)
Expand Down Expand Up @@ -291,7 +293,7 @@ def handleApplication(
callPartialHostFunction(args, fn, arguments, environment)
case WanderValue.Array(values) => callArray(values, arguments, environment)
case WanderValue.Module(values) => callModule(values, arguments, environment)
case _ => Left(WanderError(s"Could not call function."))
case _ => Left(WanderError(s"Could not call function."))
}
}
case x => Left(WanderError(s"Unexpected start of application - $x"))
Expand All @@ -306,7 +308,7 @@ def wanderToLigatureValue(value: WanderValue): LigatureValue =
case WanderValue.Int(value) => LigatureValue.IntegerValue(value)
case WanderValue.String(value) => LigatureValue.StringValue(value)
case WanderValue.Identifier(value) => value
case _ => ???
case _ => ???

def callArray(
values: Seq[WanderValue],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import dev.ligature.wander.modules.std
final class DirectoryLibrary(path: Path) extends ModuleLibrary {
var modules: Map[ModuleId, WanderValue.Module] = Map()
override def lookup(id: ModuleId): Either[WanderError, Option[WanderValue.Module]] =
boundary:
val _ = boundary:
if (modules.isEmpty) {
modules = loadFromPath(path) match {
case Left(value) => break(Left(value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ val arrayModule: WanderValue.Module = WanderValue.Module(
case Right(value) =>
value match
case WanderValue.Bool(value) => value
case _ => ??? /// break(Left(LigatureError("")
case _ => ??? /// break(Left(LigatureError("")
)
Right((WanderValue.Array(results), environment))
case _ => ???
Expand Down Expand Up @@ -126,7 +126,7 @@ val arrayModule: WanderValue.Module = WanderValue.Module(
.map(
_ match
case WanderValue.String(value) => value
case _ => ???
case _ => ???
)
.mkString("")
),
Expand All @@ -153,7 +153,7 @@ val arrayModule: WanderValue.Module = WanderValue.Module(
.map(
_ match
case WanderValue.String(value) => value
case _ => ???
case _ => ???
)
.mkString("\n")
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ val boolModule: WanderValue.Module = WanderValue.Module(
(args, environment) =>
args match
case Seq(WanderValue.Bool(value)) => Right((WanderValue.Bool(!value), environment))
case _ => Left(WanderError("Unexpected input " + args))
case _ => Left(WanderError("Unexpected input " + args))
)
),
Field("and") -> WanderValue.Function(
Expand Down Expand Up @@ -56,7 +56,7 @@ val boolModule: WanderValue.Module = WanderValue.Module(
case Seq(WanderValue.Bool(value)) =>
Right(
(
???,///WanderValue.Bytes(BooleanBinding.booleanToEntry(value).getBytesUnsafe().toSeq),
???, /// WanderValue.Bytes(BooleanBinding.booleanToEntry(value).getBytesUnsafe().toSeq),
environment
)
)
Expand All @@ -74,7 +74,7 @@ val boolModule: WanderValue.Module = WanderValue.Module(
case Seq(WanderValue.Bytes(value)) =>
Right(
(
???, //WanderValue.Bool(BooleanBinding.entryToBoolean(ArrayByteIterable(value.toArray))),
???, // WanderValue.Bool(BooleanBinding.entryToBoolean(ArrayByteIterable(value.toArray))),
environment
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ val bytesModule: WanderValue.Module = WanderValue.Module(
Tag.Untagged,
(args, env) =>
args match
case Seq(value: WanderValue) => Right((WanderValue.Bytes(encodeWanderValue(value)), env))
case _ => ???
case Seq(value: WanderValue) =>
Right((WanderValue.Bytes(encodeWanderValue(value)), env))
case _ => ???
)
),
Field("decode") -> WanderValue.Function(
Expand All @@ -39,7 +40,7 @@ val bytesModule: WanderValue.Module = WanderValue.Module(
(args, env) =>
args match
case Seq(WanderValue.Bytes(value)) => Right((decodeWanderValue(value), env))
case _ => ???
case _ => ???
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions ligature/src/main/scala/dev/ligature/wander/modules/Int.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ val intModule: WanderValue.Module = WanderValue.Module(
case Seq(WanderValue.Int(value)) =>
Right(
(
???,//WanderValue.Bytes(LongBinding.longToEntry(value).getBytesUnsafe().toSeq),
???, // WanderValue.Bytes(LongBinding.longToEntry(value).getBytesUnsafe().toSeq),
environment
)
)
Expand All @@ -60,7 +60,7 @@ val intModule: WanderValue.Module = WanderValue.Module(
case Seq(WanderValue.Bytes(value)) =>
Right(
(
???,//WanderValue.Int(LongBinding.entryToLong(ArrayByteIterable(value.toArray))),
???, // WanderValue.Int(LongBinding.entryToLong(ArrayByteIterable(value.toArray))),
environment
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ val statementModule: WanderValue.Module = WanderValue.Module(
Right((WanderValue.Identifier(identifier), environment))
case LigatureValue.StringValue(value) =>
Right((WanderValue.String(value), environment))
case LigatureValue.IntegerValue(value) => Right((WanderValue.Int(value), environment))
case LigatureValue.BytesValue(value) => Right((WanderValue.Bytes(value), environment))
case LigatureValue.Record(_) => ???
case LigatureValue.IntegerValue(value) =>
Right((WanderValue.Int(value), environment))
case LigatureValue.BytesValue(value) =>
Right((WanderValue.Bytes(value), environment))
case LigatureValue.Record(_) => ???
}
case _ => Left(WanderError("Unexpected value."))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ val stringModule: WanderValue.Module = WanderValue.Module(
case Seq(WanderValue.String(value)) =>
Right(
(
???,//WanderValue.Bytes(StringBinding.stringToEntry(value).getBytesUnsafe().toSeq),
???, // WanderValue.Bytes(StringBinding.stringToEntry(value).getBytesUnsafe().toSeq),
environment
)
)
Expand All @@ -68,7 +68,7 @@ val stringModule: WanderValue.Module = WanderValue.Module(
case Seq(WanderValue.Bytes(value)) =>
Right(
(
???,//WanderValue.String(StringBinding.entryToString(ArrayByteIterable(value.toArray))),
???, // WanderValue.String(StringBinding.entryToString(ArrayByteIterable(value.toArray))),
environment
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import dev.ligature.wander.WanderValue
//import dev.ligature.wander.modules.std

class LigatureTestSuite extends FunSuite {
//val setup = ???//FunFixture[(Environment, Ligature)](
//setup = { test =>
// ???
// val instance = LigatureInMemory()
// (stdWithLigature(instance), instance)
// },
// teardown = { instance =>
// instance._2.close()
// val setup = ???//FunFixture[(Environment, Ligature)](
// setup = { test =>
// ???
// val instance = LigatureInMemory()
// (stdWithLigature(instance), instance)
// },
// teardown = { instance =>
// instance._2.close()
// }
// )
// )

def check(script: String, environment: Environment): WanderValue =
run(script, environment) match {
Expand Down

0 comments on commit 49abca4

Please sign in to comment.