public static Set<String> parse(final String documentationDir) throws IOException {
        final Set<String> gremlins = new LinkedHashSet<>();
        Files.find(Paths.get(documentationDir),
                Integer.MAX_VALUE,
                (filePath, fileAttr) -> fileAttr.isRegularFile() && (filePath.toString().endsWith("traversal.asciidoc") || filePath.toString().contains("recipes"))).
                sorted().
                forEach(f -> {
                    String currentGremlin = "";
                    int openSnippet = 0;

                    try {
                        final List<String> lines = Files.readAllLines(f, StandardCharsets.UTF_8);
                        for (String line : lines) {
                            // trim and remove callouts
                            String cleanLine = line.replaceAll("<\\d*>", "").trim();

                            // remove line comments
                            int pos = cleanLine.indexOf("//");
                            if (pos > 0) cleanLine = cleanLine.substring(0, pos).trim();

                            if (sourceCodePattern.matcher(cleanLine).matches() || (openSnippet > 0 && cleanLine.equals("----"))) {
                                if (openSnippet > 1) {
                                    openSnippet = 0;
                                } else {
                                    openSnippet++;
                                }
                            } else if (openSnippet > 0 && (startGremlinPattern.matcher(cleanLine).matches() || isTerminated(currentGremlin))) {
                                // new line of Gremlin that starts with g.
                                currentGremlin += cleanLine;

                                // line doesn't continue if there is no period or open paren
                                if (!isTerminated(currentGremlin)) {
                                    final String gremlinToAdd = replaceVariables(currentGremlin.trim());
                                    if (!throwAway.contains(gremlinToAdd))
                                        gremlins.add(gremlinToAdd);
                                    currentGremlin = "";
                                }
                            }
                        }
                    } catch (IOException ioe) {
                        throw new RuntimeException(ioe);
                    }
                });

        return gremlins;
    }
Some Gremlin in documentation is just not going to parse.
gremlin-language/src/main/java/org/apache/tinkerpop/gremlin/language/corpus/DocumentationReader.java