Commit 2608dee4 authored by Adam R. Nelson's avatar Adam R. Nelson

Various fixes

parent 4d4e646a
......@@ -9,7 +9,7 @@ licenses := Seq("CC BY-SA 4.0" -> url("https://creativecommons.org/licenses/by-s
scalaVersion := "2.11.7"
libraryDependencies := Seq(
"org.antlr" % "antlr4" % "4.5",
"org.antlr" % "antlr4" % "4.5.1",
"com.typesafe.scala-logging" %% "scala-logging" % "3.1.0",
"ch.qos.logback" % "logback-classic" % "1.1.2",
"com.github.jnr" % "jnr-ffi" % "2.0.3",
......
resolvers += "simplytyped.com" at "http://simplytyped.com/repo/releases"
resolvers += "simplytyped" at "http://simplytyped.github.io/repo/releases"
// addSbtPlugin("com.simplytyped" % "sbt-antlr4" % "0.7.2")
addSbtPlugin("com.simplytyped" % "sbt-antlr4" % "0.7.7")
lazy val root = (project in file(".")).dependsOn(sbtAntlr4Plugin)
lazy val sbtAntlr4Plugin = uri("https://github.com/ihji/sbt-antlr4.git")
// lazy val root = (project in file(".")).dependsOn(sbtAntlr4Plugin)
// lazy val sbtAntlr4Plugin = uri("https://github.com/ihji/sbt-antlr4.git")
\ No newline at end of file
......@@ -42,9 +42,10 @@ class BundleBuilder(baseName: String) {
newVarName(nextName)
}
def newVarName(name: String) = newVarName(name, baseName)
def newVarName(name: String): GlobalVarName = newVarName(name, baseName)
def newVarName(name: String, prefix: String) = GlobalVarName(generateName(prefix, name))
def newVarName(name: String, prefix: String): GlobalVarName =
GlobalVarName(generateName(prefix, name))
def newTypeName(): TypeName = {
var nextName: String = null
......@@ -224,6 +225,8 @@ class BundleBuilder(baseName: String) {
): FunctionBuilder =
newFuncVersion(funcName, sigName, versionName, JavaConversions asScalaBuffer paramNames)
def comment(name: GlobalName, comment: String): Unit = comments.put(name, comment)
def build(): Bundle = new Bundle(
cTypeDefs = typeDefs,
cFuncSigDefs = funcSigDefs,
......
......@@ -72,9 +72,7 @@ class Bundle(
import JavaConversions._
sb append "\n"
block foreach { case (name, value) =>
if (comments containsKey name) {
comments get name split '\n' map ("// " + _ + "\n") foreach sb.append
}
Option(comments get name) foreach (_ split '\n' map ("// " + _ + "\n") foreach sb.append)
fn(name, value)
}
}
......
......@@ -52,7 +52,7 @@ class BundleBuilderTest extends FlatSpec with Matchers {
val abc = Seq(GlobalVarName("a"), GlobalVarName("b"), GlobalVarName("c"))
def const(constDef: Const): String = {
val builder = new BundleBuilder("test")
builder.const(c, constDef)
builder.constDef(c, constDef)
builder.build().toString.trim
}
......@@ -203,7 +203,7 @@ class BundleBuilderTest extends FlatSpec with Matchers {
val builder = new BundleBuilder("test")
val t = builder.typeDef(TypeCtor.Int(64))
val s = builder.funcSig(t, Seq(t, t))
val c = builder.const(Const.Int(t, 42L))
val c = builder.constDef(Const.Int(t, 42L))
val g = builder.globalCell(t)
val fDecl = builder.funcDecl(builder.newVarName("f1"), s)
builder.exposeFunc(builder.newVarName("nf"), fDecl, new Flag("DEFAULT"), c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment