val Text_Antiq: Regex = """(?s)@\{\s*text\b\s*(.+)\}""".r
def update_text(content: String): String = {
(try { Some(Antiquote.read(content)) } catch { case ERROR(_) => None }) match { case Some(ants) => val ants1: List[Antiquote.Antiquote] =
ants.map(ant =>
ant match { case Antiquote.Antiq(Text_Antiq(body)) =>
Token.explode(Keyword.Keywords.empty, body).filterNot(_.is_space) match { case List(tok) => Antiquote.Control(Symbol.cartouche(tok.content)) case _ => ant
} case _ => ant
}) if (ants == ants1) content else ants1.map(_.source).mkString case None => content
}
}
def update_cartouches(replace_text: Boolean, path: Path): Unit = { val text0 = File.read(path)
val isabelle_tool =
Isabelle_Tool("update_cartouches", "update theory syntax to use cartouches",
Scala_Project.here,
{ args => var replace_text = false
val getopts = Getopts("""
Usage: isabelle update_cartouches [FILES|DIRS...]
Options are:
-t replace @{text} antiquotations within text tokens
Recursively find .thy or ROOT files and update theory syntax to use
cartouches instead of `alt_string` tokens.
Old versions of files are preserved by appending "~~". """, "t" -> (_ => replace_text = true))
val specs = getopts(args) if (specs.isEmpty) getopts.usage()
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.