code: public static Optional<ParserRuleContext> findFirstChildNode(final ParserRuleContext node, final RuleName ruleName) {
          Queue<ParserRuleContext> parserRuleContexts = new LinkedList<>();
          parserRuleContexts.add(node);
          ParserRuleContext parserRuleContext;
          while (null != (parserRuleContext = parserRuleContexts.poll())) {
              if (isMatchedNode(parserRuleContext, ruleName)) {
                  return Optional.of(parserRuleContext);
              }
              for (int i = 0; i < parserRuleContext.getChildCount(); i++) {
                  if (parserRuleContext.getChild(i) instanceof ParserRuleContext) {
                      parserRuleContexts.add((ParserRuleContext) parserRuleContext.getChild(i));
                  }
              }
          }
          return Optional.absent();
      }
docs: Find first child node.
  
  @param node start node
  @param ruleName rule name
  @return matched node