Created
May 20, 2016 09:56
-
-
Save Balletie/95e4ea8446c744d411114559a469b285 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package paplj.interpreter.generated.terms; | |
import org.spoofax.interpreter.core.Tools; | |
import org.metaborg.meta.lang.dynsem.interpreter.terms.ITerm; | |
import org.spoofax.interpreter.terms.*; | |
import com.oracle.truffle.api.CompilerAsserts; | |
public abstract class IVTerm implements ITerm | |
{ | |
public static IVTerm create(IStrategoTerm term) | |
{ | |
CompilerAsserts.neverPartOfCompilation(); | |
assert term != null; | |
if(Tools.isTermAppl(term) && Tools.hasConstructor((IStrategoAppl)term, "NumV", 1)) | |
{ | |
return NumV_1_Term.create(term); | |
} | |
if(Tools.isTermAppl(term) && Tools.hasConstructor((IStrategoAppl)term, "BoolV", 1)) | |
{ | |
return BoolV_1_Term.create(term); | |
} | |
if(Tools.isTermAppl(term) && Tools.hasConstructor((IStrategoAppl)term, "NullV", 0)) | |
{ | |
return NullV_0_Term.create(term); | |
} | |
if(Tools.isTermAppl(term) && Tools.hasConstructor((IStrategoAppl)term, "ExceptionV", 0)) | |
{ | |
return ExceptionV_0_Term.create(term); | |
} | |
if(Tools.isTermAppl(term) && Tools.hasConstructor((IStrategoAppl)term, "o2v", 1)) | |
{ | |
return o2v_1_Term.create(term); | |
} | |
if(Tools.isTermAppl(term) && Tools.hasConstructor((IStrategoAppl)term, "u2v", 1)) | |
{ | |
return u2v_1_Term.create(term); | |
} | |
try | |
{ | |
return new o2v_1_Term(IObjTerm.create(term)); | |
} | |
catch(IllegalStateException ilsex) | |
{ | |
try | |
{ | |
return new u2v_1_Term(IUnitTerm.create(term)); | |
} | |
catch(IllegalStateException ilsex) | |
{ | |
throw new IllegalStateException("Unsupported term: " + term); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment