Cole-Greer commented on code in PR #3401:
URL: https://github.com/apache/tinkerpop/pull/3401#discussion_r3164939472
##########
docs/src/upgrade/release-4.x.x.asciidoc:
##########
@@ -51,6 +51,65 @@ deserialization in GraphBinary is unchanged. Applications
that depend on the `uu
`gremlin-javascript` brought it in as a transitive dependency should add it
directly to their own `package.json`
if they still need it.
+==== New Gremlin-Lang Literals
+
+The canonical Gremlin grammar now includes literal syntax for `Character`,
`Duration`, and `Binary` types. These
+literals can be used directly in traversals without falling back to parameter
serialization.
+
+===== Character
+
+A character literal is a single-character string with a `c` suffix:
+
+[source,text]
+----
+g.V().has("initial","M"c)
+----
+
+NOTE: Character is not supported in gremlin-go or gremlin-javascript.
Review Comment:
Can we map Gremlin characters to the builtin `Rune` type in Go?
https://go.dev/blog/strings#code-points-characters-and-runes
##########
docs/src/dev/developer/for-committers.asciidoc:
##########
@@ -385,7 +385,12 @@ appropriate types expected by the tests.
The syntax of the type notation involves a prefix character to help denote the
type, a value between two square
brackets, optionally suffixed with some additional notation depending on the
primary type.
+* Binary - *bin[_xxx_]* - The "xxx" should be replaced with a base64-encoded
string.
+* Character - *char[_xxx_]* - The "xxx" should be replaced with a single UTF-8
character.
* Date - *dt[_xxx_]* - The "xxx" should be ISO 8601 string.
+* Duration - *dur[_xxx_,_yyy_,_zzz_]* - The "xxx" should be replaced a Long
representing seconds, the "yyy" should be
+replaced an Int representing nanoseconds, and the optional "zzz" should be
replaced by a boolean which is true if the
+value is positive and false if its negative.
* Edge - *e[_xxx_]* - The "xxx" should be replaced with a representation of an
edge in the form of the
Review Comment:
Can we also document the new `@DataChar`, `@DataDuration`, and `@DataBinary`
tags in the below `[[gherkin-tags]]` section?
##########
gremlin-language/src/main/antlr4/Gremlin.g4:
##########
@@ -2500,6 +2520,26 @@ SignedInfLiteral
// String Literals
+// Character literal is a single character string with a 'c' suffix, modeled
after printf's %c.
+// Must appear before NonEmptyStringLiteral for longest-match priority.
+CharacterLiteral
+ : '"' DoubleQuotedStringCharacter '"' 'c'
+ | '\'' SingleQuotedStringCharacter '\'' 'c'
Review Comment:
Should we also allow `C` as a suffix (and `s` and `S` for Strings). That
would be more consistent with `FloatTypeSuffix` and `IntegerTypeSuffix`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]