kawa.lang

Class Quote

Implemented Interfaces:
Named, Printable
Known Direct Subclasses:
syntax

public class Quote
extends Syntax

The Syntax transformer that re-writes the "quote" "quasiquote" primitive. In both cases recursively resolves SyntaxForm wrappers and resolves namespaces of symbols. In the case of quasiquote also handles unquoting.

Field Summary

protected static int
QUOTE_DEPTH
An initial value for 'depth' for plain (non-quasi) quote.
protected boolean
isQuasi
True for quasiquote; false for plain quote.
static Quote
plainQuote
static Quote
quasiQuote

Constructor Summary

Quote(String name, boolean isQuasi)

Method Summary

static Object
append$V(Object[] args)
Same as regular append, but handle SyntaxForm wrappers.
protected Expression
coerceExpression(Object val, Translator tr)
static Object
consX$V(Object[] args)
A wrapper around LList.consX to make it a "variable-arg method".
protected Object
expand(Object template, int depth, Translator tr)
protected boolean
expandColonForms()
protected Expression
leaf(Object val, Translator tr)
static Object
quote(Object obj)
Quote an object (without namespace-expansion).
static Object
quote(Object obj, Translator tr)
Quote an object (without namespace-expansion).
Expression
rewrite(Object obj, Translator tr)

Methods inherited from class kawa.lang.Syntax

getName, getSymbol, print, rewrite, rewriteForm, rewriteForm, scanForDefinitions, scanForm, setName, setName

Field Details

QUOTE_DEPTH

protected static final int QUOTE_DEPTH
An initial value for 'depth' for plain (non-quasi) quote.
Field Value:
-1

isQuasi

protected boolean isQuasi
True for quasiquote; false for plain quote.

plainQuote

public static final Quote plainQuote

quasiQuote

public static final Quote quasiQuote

Constructor Details

Quote

public Quote(String name,
             boolean isQuasi)

Method Details

append$V

public static Object append$V(Object[] args)
Same as regular append, but handle SyntaxForm wrappers.

coerceExpression

protected Expression coerceExpression(Object val,
                                      Translator tr)

consX$V

public static Object consX$V(Object[] args)
A wrapper around LList.consX to make it a "variable-arg method".

expand

protected Object expand(Object template,
                        int depth,
                        Translator tr)

expandColonForms

protected boolean expandColonForms()

leaf

protected Expression leaf(Object val,
                          Translator tr)

quote

public static Object quote(Object obj)
Quote an object (without namespace-expansion). Basically just recursively removes SyntaxForm wrappers.

quote

public static Object quote(Object obj,
                           Translator tr)
Quote an object (without namespace-expansion). Basically just recursively removes SyntaxForm wrappers.

rewrite

public Expression rewrite(Object obj,
                          Translator tr)
Overrides:
rewrite in interface Syntax