gnu.expr
Class Keyword

java.lang.Object
  |
  +--gnu.expr.Keyword

public class Keyword
extends java.lang.Object
implements Printable, Compilable


Method Summary
 void emit(Literal literal, Compilation comp)
          Emit code (in comp.method) to initialize a Literal for this value.
 java.lang.String getName()
           
 int hashCode()
           
static boolean isKeyword(java.lang.Object obj)
           
static Keyword make(java.lang.String name)
          Create or find a Keyword with a given name (without final ':').
 Literal makeLiteral(Compilation comp)
          Generates a (new) Literal for this for a given Compilation.
 void print(java.io.PrintWriter ps)
           
static java.lang.Object searchForKeyword(java.lang.Object[] vals, int offset, java.lang.Object keyword)
          Search vals[0:offset-1] for a keyword.
static java.lang.Object searchForKeyword(java.lang.Object[] vals, int offset, java.lang.Object keyword, java.lang.Object dfault)
          Search vals[0:offset-1] for a keyword.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

make

public static Keyword make(java.lang.String name)
Create or find a Keyword with a given name (without final ':').
Parameters:
name - the print-name of the desired Keyword
Returns:
a Keyword with the given name, newly created iff none such exist

isKeyword

public static boolean isKeyword(java.lang.Object obj)

toString

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

print

public void print(java.io.PrintWriter ps)
Specified by:
print in interface Printable

searchForKeyword

public static java.lang.Object searchForKeyword(java.lang.Object[] vals,
                                                int offset,
                                                java.lang.Object keyword)
Search vals[0:offset-1] for a keyword. Each key at vals[i] is followed by a value at keys[i+1]. (This is used to search for a keyword parameter in an argument list.)
Parameters:
vals - the list to search in
offset - the index in vals to start the search at
keyword - the keyword to search for
Returns:
vals[i+1] such that vals[i]==keyword (and (i-offset) is even and non-negative); if there is no such i, return Special.dfault.

searchForKeyword

public static java.lang.Object searchForKeyword(java.lang.Object[] vals,
                                                int offset,
                                                java.lang.Object keyword,
                                                java.lang.Object dfault)
Search vals[0:offset-1] for a keyword. Each key at vals[i] is followed by a value at keys[i+1]. (This is used to search for a keyword parameter in an argument list.)
Parameters:
vals - the list to search in
offset - the index in vals to start the search at
keyword - the keyword to search for
dfault - the value to return if there is no match
Returns:
vals[i+1] such that vals[i]==keyword (and (i-offset) is even and non-negative); if there is no such i, return dfault.

getName

public final java.lang.String getName()

makeLiteral

public Literal makeLiteral(Compilation comp)
Description copied from interface: Compilable
Generates a (new) Literal for this for a given Compilation. If this has sub-objects, calls Compilation.findLiteral on its components.
Specified by:
makeLiteral in interface Compilable

emit

public void emit(Literal literal,
                 Compilation comp)
Description copied from interface: Compilable
Emit code (in comp.method) to initialize a Literal for this value. Generates code to make the Literal at least ALLOACTED. Also makes it INITIALIZED, unless ALLOCATING is set (in which one of our callers will make it INITIALIZED). Never called if already ALLOCATED.
Specified by:
emit in interface Compilable