private static boolean isTerminated(final String gremlin) {
        return gremlin.endsWith(".") || gremlin.endsWith("(") || gremlin.endsWith(",");
    }
Some Gremlin in documentation is just not going to parse.
gremlin-language/src/main/java/org/apache/tinkerpop/gremlin/language/corpus/DocumentationReader.java