Class TagChunk
java.lang.Object
org.antlr.v4.runtime.tree.pattern.Chunk
org.antlr.v4.runtime.tree.pattern.TagChunk
Represents a placeholder tag in a tree pattern. A tag can have any of the
following forms.
expr: An unlabeled placeholder for a parser ruleexpr.ID: An unlabeled placeholder for a token of typeID.e:expr: A labeled placeholder for a parser ruleexpr.id:ID: A labeled placeholder for a token of typeID.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
tag
-
label
This is the backing field forgetLabel().
-
-
Constructor Details
-
TagChunk
Construct a new instance ofTagChunkusing the specified tag and no label.- Parameters:
tag- The tag, which should be the name of a parser rule or token type.- Throws:
IllegalArgumentException- iftagisnullor empty.
-
TagChunk
Construct a new instance ofTagChunkusing the specified label and tag.- Parameters:
label- The label for the tag. If this isnull, theTagChunkrepresents an unlabeled tag.tag- The tag, which should be the name of a parser rule or token type.- Throws:
IllegalArgumentException- iftagisnullor empty.
-
-
Method Details
-
getTag
-
getLabel
Get the label, if any, assigned to this chunk.- Returns:
- The label assigned to this chunk, or
nullif no label is assigned to the chunk.
-
toString
-