public static Direction parseTraversalDirectionFromContext(final GremlinParser.TraversalDirectionContext context) {
        String text = context.getText();
        if (text.startsWith(Direction.class.getSimpleName()))
            text = text.substring(Direction.class.getSimpleName().length() + 1);
        return Direction.directionValueOf(text);
    }
Parsing of {@link Direction} requires some special handling because of aliases (from/to).
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalEnumParser.java