All Downloads are FREE. Search and download functionalities are using the official Maven repository.

axle.ast.Document.scala Maven / Gradle / Ivy

The newest version!

package axle.ast

class DocumentFromString(val grammar: Language, val name: String, content: String) extends Document {

  def ast: Option[AstNode] = grammar.parseString(content)
}

class DocumentFromFile(val grammar: Language, shortFilename: String, filename: String) extends Document {

  def ast: Option[AstNode] = grammar.parseFile(filename)

  def name: String = shortFilename
}

trait Document {

  def ast: Option[AstNode]

  def grammar: Language

  def name: String

  //  def makeHtml = {
  //    val htmlFilename = Config.htmlDirectory + File.separator + shortFilename + ".html"
  //    new File(new File(htmlFilename).getParent).mkdirs
  //    val html = getGrammar.ast2html(getAst)
  //    val outFile = new File(htmlFilename)
  //    val out = new FileWriter(outFile)
  //    out.write(html.toString)
  //    out.close()
  //  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy