[
https://issues.apache.org/jira/browse/TINKERPOP-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18077378#comment-18077378
]
ASF GitHub Bot commented on TINKERPOP-3153:
-------------------------------------------
kenhuuu commented on code in PR #3401:
URL: https://github.com/apache/tinkerpop/pull/3401#discussion_r3169274627
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/translator/PythonTranslateVisitor.java:
##########
@@ -289,6 +289,42 @@ public Void visitUuidLiteral(final
GremlinParser.UuidLiteralContext ctx) {
return null;
}
+ @Override
+ public Void visitCharacterLiteral(final
GremlinParser.CharacterLiteralContext ctx) {
+ final String text = ctx.getText();
+ final String withoutSuffix = text.substring(0, text.length() - 1);
+ final String inner = removeFirstAndLastCharacters(withoutSuffix);
+ sb.append("SingleChar('").append(inner).append("')");
Review Comment:
Yes this works. But you are actually pointing out an inconsistency that I
didn't mention. Java/.NET/Go output the value wrapped in "" by default, but
JavaScript and Python wrap in ''. So there is a bit of an inconsistency there.
The grammar, however, accepts both, so even when repr() swaps from ' to ", it
still works.
> Expand type syntax in grammar in 4.0
> ------------------------------------
>
> Key: TINKERPOP-3153
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3153
> Project: TinkerPop
> Issue Type: Improvement
> Affects Versions: 4.0.0
> Reporter: Ken Hu
> Priority: Major
>
> Types to add to the grammar in 4.0:
> * Char
> ** Unfortunately '' is already used for strings to match Groovy. Will need
> to look into something nice for this.
> * Duration
> ** Should check to see if Duration can be used for date functions as well
> ** Duration(Long)
> * CompositePdt
> ** Pdt("name", [ : ] )
> * PrimitivePdt
> ** Pdt("name", "value")
> * Tree
> * Graph
> * Binary (ByteBuffer) - moved from 3.8.0
> ** {{Binary( '/9j/4AAQSkZJRgABAQEAAAAAAAD/==')}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)