Class ParserAttribute


  • public class ParserAttribute
    extends java.lang.Object
    Attributes that can be associated with a symbol or token.

    ParserAttributes are a way to associate arbitrary additional information with the symbols in the grammar or the tokens in the input. For example, to associate additional metadata with nonterminals or to associate line and column numbers with tokens.

    It's worth observing that the terminals created from the input stream don't get metadata.

    • Constructor Summary

      Constructors 
      Constructor Description
      ParserAttribute​(java.lang.String name, java.lang.String value)
      Create a parser attribute.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getName()
      Get the name of an attribute.
      java.lang.String getValue()
      Get the value of an attribute.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ParserAttribute

        public ParserAttribute​(java.lang.String name,
                               java.lang.String value)
        Create a parser attribute.
        Parameters:
        name - the attribute name
        value - the attribute value
        Throws:
        java.lang.NullPointerException - if the name or value are null
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name of an attribute.
        Returns:
        the attribute name
      • getValue

        public java.lang.String getValue()
        Get the value of an attribute.
        Returns:
        the attribute value
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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