Documentation
¶
Index ¶
- func IsRegexOp(t Token) bool
- 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.RuneReader) (string, error)
- func Tokstr(tok Token, lit string) string
- type BufScanner
- type Pos
- type Scanner
- type Token
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.RuneReader) (string, error)
ScanString reads a quoted string from a rune reader.
Types ¶
type BufScanner ¶
type BufScanner struct {
// contains filtered or unexported fields
}
BufScanner represents a wrapper for scanner to add a buffer. It provides a fixed-length circular buffer that can be unread.
func NewBufScanner ¶
func NewBufScanner(r io.Reader) *BufScanner
NewBufScanner returns a new buffered scanner for a reader.
func (*BufScanner) Scan ¶
func (s *BufScanner) Scan() TokenInfo
Scan reads the next token from the scanner.
func (*BufScanner) ScanRegex ¶
func (s *BufScanner) ScanRegex() TokenInfo
ScanRegex reads a regex token from the scanner.
func (*BufScanner) Unscan ¶
func (s *BufScanner) Unscan()
Unscan pushes the previously token back onto the buffer.
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 Genji.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
type Token ¶
type Token int
Token is a lexical token of the Genji SQL language.
const ( // ILLEGAL Token, EOF, WS are Special Genji SQL tokens. ILLEGAL Token = iota EOF WS COMMENT // IDENT and the following are Genji SQL literal tokens. IDENT // main NAMEDPARAM // $param POSITIONALPARAM // ? NUMBER // 12345.67 INTEGER // 12345 DURATION // 13h STRING // "abc" BADSTRING // "abc BADESCAPE // \q TRUE // true FALSE // false NULL // NULL REGEX // Regular expressions BADREGEX // `.* // ADD and the following are Genji SQL Operators ADD // + SUB // - MUL // * DIV // / MOD // % BITWISEAND // & BITWISEOR // | BITWISEXOR // ^ AND // AND OR // OR EQ // = NEQ // != EQREGEX // =~ NEQREGEX // !~ LT // < LTE // <= GT // > GTE // >= IN // IN IS // IS LPAREN // ( RPAREN // ) LBRACKET // { RBRACKET // } LSBRACKET // [ RSBRACKET // ] COMMA // , COLON // : DOUBLECOLON // :: SEMICOLON // ; DOT // . // ALL and the following are Genji SQL Keywords AS ASC BY CAST CREATE DELETE DESC DROP EXISTS EXPLAIN FROM IF INDEX INSERT INTO KEY LIMIT NOT OFFSET ON ORDER PRIMARY SELECT SET TABLE TO UNIQUE UNSET UPDATE VALUES WHERE TYPEARRAY TYPEBLOB TYPEBOOL TYPEBYTES TYPEDOCUMENT TYPEDURATION TYPEFLOAT64 TYPEINT TYPEINT8 TYPEINT16 TYPEINT32 TYPEINT64 TYPESTRING TYPEINTEGER // alias to TYPEINT TYPENUMERIC // alias to TYPEFLOAT64 TYPETEXT // alias to TYPESTRING )
These are a comprehensive list of Genji SQL language tokens.
func (Token) IsOperator ¶
IsOperator returns true for operator tokens.
func (Token) Precedence ¶
Precedence returns the operator precedence of the binary operator token.