Documentation ¶
Index ¶
- Constants
- Variables
- func InitLog(logger logger.Logger)
- func ParsePipeline(name, input string) (res ast.Stmts, err error)
- func Unquote(s string) (t string, err error)
- func UnquoteMultiline(s string) (t string, err error)
- type Item
- type ItemType
- type Lexer
- type ParseError
- type ParseErrors
- type PositionRange
Constants ¶
View Source
const ( Digits = "0123456789" HexDigits = "0123456789abcdefABCDEF" )
View Source
const ADD = 57379
View Source
const ADD_EQ = 57392
View Source
const AND = 57402
View Source
const BOOL = 57375
View Source
const BREAK = 57367
View Source
const COLON = 57371
View Source
const COMMA = 57347
View Source
const COMMENT = 57348
View Source
const CONTINUE = 57368
View Source
const DIV = 57380
View Source
const DIV_EQ = 57394
View Source
const DOT = 57349
View Source
const ELIF = 57407
View Source
const ELSE = 57408
View Source
const EOF = 57350
View Source
const EOL = 57370
View Source
const EQ = 57389
View Source
const EQEQ = 57390
View Source
const ERROR = 57351
View Source
const FALSE = 57400
View Source
const FLOAT = 57374
View Source
const FOR = 57364
View Source
const GT = 57382
View Source
const GTE = 57381
View Source
const ID = 57352
View Source
const IDENTIFIER = 57401
View Source
const IF = 57406
View Source
const IN = 57365
View Source
const INT = 57373
View Source
const LEFT_BRACE = 57356
View Source
const LEFT_BRACKET = 57355
View Source
const LEFT_PAREN = 57354
View Source
const LIST = 57376
View Source
const LT = 57384
View Source
const LTE = 57385
View Source
const MAP = 57377
View Source
const MOD = 57386
View Source
const MOD_EQ = 57396
View Source
const MUL = 57387
View Source
const MULTILINE_STRING = 57363
View Source
const MUL_EQ = 57395
View Source
const NEQ = 57388
View Source
const NIL = 57404
View Source
const NOT = 57383
View Source
const NULL = 57405
View Source
const NUMBER = 57353
View Source
const OR = 57403
View Source
const QUOTED_STRING = 57362
View Source
const RETURN = 57369
View Source
const RIGHT_BRACE = 57357
View Source
const RIGHT_BRACKET = 57359
View Source
const RIGHT_PAREN = 57358
View Source
const SEMICOLON = 57346
View Source
const SPACE = 57360
View Source
const START_STMTS = 57411
View Source
const STR = 57372
View Source
const STRING = 57361
View Source
const SUB = 57391
View Source
const SUB_EQ = 57393
View Source
const TRUE = 57399
View Source
const UMINUS = 57413
View Source
const WHILE = 57366
Variables ¶
View Source
var ( ItemTypeStr = map[ItemType]string{ LEFT_PAREN: "(", RIGHT_PAREN: ")", LEFT_BRACKET: "[", RIGHT_BRACKET: "]", LEFT_BRACE: "{", RIGHT_BRACE: "}", COMMA: ",", EQ: "=", ADD_EQ: "+=", SUB_EQ: "-=", MUL_EQ: "*=", DIV_EQ: "/=", MOD_EQ: "%=", SEMICOLON: ";", DOT: ".", SPACE: "<space>", COLON: ":", EQEQ: "==", NEQ: "!=", LTE: "<=", LT: "<", GTE: ">=", GT: ">", NOT: "!", SUB: "-", ADD: "+", MUL: "*", MOD: "%", DIV: "/", AND: "&&", OR: "||", } AstOp = func(op ItemType) ast.Op { return ast.Op(ItemTypeStr[op]) } )
View Source
var ErrSyntax = errors.New("invalid syntax")
ErrSyntax indicates that a value does not have the right syntax for the target type.
Functions ¶
func Unquote ¶
Unquote interprets s as a single-quoted, double-quoted, or backquoted Prometheus query language string literal, returning the string value that s quotes.
NOTE: This function as well as the necessary helper functions below (unquoteChar, contains, unhex) and associated tests have been adapted from the corresponding functions in the "strconv" package of the Go standard library to work for Prometheus-style strings. Go's special-casing for single quotes was removed and single quoted strings are now treated the same as double quoted ones.
func UnquoteMultiline ¶
Types ¶
type Item ¶
func (*Item) PositionRange ¶
func (i *Item) PositionRange() *PositionRange
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer holds the state of the scanner.
type ParseError ¶
type ParseError struct { Pos *PositionRange Err error Query string }
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type ParseErrors ¶
type ParseErrors []ParseError
type PositionRange ¶
func (PositionRange) String ¶
func (pos PositionRange) String() string
Click to show internal directories.
Click to hide internal directories.