Package org.nineml.coffeegrinder.util
Class ParserAttribute
- java.lang.Object
-
- org.nineml.coffeegrinder.util.ParserAttribute
-
public class ParserAttribute extends java.lang.ObjectAttributes 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 Summary
Fields Modifier and Type Field Description static java.lang.StringCOLUMN_NUMBER_NAMEstatic java.lang.StringLINE_NUMBER_NAMEstatic java.lang.StringOFFSET_NAMEstatic java.lang.StringREGEX_NAME
-
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 booleanequals(java.lang.Object obj)java.lang.StringgetName()Get the name of an attribute.java.lang.StringgetValue()Get the value of an attribute.java.lang.StringtoString()
-
-
-
Field Detail
-
LINE_NUMBER_NAME
public static final java.lang.String LINE_NUMBER_NAME
- See Also:
- Constant Field Values
-
COLUMN_NUMBER_NAME
public static final java.lang.String COLUMN_NUMBER_NAME
- See Also:
- Constant Field Values
-
OFFSET_NAME
public static final java.lang.String OFFSET_NAME
- See Also:
- Constant Field Values
-
REGEX_NAME
public static final java.lang.String REGEX_NAME
- See Also:
- Constant Field Values
-
-
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:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-