package parser

Import Path
	github.com/freeeve/gochickpeas/gql/internal/parser (on go.dev)

Dependency Relation
	imports 7 packages, and imported by one package

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). Msg string Pos int Error formats the message with its position. *Error : error
Token is one lexed token; Pos is the byte offset in the input. Kind TokKind Pos int Text string
TokKind discriminates a token. const TokAmp const TokBang const TokColon const TokComma const TokDot const TokDotDot const TokEOF const TokEq const TokFloat const TokGt const TokGte const TokIdent const TokInt const TokLBrace const TokLBracket const TokLParen const TokLt const TokLte const TokMinus const TokNeq const TokParam const TokPercent const TokPipe const TokPlus const TokQuestion const TokRBrace const TokRBracket const TokRParen const TokSlash const TokStar const TokStr
Package-Level Functions (only one)
Parse parses one GQL query. The error, when non-nil, is a *parser.Error carrying the byte offset (the root gql package wraps it with ErrParse).
Package-Level Constants (total 31)
const TokAmp TokKind = 19 // &
const TokBang TokKind = 20 // !
const TokColon TokKind = 17 // :
const TokComma TokKind = 12 // ,
const TokDot TokKind = 13 // .
const TokDotDot TokKind = 14 // ..
TokEOF terminates the stream.
const TokEq TokKind = 21 // =
TokFloat is a float literal (digits '.' digits).
const TokGt TokKind = 25 // >
const TokGte TokKind = 26 // >=
TokIdent is an identifier or (case-insensitive) keyword; Text keeps the original spelling.
TokInt is an integer literal.
const TokLBrace TokKind = 10 // {
const TokLBracket TokKind = 8 // [
Punctuation and operators.
const TokLt TokKind = 23 // <
const TokLte TokKind = 24 // <=
const TokMinus TokKind = 28 // -
const TokNeq TokKind = 22 // <>
TokParam is $name; Text is the name (not reserved-word checked).
const TokPercent TokKind = 16
const TokPipe TokKind = 18 // |
const TokPlus TokKind = 27 // +
const TokQuestion TokKind = 15
const TokRBrace TokKind = 11 // }
const TokRBracket TokKind = 9 // ]
const TokRParen TokKind = 7 // )
const TokSlash TokKind = 30 // /
const TokStar TokKind = 29 // *
TokStr is a quoted string; Text is the content, no escape processing.