Documentation ¶
Overview ¶
Package sparql parses Sparql query for translation.
Package sparql includes parsing utilities for Sparql query.
Index ¶
- func ParseQuery(queryString string) ([]base.Node, []*base.Query, *base.QueryOptions, error)
- func ScanBareIdent(r io.RuneScanner) string
- func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error)
- func ScanString(r io.RuneScanner) (string, error)
- type Orderby
- type ParseError
- type Parser
- type Pos
- type Prologue
- type QueryTree
- type Scanner
- type Select
- type Token
- type Triple
- type Where
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseQuery ¶
ParseQuery parses a sparql query into list of nodes and list of query statements.
func ScanBareIdent ¶
func ScanBareIdent(r io.RuneScanner) string
ScanBareIdent reads bare identifier from a rune reader.
func ScanDelimited ¶
func ScanDelimited( r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error)
ScanDelimited reads a delimited set of runes.
func ScanString ¶
func ScanString(r io.RuneScanner) (string, error)
ScanString reads a quoted string from a rune reader.
Types ¶
type ParseError ¶
ParseError represents an error that occurred during parsing.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a Sparql parser.
func (*Parser) Parse ¶
func (p *Parser) Parse() (*QueryTree, *ParseError)
Parse parses sparql query into syntax tree.
func (*Parser) ScanIgnoreWhitespace ¶
ScanIgnoreWhitespace scans the next non-whitespace and non-comment token.
type Pos ¶
Pos specifies the line and character position of a token. The Char and Line are both zero-based indexes.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner represents a lexical scanner for InfluxQL.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
type Token ¶
type Token int
Token is a lexical token in Sparql.
const ( // ILLEGAL and following are base tokens. ILLEGAL Token = iota EOF WS // IDENT and following are Sparql literal tokens. IDENT // rdf URI // <http://example.org> VARIABLE // ?a NUMBER // 123.45 STRING // "abc" BADSTRING // "abc BADESCAPE // \q TRUE // true FALSE // false // AND and following are Sparql operators. AND // AND OR // OR EQ // = LT // < GT // > LPAREN // ( RPAREN // ) LBRAC // { RBRAC // } COMMA // , SEMICOLON // ; DOT //. HASH // # // ASC and following are Sparql keywords. ASC BASE BY DESC DISTINCT FILTER FROM IN LIMIT ORDER PREFIX SELECT WHERE )
func (Token) Precedence ¶
Precedence returns the operator precedence of the binary operator token.