getAll method

List<ParseTree> getAll(
  1. String label
)

Return all nodes matching a rule or token tag with the specified label.

If the [label] is the name of a parser rule or token in the grammar, the resulting list will contain both the parse trees matching rule or tags explicitly labeled with the label and the complete set of parse trees matching the labeled and unlabeled tags in the pattern for the parser rule or token. For example, if [label] is {@code "foo"}, the result will contain all of the following.

  • Parse tree nodes matching tags of the form {@code
  • Parse tree nodes matching tags of the form {@code
  • Parse tree nodes matching tags of the form {@code

@param label The label.

@return A collection of all ParseTree nodes matching tags with the specified label. If no nodes matched the label, an empty list is returned.

Implementation

List<ParseTree> getAll(String label) {
  final nodes = labels[label];
  if (nodes == null) {
    return [];
  }

  return nodes;
}