Involved Source Files CALL statement parsing: braced subqueries with the GQL variable-scope
clause, and procedure calls with expression arguments and YIELD. The Pratt expression parser. Precedence, loosest to tightest (the Rust
engine's table exactly): OR < AND < NOT < comparisons / IN / STARTS WITH
/ ENDS WITH / CONTAINS < + - < * / < unary - < postfix (IS [NOT] NULL,
slice, index, .prop, :Label). NOT binds looser than comparisons, so
NOT a = b reads NOT (a = b). The GQL lexer: whitespace-separated tokens, case-insensitive keywords
(classified by the parser, not here), quoted strings with quote
doubling and backslash escapes, scientific-notation floats, // and
/* */ comments, unicode identifiers, backtick-delimited identifiers,
and $name parameters. Package parser is the hand-written GQL parser (lexer + recursive descent
+ Pratt expressions): the read-only ISO GQL subset specified in
gql/GRAMMAR.md, lowered into the language-neutral AST.
GQL surface forms normalize into the Rust engine's segment model:
RETURN ... NEXT becomes an ast.With projection boundary; LET x = e
becomes With{star + items}; FILTER pred becomes With{star, where}; FOR x
IN list becomes ast.Unwind; CALL (vars) { ... } becomes ast.CallSubquery
with the scope vars as imports AND a synthesized importing With
prepended to every branch of the body (the clause shape the binder
expects). Cypher-only spellings (WITH, UNWIND, *1..3, shortestPath())
are rejected with pointers to the GQL forms. Projection parsing: the [DISTINCT] item-list plus the shared
ORDER BY / OFFSET|SKIP / LIMIT suffix (used by RETURN and the standalone
ORDER BY statement). Split from parser.go, which holds the query and
clause parsing. Path-pattern parsing: node patterns with label expressions and inline
property maps, relationship patterns with GQL postfix quantifiers
({m,n}, {m,}, {,n}, {m}, *, +) after the arrow -- the Cypher in-bracket
var-length spelling (*1..3) is rejected with a pointer to the GQL form. Primary expressions: literals, parens, lists, map literals, CASE,
EXISTS/COUNT subqueries, list-predicate quantifiers, function calls, and
variables. Ambiguity ordering mirrors the Rust grammar: COUNT/EXISTS
followed by '{' are subqueries (count(...) stays the aggregate); the
quantifiers all/any/none/single with a 'var IN' head are list
predicates, otherwise plain function calls. Excluded surface
(comprehensions, reduce, map projections, Cypher path-search functions)
gets targeted errors. Token kinds and the parse error type for the hand-written GQL lexer.
Package-Level Type Names (total 3)
/* sort by: | */
Error is a parse error with the byte offset it was detected at. The root
gql package wraps it with the ErrParse sentinel (this package cannot
import gql -- that would be an import cycle).MsgstringPosint Error formats the message with its position.
*Error : error
TokStr is a quoted string; Text is the content, no escape processing.
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.