public class ParserAttribute
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COLUMN_NUMBER_NAME |
static java.lang.String |
LINE_NUMBER_NAME |
static java.lang.String |
OFFSET_NAME |
static java.lang.String |
REGEX_NAME |
Constructor and Description |
---|
ParserAttribute(java.lang.String name,
java.lang.String value)
Create a parser attribute.
|
Modifier and Type | Method and 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() |
public static final java.lang.String LINE_NUMBER_NAME
public static final java.lang.String COLUMN_NUMBER_NAME
public static final java.lang.String OFFSET_NAME
public static final java.lang.String REGEX_NAME
public ParserAttribute(java.lang.String name, java.lang.String value)
name
- the attribute namevalue
- the attribute valuejava.lang.NullPointerException
- if the name or value are nullpublic java.lang.String getName()
public java.lang.String getValue()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object