Skip to content

aml-org/syaml

Repository files navigation

SYaml

The SYaml project provides a Pure Scala YAML 1.2 syntax processor that has no dependencies on external libraries.

About

This project includes the following:

Features

In development

  • Java API and libraries
  • JavaScript API and libraries
  • Improve error messages
  • Improve documentation
  • Model golden tests

Usage

Lexer (YEAST Token Output)

The following example shows how to iterate through YEAST tokens:

private def generate(yamlFile: File, yeastFile: File) = {
  val out   = new PrintWriter(yeastFile)
  val lexer = YamlLexer(yamlFile)
  while (lexer.token != YamlToken.EndStream) {
    val data = YeastData(lexer.tokenData, lexer.tokenString)
    out.println(data)
    lexer.advance()
  }
  out.close()
}

Parser (Model Output)

The following example shows how to parse a file:

private def generate(yamlFile: File) = {
  val elements = YamlParser(yamlFile).parse()
  for (e <- elements) {
    println(e)
  }
}