Skip to content

Commit

Permalink
hooks to add further functions to theory
Browse files Browse the repository at this point in the history
  • Loading branch information
pruemmer committed May 23, 2024
1 parent e386836 commit 2f9d06b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ lazy val root = (project in file(".")).
//
resolvers += "uuverifiers" at "https://eldarica.org/maven/",
//
libraryDependencies += "uuverifiers" %% "princess" % "nightly-SNAPSHOT",
// libraryDependencies += "io.github.uuverifiers" %% "princess" % "2024-01-12",
// libraryDependencies += "uuverifiers" %% "princess" % "nightly-SNAPSHOT",
libraryDependencies += "io.github.uuverifiers" %% "princess" % "2024-03-22",
// libraryDependencies += "uuverifiers" % "ecma2020-regex-parser" % "0.5",
libraryDependencies += "org.sat4j" % "org.sat4j.core" % "2.3.1",
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.14.0" % "test",
Expand Down
9 changes: 7 additions & 2 deletions src/main/scala/ostrich/OstrichStringTheory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ class OstrichStringTheory(transducers : Seq[(String, Transducer)],
(str_extract, 1),
(re_loop_?, 2))

// List of additional functions that can be provided by sub-classes
protected def extraExtraFunctions : Seq[IFunction] = List()

val extraFunctionPreOps =
(for ((_, f, op, argSelector, resSelector) <- extraStringFunctions.iterator)
yield (f, (op, argSelector, resSelector))).toMap
Expand All @@ -234,7 +237,7 @@ class OstrichStringTheory(transducers : Seq[(String, Transducer)],
yield (name, Left(f))) ++
(for ((name, p, _) <- transducersWithPreds.iterator)
yield (name, Right(p))) ++
(for (f <- extraRegexFunctions.iterator)
(for (f <- extraRegexFunctions.iterator ++ extraExtraFunctions.iterator)
yield (f.name, Left(f)))).toMap

val extraIndexedOps : Map[(String, Int), Either[IFunction, Predicate]] =
Expand All @@ -256,7 +259,9 @@ class OstrichStringTheory(transducers : Seq[(String, Transducer)],
predefFunctions ++
List(str_empty, str_cons, str_head, str_tail, str_char_count) ++
(extraStringFunctions map (_._2)) ++
extraRegexFunctions ++ (extraIndexedFunctions map (_._1))
extraRegexFunctions ++
(extraIndexedFunctions map (_._1)) ++
extraExtraFunctions

val (funPredicates, _, _, functionPredicateMap) =
Theory.genAxioms(theoryFunctions = functions,
Expand Down

0 comments on commit 2f9d06b

Please sign in to comment.