lexer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package lexer implements the lexer used bye the BadWolf query language. The lexer is losely written after the parsel model described by Rob Pike in his presentation "Lexical Scanning in Go". Slides can be found at http://cuddle.googlecode.com/hg/talk/lex.html#landing-slide.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(input string, capacity int) <-chan Token

New return a new read only channel with the tokens found in the provided input string.

Types

type Token

type Token struct {
	Type         TokenType
	Text         string
	ErrorMessage string
}

Token contains the type and text collected around the captured token.

type TokenType

type TokenType int

TokenType list all the possible tokens returned by a lexer.

const (
	// ItemError contains information about an error triggered while scanning.
	ItemError TokenType = iota
	// ItemEOF indicates end of input to be scanned in BQL.
	ItemEOF

	// ItemQuery represents the select keyword in BQL.
	ItemQuery
	// ItemInsert represents insert keyword in BQL.
	ItemInsert
	// ItemDelete represents insert keyword in BQL.
	ItemDelete
	// ItemCreate represents the creation of a graph in BQL.
	ItemCreate
	// ItemDrop represent the destruction of a graph in BQL.
	ItemDrop
	// ItemGraph represent the graph to be created of destroyed in BQL.
	ItemGraph
	// ItemData represents the data keyword in BQL.
	ItemData
	// ItemInto represents the into keyword in BQL.
	ItemInto
	// ItemFrom represents the from keyword in BQL.
	ItemFrom
	// ItemWhere represents the where keyword in BQL.
	ItemWhere
	// ItemAs represents the as keyword in BQL.
	ItemAs
	// ItemType represents keyword type in BQL.
	ItemType
	// ItemID represents id keyword in BQL.
	ItemID
	// ItemAt represents at keyword in BQL.
	ItemAt
	// ItemBefore represents the before keyword in BQL.
	ItemBefore
	// ItemAfter represents the after keyword in BQL.
	ItemAfter
	// ItemBetween represents the betwen keyword in BQL.
	ItemBetween
	// ItemCount represents the count funtion in BQL.
	ItemCount
	// ItemDistinct represents the distinct modifier in BQL.
	ItemDistinct
	// ItemSum represents the sum function in BQL.
	ItemSum
	// ItemGroup represents the group keyword in group by clause in BQL.
	ItemGroup
	// ItemBy represents the by keyword in group by clause in BQL.
	ItemBy
	// ItemOrder represent the order keyword in group by clause in BQL.
	ItemOrder
	// ItemHaving represents the having clause keyword clause in BQL.
	ItemHaving
	// ItemAsc represents asc keywork on order by clause in BQL.
	ItemAsc
	// ItemDesc represents desc keywork on order by clause in BQL
	ItemDesc
	// ItemLimit represetnts the limit clause in BQL.
	ItemLimit

	// ItemBinding respresents a variable binding in BQL.
	ItemBinding

	// ItemNode respresents a BadWolf node in BQL.
	ItemNode
	// ItemLiteral represents a BadWolf literal in BQL.
	ItemLiteral
	// ItemPredicate represents a BadWolf predicates in BQL.
	ItemPredicate
	// ItemPredicateBound represents a BadWolf predicate bound in BQL.
	ItemPredicateBound

	// ItemLBracket representes the left opening bracket token in BQL.
	ItemLBracket
	// ItemRBracket representes the right opening bracket token in BQL.
	ItemRBracket
	// ItemLPar representes the left opening parentesis token in BQL.
	ItemLPar
	// ItemRPar representes the right closing parentesis token in BQL.
	ItemRPar
	// ItemDot represents the graph clause separator . in BQL.
	ItemDot
	// ItemSemicolon represents the final statement semicolon in BQL.
	ItemSemicolon
	// ItemComma respresnts the graph join operator in BQL.
	ItemComma
	// ItemLT represents < in BQL.
	ItemLT
	// ItemGT represents > in BQL.
	ItemGT
	// ItemEQ represents = in BQL.
	ItemEQ
	// ItemNot represents keyword not in BQL.
	ItemNot
	// ItemAnd represents keyword and in BQL.
	ItemAnd
	// ItemOr represents keyword or in BQL.
	ItemOr
)

func (TokenType) String

func (tt TokenType) String() string

Jump to

Keyboard shortcuts

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