Package icyllis.arc3d.compiler

# Class SymbolTable

java.lang.Object
icyllis.arc3d.compiler.SymbolTable

public final class SymbolTable extends Object
Maps identifiers to symbols, each instance represents a scope level or a module boundary.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Symbol`
  `find(String name)`
  Looks up the requested symbol and returns a const pointer.
  `Symbol`
  `findBuiltinSymbol(String name)`
  Looks up the requested symbol, only searching the built-in symbol tables.
  `Type`
  `getArrayType(Type type, int size)`
  Finds or creates an array type with the given element type and array size.
  `SymbolTable`
  `getParent()`
  `<T extends Symbol>
  T`
  `insert(Context context, T symbol)`
  Inserts a symbol into the symbol table, reports errors if there was a name collision.
  `boolean`
  `isBuiltin()`
  `boolean`
  `isBuiltinType(String name)`
  Returns true if the name refers to a builtin type.
  `boolean`
  `isType(String name)`
  Returns true if the name refers to a type (user or built-in) in the current symbol table.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getParent

    public SymbolTable getParent()

  - ### isBuiltin

    public boolean isBuiltin()
    Returns:
      true if this symbol table is at built-in level

  - ### find

    @Nullable public Symbol find(String name)
    Looks up the requested symbol and returns a const pointer.

  - ### findBuiltinSymbol

    @Nullable public Symbol findBuiltinSymbol(String name)
    Looks up the requested symbol, only searching the built-in symbol tables. Always const.

  - ### isType

    public boolean isType(String name)
    Returns true if the name refers to a type (user or built-in) in the current symbol table.

  - ### isBuiltinType

    public boolean isBuiltinType(String name)
    Returns true if the name refers to a builtin type.

  - ### insert

    @Nullable public <T extends Symbol> T insert(Context context, @Nonnull T symbol)
    Inserts a symbol into the symbol table, reports errors if there was a name collision.
    Returns:
      the given symbol if successful, or null if there was a name collision

  - ### getArrayType

    public Type getArrayType(Type type, int size)
    Finds or creates an array type with the given element type and array size.