Skip to content

Commit

Permalink
fixing the names to better align
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevan Little committed Feb 23, 2013
1 parent 54ce606 commit cd5230a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/main/scala/org/moe/interpreter/Interpreter.scala
Expand Up @@ -43,8 +43,8 @@ class Interpreter {
// literals

case IntLiteralNode(value) => getInt(value)
case FloatLiteralNode(value) => getFloat(value)
case StringLiteralNode(value) => getString(value)
case FloatLiteralNode(value) => getNum(value)
case StringLiteralNode(value) => getStr(value)
case BooleanLiteralNode(value) => getBool(value)

case UndefLiteralNode() => getUndef
Expand Down Expand Up @@ -134,7 +134,7 @@ class Interpreter {
elems = elems :+ str
str = magicalStringIncrement(str)
}
getArray(elems.map(getString(_)))
getArray(elems.map(getStr(_)))
}
}
case _ => throw new MoeErrors.UnexpectedType("Pair of MoeIntObject or MoeStrObject expected")
Expand All @@ -155,12 +155,12 @@ class Interpreter {
if (is_prefix) new_i else i
}
case n: MoeNumObject => {
val new_n = getFloat(n.unboxToDouble.get + 1.0)
val new_n = getNum(n.unboxToDouble.get + 1.0)
env.set(varName, new_n)
if (is_prefix) new_n else n
}
case s: MoeStrObject => {
val new_s = getString(magicalStringIncrement(s.unboxToString.get))
val new_s = getStr(magicalStringIncrement(s.unboxToString.get))
env.set(varName, new_s)
if (is_prefix) new_s else s
}
Expand All @@ -176,7 +176,7 @@ class Interpreter {
if (is_prefix) new_i else i
}
case n: MoeNumObject => {
val new_n = getFloat(n.unboxToDouble.get - 1.0)
val new_n = getNum(n.unboxToDouble.get - 1.0)
env.set(varName, new_n)
if (is_prefix) new_n else n
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/scala/org/moe/runtime/MoeRuntime.scala
Expand Up @@ -156,10 +156,10 @@ class MoeRuntime (
def getTrue = True
def getFalse = False

def getInt (value: Int) = new MoeIntObject(value, getCoreClassFor("Int"))
def getFloat (value: Double) = new MoeNumObject(value, getCoreClassFor("Num"))
def getString (value: String) = new MoeStrObject(value, getCoreClassFor("Str"))
def getBool (value: Boolean) = if (value) { True } else { False }
def getInt (value: Int) = new MoeIntObject(value, getCoreClassFor("Int"))
def getNum (value: Double) = new MoeNumObject(value, getCoreClassFor("Num"))
def getStr (value: String) = new MoeStrObject(value, getCoreClassFor("Str"))
def getBool (value: Boolean) = if (value) { True } else { False }

def getHash (value: HashMap[String, MoeObject]) = new MoeHashObject(value, getCoreClassFor("Hash"))
def getHash () = new MoeHashObject(HashMap(), getCoreClassFor("Hash"))
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/org/moe/runtime/builtins/IntClass.scala
Expand Up @@ -25,7 +25,7 @@ object IntClass {
{ (invocant, args) =>
args(0) match {
case i: MoeIntObject => getInt(invocant.unboxToInt.get + i.unboxToInt.get)
case f: MoeNumObject => getFloat(invocant.unboxToDouble.get + f.unboxToDouble.get)
case f: MoeNumObject => getNum(invocant.unboxToDouble.get + f.unboxToDouble.get)
case _ => throw new MoeErrors.UnexpectedType(args(0).toString)
}
}
Expand All @@ -38,7 +38,7 @@ object IntClass {
{ (invocant, args) =>
args(0) match {
case i: MoeIntObject => getInt(invocant.unboxToInt.get * i.unboxToInt.get)
case f: MoeNumObject => getFloat(invocant.unboxToDouble.get * f.unboxToDouble.get)
case f: MoeNumObject => getNum(invocant.unboxToDouble.get * f.unboxToDouble.get)
case _ => throw new MoeErrors.UnexpectedType(args(0).toString)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/org/moe/runtime/builtins/NumClass.scala
Expand Up @@ -20,7 +20,7 @@ object NumClass {
new MoeMethod(
"infix:<+>",
{ (invocant, args) =>
getFloat(invocant.unboxToDouble.get + args(0).unboxToDouble.get)
getNum(invocant.unboxToDouble.get + args(0).unboxToDouble.get)
}
)
)
Expand Down

0 comments on commit cd5230a

Please sign in to comment.