queryparser

package
v0.0.0-...-e3eb743 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: BSD-2-Clause, MIT Imports: 9 Imported by: 0

README

Swamp query parser loosely based on [Ben B. Johnson's SQL Parser](https://github.com/benbjohnson/sql-parser)

Documentation

Index

Constants

View Source
const (
	TYPE_AUDIO = "ext:wav ext:mp3 ext:ogg ext:flac"
	TYPE_VIDEO = "ext:mp4 ext:mkv ext:avi ext:webm ext:mov"
	TYPE_DOC   = "ext:doc ext:docm ext:pdf ext:docx ext:odf ext:pages ext:rtf ext:html ext:webarchive"
	TYPE_IMAGE = "ext:jpg ext:jpeg ext:png ext:gif ext:tiff ext:eps ext:raw"
	TYPE_EBOOK = "ext:fb2 ext:ibook ext:cbr ext:djvu ext:epub ext:mobi"
)

Variables

This section is empty.

Functions

func ParseQuery

func ParseQuery(q string) (string, error)

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser represents a parser.

func NewParser

func NewParser(r io.Reader) *Parser

NewParser returns a new instance of Parser.

func (*Parser) Parse

func (p *Parser) Parse() (string, error)

Parse parses a Swamp query

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner represents a lexical scanner.

func NewScanner

func NewScanner(r io.Reader) *Scanner

NewScanner returns a new instance of Scanner.

func (*Scanner) Scan

func (s *Scanner) Scan() (tok Token, lit string)

Scan returns the next token and literal value.

type Token

type Token int

Token represents a lexical token.

const (
	// Special tokens
	ILLEGAL Token = iota
	EOF
	WS

	// literals
	IDENT

	// Keywords
	TYPE
	UPDATED
	MODIFIED
	SIZE
)

Jump to

Keyboard shortcuts

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