Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed much stub

  • Loading branch information...
commit 1893de7dc3fb1775868a4d01c2ebf54b80a7ada2 1 parent 5e6c98b
@jrudolph authored
View
4 eclipse/EvaluateSpecs.launch
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="scala.application">
<stringAttribute key="bad_container_name" value="/objectformatter/eclips"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
@@ -7,6 +7,8 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.virtualvoid.string.EvaluateSpecs"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="objectformatter"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.sourcepathProvider"/>
</launchConfiguration>
View
4 eclipse/ParserSpecs.launch
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="scala.application">
<stringAttribute key="bad_container_name" value="/objectformatter/eclips"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
@@ -7,6 +7,8 @@
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.virtualvoid.string.ParserSpecs"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="objectformatter"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.maven.ide.eclipse.launchconfig.sourcepathProvider"/>
</launchConfiguration>
View
78 src/main/scala/net/virtualvoid/string/FormatCompiler.scala
@@ -23,10 +23,10 @@ object Compiler{
case p@ParentExp(inner,parent) =>{
val m = p.method(cl)
f.dynMethod(m,classOf[AnyRef]) ~
- (compileGetExp(inner,m.getReturnType.asInstanceOf[Class[Object]],retType))
+ compileGetExp(inner,m.getReturnType.asInstanceOf[Class[Object]],retType)
}
case ThisExp =>
- f.checkcast(retType) // TODO: don't know why we need this, examine it
+ f.~(checkcast(retType)) // TODO: don't know why we need this, examine it
case e:Exp => {
f.dynMethod(e.method(cl),retType)
}
@@ -36,45 +36,45 @@ object Compiler{
= tok match {
case Literal(str) => f.ldc(str).method2(_.append(_))
case e:Exp =>
- (f.l.load.e
- ~ compileGetExp(e,cl,classOf[AnyRef])
- ~ method(_.toString))
- .method2(_.append(_))
+ f ~ (_.l.load.e) ~
+ compileGetExp(e,cl,classOf[AnyRef]) ~
+ method(_.toString) ~
+ method2(_.append(_))
case SpliceExp(exp,sep,inner) => {
val retType = exp.returnType(cl)
if (classOf[java.lang.Iterable[_]].isAssignableFrom(retType)){
val eleType:Class[AnyRef] = elementType(exp.genericReturnType(cl)).asInstanceOf[Class[AnyRef]]
val jmpTarget =
- f.l.load.e
- .swap // save one instance of T for later
- .l.load.e
- .~(compileGetExp(exp,cl,classOf[java.lang.Iterable[AnyRef]]))
- .method(_.iterator)
- .l.store.e
- .target
- jmpTarget
- .l.load.e
- .method(_.hasNext)
- .ifeq(f=>
- f.l.load.e
- .swap
- .l.load.e
- .method(_.next)
- .checkcast(eleType)
- .l.store.e
- .~(compileToks(inner,eleType))
- .swap
- .dup
- .l.store.e
- .method(_.hasNext)
- .ifeq(f =>
- f.ldc(sep:jString)
- .method2(_.append(_))
- .jmp(jmpTarget)) //todo: introduce ifeq(thenCode,elseTarget)
- .jmp(jmpTarget))
- .swap
- .l.store.e
+ f ~ (_.l.load.e) ~
+ swap ~ // save one instance of T for later
+ (_.l.load.e) ~
+ compileGetExp(exp,cl,classOf[java.lang.Iterable[AnyRef]]) ~
+ method(_.iterator) ~
+ (_.l.store.e) ~
+ target
+ jmpTarget ~
+ (_.l.load.e) ~
+ method(_.hasNext) ~
+ ifeq(f =>
+ f.l.load.e ~
+ swap ~
+ (_.l.load.e) ~
+ method(_.next) ~
+ checkcast(eleType) ~
+ (_.l.store.e) ~
+ compileToks(inner,eleType) ~
+ swap ~
+ dup ~
+ (_.l.store.e) ~
+ method(_.hasNext) ~
+ ifeq(f =>
+ f~ldc(sep:jString) ~
+ method2(_.append(_)) ~
+ jmp(jmpTarget)) ~ //todo: introduce ifeq(thenCode,elseTarget)
+ jmp(jmpTarget)) ~
+ swap ~
+ (_.l.store.e)
}
else if (retType.isArray){
val eleType:Class[AnyRef] = retType.getComponentType.asInstanceOf[Class[AnyRef]]
@@ -97,7 +97,7 @@ object Compiler{
.arraylength
.swap
.isub
- .ifeq(f =>
+ .~(ifeq(f =>
f.dup_x1
.l.load.e
.swap
@@ -116,15 +116,15 @@ object Compiler{
.l.load.e
.arraylength
.isub
- .ifeq(f=>
+ .~(ifeq(f =>
f.swap
.ldc(sep)
.method2(_.append(_))
.swap
.jmp(jmpTarget)
- )
+ ))
.jmp(jmpTarget)
- )
+ ))
.pop
.swap
.l.store.e
Please sign in to comment.
Something went wrong with that request. Please try again.