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 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.