gcy

package
v0.0.0-...-af33e7b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2023 License: BSD-3-Clause, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gcy contains a lexer and parser for a graph language.

Language EBNF:

Query := SearchQuery | DeleteQuery | CreateQuery
SearchQuery := ( Roots [ Match ] | Match ) Returns
Roots := "start" Root
Root := name "=" NodeOrRel "(" id ")" ["," Root]
NodeOrRel := "node" | "relation"
Returns := "return" ReturnVal ["," Return]
Return := name ["," Return]
Match := "match" PathPart
PathPart := PathAssignment | Path
PathAssignment := name "=" Path
Path := NodeRel
NodeRel := "(" name ")" DirectionalRel "(" name ")"
DirectionalRel := "<-" "[" name [":" name ] [ RelCount ] "]"
RelCount := "*" | \d+ [".." * | \d+]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	Paths []*Path
}

type Node

type Node struct {
	Name   string
	Labels []string
	Props  map[string]string

	LeftRel, RightRel *Relation
}

type Path

type Path struct {
	Name  string
	Start *Node
}

type Query

type Query struct {
	Roots   []*Root
	Match   *Match
	Returns []*Returnable
	Deletes []*Returnable
	Creates []*Returnable
}

func Parse

func Parse(filename string, src string) (*Query, error)

Parse a give string using gcy. The filename is only used for reporting. Make sure to check the returned error, this function may return partially parsed elements.

type Relation

type Relation struct {
	Name        string
	Direction   string
	Types       []string
	Cardinality string

	LeftNode, RightNode *Node
}

type Returnable

type Returnable struct {
	Type string // int, string, function, variable

	Name          string
	Alias         string
	Object, Field string
	Vars          []*Returnable
	Value         interface{}
}

type Root

type Root struct {
	Name   string
	Typ    string
	IdVars []int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL