Package kawa.lang

Class SyntaxForms


  • public class SyntaxForms
    extends Object
    Helper method and implementation classes for SyntaxForm.
    • Constructor Detail

      • SyntaxForms

        public SyntaxForms()
    • Method Detail

      • makeWithTemplate

        public static Object makeWithTemplate​(Object template,
                                              Object datum,
                                              Object srcloc)
        Create a syntax object with specified datum, and given syntatic context. Used to implement datum->syntax.
        Parameters:
        template - If this is a SyntaxForm, use its scope; otherwise use the current Compilation'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 a SourceLocator.
      • makeWithTemplate

        public static Object makeWithTemplate​(Object template,
                                              Object form)
      • identifierEquals

        public static boolean identifierEquals​(Object id1,
                                               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 Object fromDatum​(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 the datum->syntax-object function.