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.
func (*Scanner) ReadRune ¶
ReadRune reads a single UTF-8 encoded Unicode character. It returns io.EOF error if it can't read any more.
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 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 LIKE // LIKE LPAREN // ( RPAREN // ) LBRACKET // { RBRACKET // } LSBRACKET // [ RSBRACKET // ] COMMA // , COLON // : DOUBLECOLON // :: SEMICOLON // ; DOT // . // ALL and the following are Genji SQL Keywords ADD_KEYWORD ALTER AS ASC BEGIN BY CAST COMMIT CREATE DEFAULT DELETE DESC DISTINCT DROP EXISTS EXPLAIN FIELD FROM GROUP IF INDEX INSERT INTO KEY LIMIT NOT OFFSET ON ONLY ORDER PRECISION PRIMARY READ REINDEX RENAME ROLLBACK SELECT SET TABLE TO TRANSACTION UNIQUE UNSET UPDATE VALUES WHERE WRITE // Aliases TYPEARRAY TYPEBIGINT TYPEBLOB TYPEBOOL TYPEBYTES TYPECHARACTER TYPEDOCUMENT TYPEDOUBLE TYPEINT TYPEINT2 TYPEINT8 TYPEINTEGER TYPEMEDIUMINT TYPESMALLINT TYPETEXT TYPETINYINT TYPEREAL TYPEVARCHAR )
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.