Class ParserAttribute

java.lang.Object
org.nineml.coffeegrinder.util.ParserAttribute

public class ParserAttribute extends 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.

  • Field Details

  • Constructor Details

    • ParserAttribute

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

    • getName

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

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object