Class ComplexSymbolFactory

  • All Implemented Interfaces:
    SymbolFactory

    public class ComplexSymbolFactory
    extends java.lang.Object
    implements SymbolFactory
    Default Implementation for SymbolFactory, creates plain old Symbols
    Version:
    last updated 27-03-2006
    Author:
    Michael Petter
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Symbol newSymbol​(java.lang.String name, int id)
      newSymbol creates a basic symbol; used frequently for terminal symbols, like keywords
      Symbol newSymbol​(java.lang.String name, int id, ComplexSymbolFactory.Location left, ComplexSymbolFactory.Location right)
      newSymbol creates a complex symbol with Location objects for left and right boundaries; this is used for terminals without values!
      Symbol newSymbol​(java.lang.String name, int id, ComplexSymbolFactory.Location left, ComplexSymbolFactory.Location right, java.lang.Object value)
      newSymbol creates a complex symbol with Location objects for left and right boundaries; this is used for terminals with values!
      Symbol newSymbol​(java.lang.String name, int id, Symbol left, Symbol right)
      newSymbol creates a symbol, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
      Symbol newSymbol​(java.lang.String name, int id, Symbol left, Symbol right, java.lang.Object value)
      newSymbol creates a symbol with a value, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
      Symbol newSymbol​(java.lang.String name, int id, Symbol left, java.lang.Object value)
      newSymbol creates a symbol for an empty production, taking its location from the Symbol on the left
      Symbol newSymbol​(java.lang.String name, int id, java.lang.Object value)
      newSymbol creates a basic symbol with an attached value; used frequently for terminal symbols like identifiers
      Symbol startSymbol​(java.lang.String name, int id, int state)
      newSymbol creates the start symbol
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ComplexSymbolFactory

        public ComplexSymbolFactory()
    • Method Detail

      • newSymbol

        public Symbol newSymbol​(java.lang.String name,
                                int id,
                                Symbol left,
                                java.lang.Object value)
        Description copied from interface: SymbolFactory
        newSymbol creates a symbol for an empty production, taking its location from the Symbol on the left
        Specified by:
        newSymbol in interface SymbolFactory
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        left - symbol, to take the left location from
        value - value, attached to this symbol
      • newSymbol

        public Symbol newSymbol​(java.lang.String name,
                                int id,
                                Symbol left,
                                Symbol right,
                                java.lang.Object value)
        Description copied from interface: SymbolFactory
        newSymbol creates a symbol with a value, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
        Specified by:
        newSymbol in interface SymbolFactory
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        left - symbol, to take the left location from
        right - symbol, to take the right location from
        value - value, attached to this symbol
      • newSymbol

        public Symbol newSymbol​(java.lang.String name,
                                int id,
                                Symbol left,
                                Symbol right)
        Description copied from interface: SymbolFactory
        newSymbol creates a symbol, grouping other symbols with left/right locations; used frequently by the parser to implement non-terminal symbols
        Specified by:
        newSymbol in interface SymbolFactory
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        left - symbol, to take the left location from
        right - symbol, to take the right location from
      • newSymbol

        public Symbol newSymbol​(java.lang.String name,
                                int id)
        Description copied from interface: SymbolFactory
        newSymbol creates a basic symbol; used frequently for terminal symbols, like keywords
        Specified by:
        newSymbol in interface SymbolFactory
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
      • newSymbol

        public Symbol newSymbol​(java.lang.String name,
                                int id,
                                java.lang.Object value)
        Description copied from interface: SymbolFactory
        newSymbol creates a basic symbol with an attached value; used frequently for terminal symbols like identifiers
        Specified by:
        newSymbol in interface SymbolFactory
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java
        value - value, attached to this symbol
      • startSymbol

        public Symbol startSymbol​(java.lang.String name,
                                  int id,
                                  int state)
        Description copied from interface: SymbolFactory
        newSymbol creates the start symbol
        Specified by:
        startSymbol in interface SymbolFactory
        Parameters:
        name - Textual name for the Symbol for verbose error messages
        id - enum value associated with this symbol, generated by cup via sym.java