/* Title: Tools/Find_Facts/src/elm.scala Author: Fabian Huch, TU Muenchen
Support for Elm https://elm-lang.org "A delightful language for reliable web applications".
*/
package isabelle.find_facts
import isabelle._
import java.io.{File => JFile}
import scala.jdk.CollectionConverters._
import org.jsoup.nodes.Element
object Elm { def elm_home: Path = {
Path.explode(proper_string(Isabelle_System.getenv("ISABELLE_ELM_HOME"))
getOrElse error("No elm component found"))
}
object Project { def apply(
name: String,
dir: Path,
main: Path = Path.explode("src/Main.elm"),
head: XML.Body = Nil
): Project = { if (!dir.is_dir) error("Project directory does not exist: " + dir) val main_file = dir + main if (!main_file.is_file) error("Main elm file does not exist: " + main_file) new Project(name, dir, main, head)
}
def get_digest(output_file: Path): SHA1.Digest =
Exn.capture { val html = HTML.parse_document(File.read(output_file)) val elem = html.head.getElementsByTag("meta").attr("name", "shasum")
Library.the_single(elem.eachAttr("content").asScala.toList)
} match { case Exn.Res(s) => SHA1.fake_digest(s) case _ => SHA1.digest_empty
}
}
class Project private(name: String, dir: Path, main: Path, head: XML.Body) { val definition = JSON.parse(File.read(dir + Path.basic("elm.json"))) val src_dirs =
JSON.strings(definition, "source-directories").getOrElse(
error("Missing source directories in elm.json"))
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.