protected void visitP(final ParserRuleContext ctx, final Class<?> clazzOfP, final String methodName) {
        sb.append(clazzOfP.getSimpleName());
        appendStepSeparator();
        sb.append(processGremlinSymbol(methodName));
        appendStepOpen();

        final List<ParseTree> list =  ctx.children.stream().filter(
                t -> t instanceof GremlinParser.GenericArgumentContext ||
                              t instanceof GremlinParser.GenericArgumentVarargsContext ||
                              t instanceof GremlinParser.StringArgumentContext ||
                              t instanceof GremlinParser.TraversalPredicateContext).collect(Collectors.toList());
        for (int ix = 0; ix < list.size(); ix++) {
            visit(list.get(ix));
            if (ix < list.size() - 1) appendArgumentSeparator();
        }

        appendStepClose();
    }
A Gremlin to Gremlin translator. Makes no changes to input except:
<ul>
    <li>Normalizes whitespace</li>
    <li>Normalize numeric suffixes to lower case</li>
    <li>Makes anonymous traversals explicit with double underscore</li>
    <li>Makes enums explicit with their proper name</li>
</ul>
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/translator/TranslateVisitor.java