kawa.lang
Class SyntaxForm

java.lang.Object
  extended by kawa.lang.SyntaxForm
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class SyntaxForm
extends java.lang.Object
implements java.io.Externalizable

A "syntatic closure" - a syntax form with its compilation environment.

See Also:
Serialized Form

Field Summary
 java.lang.Object form
           
 TemplateScope scope
           
 
Method Summary
static boolean freeIdentifierEquals(SyntaxForm id1, SyntaxForm id2)
           
 SyntaxForm fromDatum(java.lang.Object form)
          Make a SyntaxForm object with the same contextual information as this.
 SyntaxForm fromDatumIfNeeded(java.lang.Object form)
           
 boolean isIdentifier()
           
static SyntaxForm make(java.lang.Object form, TemplateScope scope)
           
static java.lang.Object makeWithTemplate(java.lang.Object template, java.lang.Object form)
          Create a syntax object with specified form, and given syntatic context.
 void readExternal(java.io.ObjectInput in)
           
static Expression rewrite(java.lang.Object x)
           
static Expression rewriteBody(java.lang.Object x)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

form

public java.lang.Object form

scope

public TemplateScope scope
Method Detail

make

public static SyntaxForm make(java.lang.Object form,
                              TemplateScope scope)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

fromDatum

public SyntaxForm fromDatum(java.lang.Object form)
Make a SyntaxForm object with the same contextual information as this.

Parameters:
form - which used for the new syntax value. Corresponds to the datum->syntax-object function.

makeWithTemplate

public static java.lang.Object makeWithTemplate(java.lang.Object template,
                                                java.lang.Object form)
Create a syntax object with specified form, and given syntatic context. Used to implement datum->syntax-object in the syntax-case API.

Parameters:
template - If this is a SyntaxForm, use its scope; otherwise use the current Compilation's current scope. (This means just returning the form as-is.)
form - The value (S-expression form) to use.

fromDatumIfNeeded

public SyntaxForm fromDatumIfNeeded(java.lang.Object form)

rewrite

public static Expression rewrite(java.lang.Object x)

rewriteBody

public static Expression rewriteBody(java.lang.Object x)

isIdentifier

public boolean isIdentifier()

freeIdentifierEquals

public static boolean freeIdentifierEquals(SyntaxForm id1,
                                           SyntaxForm id2)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException