getTokens method

List<TerminalNode> getTokens(
  1. int ttype
)
inherited

Implementation

List<TerminalNode> getTokens(int ttype) {
  if (children == null) {
    return [];
  }

  var tokens = <TerminalNode>[];
  for (var o in children!) {
    if (o is TerminalNode) {
      final tnode = o;
      final symbol = tnode.symbol;
      if (symbol.type == ttype) {
        tokens.add(tnode);
      }
    }
  }

  return tokens;
}