Package kawa.lang
Class SyntaxForms
- java.lang.Object
-
- kawa.lang.SyntaxForms
-
public class SyntaxForms extends java.lang.ObjectHelper method and implementation classes for SyntaxForm.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSyntaxForms.PairSyntaxFormstatic classSyntaxForms.PairWithPositionSyntaxFormstatic classSyntaxForms.SimpleSyntaxForm
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUGGING
-
Constructor Summary
Constructors Constructor Description SyntaxForms()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectfromDatum(java.lang.Object datum, SyntaxForm template)Make a SyntaxForm object with the same contextual information as this.static java.lang.ObjectfromDatumIfNeeded(java.lang.Object datum, SyntaxForm template)static booleanidentifierEquals(java.lang.Object id1, java.lang.Object id2, boolean checkBound)Utility method to implement Scheme free-identifier=? and bound-identifier=?.static booleanisIdentifier(SyntaxForm form)static java.lang.ObjectmakeForm(java.lang.Object datum, TemplateScope scope)static java.lang.ObjectmakeWithTemplate(java.lang.Object template, java.lang.Object form)static java.lang.ObjectmakeWithTemplate(java.lang.Object template, java.lang.Object datum, java.lang.Object srcloc)Create a syntax object with specified datum, and given syntatic context.static Expressionrewrite(java.lang.Object x)static ExpressionrewriteBody(java.lang.Object x)static ExpressionrewriteCar(java.lang.Object x)static java.lang.StringtoString(SyntaxForm sform, java.lang.String id)
-
-
-
Field Detail
-
DEBUGGING
public static final boolean DEBUGGING
- See Also:
- Constant Field Values
-
-
Method Detail
-
makeForm
public static java.lang.Object makeForm(java.lang.Object datum, TemplateScope scope)
-
makeWithTemplate
public static java.lang.Object makeWithTemplate(java.lang.Object template, java.lang.Object datum, java.lang.Object srcloc)Create a syntax object with specified datum, and given syntatic context. Used to implementdatum->syntax.- Parameters:
template- If this is aSyntaxForm, use its scope; otherwise use the currentCompilation's current scope. (This means just returning the datum as-is.)datum- The value (S-expression datum) to use.srcloc- Used to set source location (line number etc). Ignored if null; otherwise should be aSourceLocator.
-
makeWithTemplate
public static java.lang.Object makeWithTemplate(java.lang.Object template, java.lang.Object form)
-
identifierEquals
public static boolean identifierEquals(java.lang.Object id1, java.lang.Object id2, boolean checkBound)Utility method to implement Scheme free-identifier=? and bound-identifier=?.- Parameters:
id1- An identifier - either a symbol or a SyntaxForm whose form is a symbol. We assume it satisfies the Scheme predicate identifier?.id2- The other identifier to compare against.checkBound- true for bound-identifier=? and false for free-identifier=?.
-
isIdentifier
public static boolean isIdentifier(SyntaxForm form)
-
fromDatum
public static java.lang.Object fromDatum(java.lang.Object datum, SyntaxForm template)Make a SyntaxForm object with the same contextual information as this.- Parameters:
datum- which used for the new syntax value. Corresponds to thedatum->syntax-objectfunction.
-
fromDatumIfNeeded
public static java.lang.Object fromDatumIfNeeded(java.lang.Object datum, SyntaxForm template)
-
rewrite
public static Expression rewrite(java.lang.Object x)
-
rewriteCar
public static Expression rewriteCar(java.lang.Object x)
-
rewriteBody
public static Expression rewriteBody(java.lang.Object x)
-
toString
public static java.lang.String toString(SyntaxForm sform, java.lang.String id)
-
-