Documentation ¶
Index ¶
- Constants
- Variables
- func FindFunctionCalls(nodes ...Node) []string
- func FindReferenceVariables(nodes ...Node) []string
- func Format(n Node) string
- func IsCompOperator(typ TokenType) bool
- func IsExprOperator(typ TokenType) bool
- func IsLogicalOperator(typ TokenType) bool
- func IsMathOperator(typ TokenType) bool
- func ZeroValue(t ValueType) interface{}
- type BinaryNode
- func (p BinaryNode) Char() int
- func (n *BinaryNode) Equal(o interface{}) bool
- func (n *BinaryNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p BinaryNode) Line() int
- func (n *BinaryNode) MarshalJSON() ([]byte, error)
- func (p BinaryNode) Position() int
- func (n *BinaryNode) SetComment(c *CommentNode)
- func (n *BinaryNode) String() string
- func (n *BinaryNode) UnmarshalJSON(data []byte) error
- type BoolNode
- func (p BoolNode) Char() int
- func (n *BoolNode) Equal(o interface{}) bool
- func (n *BoolNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p BoolNode) Line() int
- func (n *BoolNode) MarshalJSON() ([]byte, error)
- func (p BoolNode) Position() int
- func (n *BoolNode) SetComment(c *CommentNode)
- func (n *BoolNode) String() string
- func (n *BoolNode) UnmarshalJSON(data []byte) error
- type ChainNode
- func (p ChainNode) Char() int
- func (n *ChainNode) Equal(o interface{}) bool
- func (n *ChainNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p ChainNode) Line() int
- func (n *ChainNode) MarshalJSON() ([]byte, error)
- func (p ChainNode) Position() int
- func (n *ChainNode) SetComment(c *CommentNode)
- func (n *ChainNode) String() string
- func (n *ChainNode) TypeOf() string
- func (n *ChainNode) UnmarshalJSON(data []byte) error
- type CommentNode
- func (p CommentNode) Char() int
- func (n *CommentNode) CommentString() string
- func (n *CommentNode) Equal(o interface{}) bool
- func (n *CommentNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p CommentNode) Line() int
- func (n *CommentNode) MarshalJSON() ([]byte, error)
- func (p CommentNode) Position() int
- func (n *CommentNode) String() string
- func (n *CommentNode) UnmarshalJSON(data []byte) error
- type DBRPNode
- func (p DBRPNode) Char() int
- func (d *DBRPNode) DBRP() string
- func (d *DBRPNode) Equal(o interface{}) bool
- func (s *DBRPNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p DBRPNode) Line() int
- func (d *DBRPNode) MarshalJSON() ([]byte, error)
- func (p DBRPNode) Position() int
- func (n *DBRPNode) String() string
- func (d *DBRPNode) UnmarshalJSON(data []byte) error
- type DeclarationNode
- func (p DeclarationNode) Char() int
- func (n *DeclarationNode) Equal(o interface{}) bool
- func (n *DeclarationNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p DeclarationNode) Line() int
- func (n *DeclarationNode) MarshalJSON() ([]byte, error)
- func (p DeclarationNode) Position() int
- func (n *DeclarationNode) SetComment(c *CommentNode)
- func (n *DeclarationNode) String() string
- func (n *DeclarationNode) UnmarshalJSON(data []byte) error
- type DurationNode
- func (p DurationNode) Char() int
- func (n *DurationNode) Equal(o interface{}) bool
- func (n *DurationNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p DurationNode) Line() int
- func (n *DurationNode) MarshalJSON() ([]byte, error)
- func (p DurationNode) Position() int
- func (n *DurationNode) SetComment(c *CommentNode)
- func (n *DurationNode) String() string
- func (n *DurationNode) UnmarshalJSON(data []byte) error
- type FuncType
- type FunctionNode
- func (p FunctionNode) Char() int
- func (n *FunctionNode) Equal(o interface{}) bool
- func (n *FunctionNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p FunctionNode) Line() int
- func (n *FunctionNode) MarshalJSON() ([]byte, error)
- func (p FunctionNode) Position() int
- func (n *FunctionNode) SetComment(c *CommentNode)
- func (n *FunctionNode) String() string
- func (n *FunctionNode) UnmarshalJSON(data []byte) error
- type IdentifierNode
- func (p IdentifierNode) Char() int
- func (n *IdentifierNode) Equal(o interface{}) bool
- func (n *IdentifierNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p IdentifierNode) Line() int
- func (n *IdentifierNode) MarshalJSON() ([]byte, error)
- func (p IdentifierNode) Position() int
- func (n *IdentifierNode) SetComment(c *CommentNode)
- func (n *IdentifierNode) String() string
- func (n *IdentifierNode) UnmarshalJSON(data []byte) error
- type JSONNode
- func (j JSONNode) Bool(field string) (bool, error)
- func (j JSONNode) CheckTypeOf(typ string) error
- func (j JSONNode) Duration(field string) (time.Duration, error)
- func (j JSONNode) Field(field string) (interface{}, error)
- func (j JSONNode) Float64(field string) (float64, error)
- func (j JSONNode) FunctionType(field string) (FuncType, error)
- func (j JSONNode) Has(field string) bool
- func (j JSONNode) IDNode(field string) (*IdentifierNode, error)
- func (j JSONNode) Int64(field string) (int64, error)
- func (j JSONNode) Node(field string) (Node, error)
- func (j JSONNode) NodeList(field string) ([]Node, error)
- func (j JSONNode) Operator(field string) (TokenType, error)
- func (j JSONNode) RefNode(field string) (*ReferenceNode, error)
- func (j JSONNode) Regex(field string) (*regexp.Regexp, error)
- func (j JSONNode) Set(key string, value interface{}) JSONNode
- func (j JSONNode) SetDuration(key string, value time.Duration) JSONNode
- func (j JSONNode) SetFunctionType(key string, fn FuncType) JSONNode
- func (j JSONNode) SetOperator(key string, op TokenType) JSONNode
- func (j JSONNode) SetRegex(key string, value *regexp.Regexp) JSONNode
- func (j JSONNode) String(field string) (string, error)
- func (j JSONNode) Strings(field string) ([]string, error)
- func (j JSONNode) Type(typ string) JSONNode
- func (j JSONNode) TypeOf() (string, error)
- type LambdaNode
- func (p LambdaNode) Char() int
- func (n *LambdaNode) Equal(o interface{}) bool
- func (n *LambdaNode) ExpressionString() string
- func (n *LambdaNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p LambdaNode) Line() int
- func (n *LambdaNode) MarshalJSON() ([]byte, error)
- func (p LambdaNode) Position() int
- func (n *LambdaNode) SetComment(c *CommentNode)
- func (n *LambdaNode) String() string
- func (n *LambdaNode) Unmarshal(props map[string]interface{}) error
- func (n *LambdaNode) UnmarshalJSON(data []byte) error
- type ListNode
- func (p ListNode) Char() int
- func (n *ListNode) Equal(o interface{}) bool
- func (n *ListNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p ListNode) Line() int
- func (n *ListNode) MarshalJSON() ([]byte, error)
- func (p ListNode) Position() int
- func (n *ListNode) SetComment(c *CommentNode)
- func (n *ListNode) String() string
- func (n *ListNode) UnmarshalJSON(data []byte) error
- type Missing
- type Node
- type NumberNode
- func (p NumberNode) Char() int
- func (n *NumberNode) Equal(o interface{}) bool
- func (n *NumberNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p NumberNode) Line() int
- func (n *NumberNode) MarshalJSON() ([]byte, error)
- func (p NumberNode) Position() int
- func (n *NumberNode) SetComment(c *CommentNode)
- func (n *NumberNode) String() string
- func (n *NumberNode) UnmarshalJSON(data []byte) error
- type Position
- type ProgramNode
- func (n *ProgramNode) Add(node Node)
- func (p ProgramNode) Char() int
- func (n *ProgramNode) Equal(o interface{}) bool
- func (n *ProgramNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p ProgramNode) Line() int
- func (n *ProgramNode) MarshalJSON() ([]byte, error)
- func (p ProgramNode) Position() int
- func (n *ProgramNode) String() string
- func (n *ProgramNode) UnmarshalJSON(data []byte) error
- type ReferenceNode
- func (p ReferenceNode) Char() int
- func (n *ReferenceNode) Equal(o interface{}) bool
- func (n *ReferenceNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p ReferenceNode) Line() int
- func (n *ReferenceNode) MarshalJSON() ([]byte, error)
- func (p ReferenceNode) Position() int
- func (n *ReferenceNode) SetComment(c *CommentNode)
- func (n *ReferenceNode) String() string
- func (n *ReferenceNode) UnmarshalJSON(data []byte) error
- type RegexNode
- func (p RegexNode) Char() int
- func (n *RegexNode) Equal(o interface{}) bool
- func (n *RegexNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p RegexNode) Line() int
- func (n *RegexNode) MarshalJSON() ([]byte, error)
- func (p RegexNode) Position() int
- func (n *RegexNode) SetComment(c *CommentNode)
- func (n *RegexNode) String() string
- func (n *RegexNode) UnmarshalJSON(data []byte) error
- type StarNode
- func (p StarNode) Char() int
- func (n *StarNode) Equal(o interface{}) bool
- func (n *StarNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p StarNode) Line() int
- func (n *StarNode) MarshalJSON() ([]byte, error)
- func (p StarNode) Position() int
- func (n *StarNode) SetComment(c *CommentNode)
- func (n *StarNode) String() string
- func (n *StarNode) UnmarshalJSON(data []byte) error
- type StringNode
- func (p StringNode) Char() int
- func (n *StringNode) Equal(o interface{}) bool
- func (n *StringNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p StringNode) Line() int
- func (n *StringNode) MarshalJSON() ([]byte, error)
- func (p StringNode) Position() int
- func (n *StringNode) SetComment(c *CommentNode)
- func (n *StringNode) String() string
- func (n *StringNode) UnmarshalJSON(data []byte) error
- type TokenType
- type TypeDeclarationNode
- func (p TypeDeclarationNode) Char() int
- func (n *TypeDeclarationNode) Equal(o interface{}) bool
- func (n *TypeDeclarationNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p TypeDeclarationNode) Line() int
- func (n *TypeDeclarationNode) MarshalJSON() ([]byte, error)
- func (p TypeDeclarationNode) Position() int
- func (n *TypeDeclarationNode) SetComment(c *CommentNode)
- func (n *TypeDeclarationNode) String() string
- func (n *TypeDeclarationNode) UnmarshalJSON(data []byte) error
- type UnaryNode
- func (p UnaryNode) Char() int
- func (n *UnaryNode) Equal(o interface{}) bool
- func (n *UnaryNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
- func (p UnaryNode) Line() int
- func (n *UnaryNode) MarshalJSON() ([]byte, error)
- func (p UnaryNode) Position() int
- func (n *UnaryNode) SetComment(c *CommentNode)
- func (n *UnaryNode) String() string
- func (n *UnaryNode) UnmarshalJSON(data []byte) error
- type ValueType
Constants ¶
const ( KW_And = "AND" KW_Or = "OR" KW_True = "TRUE" KW_False = "FALSE" KW_Var = "var" KW_DBRP = "dbrp" KW_Lambda = "lambda" )
const NodeTypeOf = "typeOf"
NodeTypeOf is used by all Node to identify the node duration Marshal and Unmarshal
Variables ¶
var MissingValue = &Missing{}
Functions ¶
func FindFunctionCalls ¶ added in v1.3.0
FindFunctionCalls walks all nodes and returns a list of name of function calls.
func FindReferenceVariables ¶ added in v1.3.0
FindReferenceVariables walks all nodes and returns a list of name from reference variables.
func IsCompOperator ¶
True if token type is an operator used in comparisons.
func IsExprOperator ¶
True if token type is an operator used in mathematical or boolean expressions.
func IsLogicalOperator ¶
func IsMathOperator ¶
True if token type is an operator used in mathematical expressions.
Types ¶
type BinaryNode ¶
type BinaryNode struct { Left Node Right Node Operator TokenType Comment *CommentNode Parens bool MultiLine bool // contains filtered or unexported fields }
binaryNode holds two arguments and an operator.
func (*BinaryNode) Equal ¶
func (n *BinaryNode) Equal(o interface{}) bool
func (*BinaryNode) Format ¶
func (n *BinaryNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*BinaryNode) MarshalJSON ¶ added in v1.4.0
func (n *BinaryNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*BinaryNode) SetComment ¶
func (n *BinaryNode) SetComment(c *CommentNode)
func (*BinaryNode) String ¶
func (n *BinaryNode) String() string
func (*BinaryNode) UnmarshalJSON ¶ added in v1.4.0
func (n *BinaryNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a BinaryNode
type BoolNode ¶
type BoolNode struct { Bool bool Comment *CommentNode // contains filtered or unexported fields }
boolNode holds one argument and an operator.
func (*BoolNode) MarshalJSON ¶ added in v1.4.0
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*BoolNode) SetComment ¶
func (n *BoolNode) SetComment(c *CommentNode)
func (*BoolNode) UnmarshalJSON ¶ added in v1.4.0
UnmarshalJSON converts JSON bytes to a BoolNode
type ChainNode ¶
type ChainNode struct { Left Node Right Node Operator TokenType Comment *CommentNode // contains filtered or unexported fields }
func (*ChainNode) MarshalJSON ¶ added in v1.4.0
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*ChainNode) SetComment ¶
func (n *ChainNode) SetComment(c *CommentNode)
func (*ChainNode) UnmarshalJSON ¶ added in v1.4.0
UnmarshalJSON converts JSON bytes to a ChainNode
type CommentNode ¶
type CommentNode struct { Comments []string // contains filtered or unexported fields }
Hold the contents of a comment
func (*CommentNode) CommentString ¶
func (n *CommentNode) CommentString() string
func (*CommentNode) Equal ¶
func (n *CommentNode) Equal(o interface{}) bool
func (*CommentNode) Format ¶
func (n *CommentNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*CommentNode) MarshalJSON ¶ added in v1.4.0
func (n *CommentNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*CommentNode) String ¶
func (n *CommentNode) String() string
func (*CommentNode) UnmarshalJSON ¶ added in v1.4.0
func (n *CommentNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a CommentNode
type DBRPNode ¶ added in v1.4.0
type DBRPNode struct { Comment *CommentNode DB *ReferenceNode RP *ReferenceNode // contains filtered or unexported fields }
func (*DBRPNode) MarshalJSON ¶ added in v1.4.0
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*DBRPNode) UnmarshalJSON ¶ added in v1.4.0
UnmarshalJSON converts JSON bytes to a DBRPNode
type DeclarationNode ¶
type DeclarationNode struct { Left *IdentifierNode Right Node Comment *CommentNode // contains filtered or unexported fields }
func (*DeclarationNode) Equal ¶
func (n *DeclarationNode) Equal(o interface{}) bool
func (*DeclarationNode) Format ¶
func (n *DeclarationNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*DeclarationNode) MarshalJSON ¶ added in v1.4.0
func (n *DeclarationNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*DeclarationNode) SetComment ¶
func (n *DeclarationNode) SetComment(c *CommentNode)
func (*DeclarationNode) String ¶
func (n *DeclarationNode) String() string
func (*DeclarationNode) UnmarshalJSON ¶ added in v1.4.0
func (n *DeclarationNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a DeclarationNode
type DurationNode ¶
type DurationNode struct { Dur time.Duration //the duration Literal string Comment *CommentNode // contains filtered or unexported fields }
durationNode holds a number: signed or unsigned integer or float. The value is parsed and stored under all the types that can represent the value. This simulates in a small amount of code the behavior of Go's ideal constants.
func (*DurationNode) Equal ¶
func (n *DurationNode) Equal(o interface{}) bool
func (*DurationNode) Format ¶
func (n *DurationNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*DurationNode) MarshalJSON ¶ added in v1.4.0
func (n *DurationNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*DurationNode) SetComment ¶
func (n *DurationNode) SetComment(c *CommentNode)
func (*DurationNode) String ¶
func (n *DurationNode) String() string
func (*DurationNode) UnmarshalJSON ¶ added in v1.4.0
func (n *DurationNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a DurationNode.
type FunctionNode ¶
type FunctionNode struct { Type FuncType Func string // The identifier Args []Node Comment *CommentNode MultiLine bool // contains filtered or unexported fields }
Holds the a function call with its args
func (*FunctionNode) Equal ¶
func (n *FunctionNode) Equal(o interface{}) bool
func (*FunctionNode) Format ¶
func (n *FunctionNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*FunctionNode) MarshalJSON ¶ added in v1.4.0
func (n *FunctionNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*FunctionNode) SetComment ¶
func (n *FunctionNode) SetComment(c *CommentNode)
func (*FunctionNode) String ¶
func (n *FunctionNode) String() string
func (*FunctionNode) UnmarshalJSON ¶ added in v1.4.0
func (n *FunctionNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a FunctionNode
type IdentifierNode ¶
type IdentifierNode struct { Ident string // The identifier Comment *CommentNode // contains filtered or unexported fields }
Holds the textual representation of an identifier
func (*IdentifierNode) Equal ¶
func (n *IdentifierNode) Equal(o interface{}) bool
func (*IdentifierNode) Format ¶
func (n *IdentifierNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*IdentifierNode) MarshalJSON ¶ added in v1.4.0
func (n *IdentifierNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*IdentifierNode) SetComment ¶
func (n *IdentifierNode) SetComment(c *CommentNode)
func (*IdentifierNode) String ¶
func (n *IdentifierNode) String() string
func (*IdentifierNode) UnmarshalJSON ¶ added in v1.4.0
func (n *IdentifierNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a IdentifierNode
type JSONNode ¶ added in v1.4.0
type JSONNode map[string]interface{}
JSONNode is the intermediate type between Node and JSON serialization
func (JSONNode) CheckTypeOf ¶ added in v1.4.0
CheckTypeOf tests that the typeOf field is correctly set to typ.
func (JSONNode) Duration ¶ added in v1.4.0
Duration reads the field and assumes the string is in InfluxQL Duration format.
func (JSONNode) Field ¶ added in v1.4.0
Field returns expected field or error if field doesn't exist
func (JSONNode) FunctionType ¶ added in v1.4.0
FunctionType reads the field for an FuncType value
func (JSONNode) IDNode ¶ added in v1.4.0
func (j JSONNode) IDNode(field string) (*IdentifierNode, error)
IDNode reads an IdentifierNode from the field
func (JSONNode) RefNode ¶ added in v1.4.0
func (j JSONNode) RefNode(field string) (*ReferenceNode, error)
RefNode reads a ReferenceNode from the field
func (JSONNode) Regex ¶ added in v1.4.0
Regex reads the field and assumes the string is a regular expression.
func (JSONNode) SetDuration ¶ added in v1.4.0
SetDuration adds key to the JSONNode but formats the duration in InfluxQL style
func (JSONNode) SetFunctionType ¶ added in v1.4.0
SetFunctionType adds key to JSONNode but formats the function type as a string
func (JSONNode) SetOperator ¶ added in v1.4.0
SetOperator adds key to JSONNode but formats the operator as a string
func (JSONNode) SetRegex ¶ added in v1.4.0
SetRegex adds key to the JSONNode but formats the regex as a string
type LambdaNode ¶
type LambdaNode struct { Expression Node Comment *CommentNode // contains filtered or unexported fields }
Represents the beginning of a lambda expression
func ParseLambda ¶
func ParseLambda(text string) (*LambdaNode, error)
Parse returns a LambdaNode, created by parsing a lambda expression.
func (*LambdaNode) Equal ¶
func (n *LambdaNode) Equal(o interface{}) bool
func (*LambdaNode) ExpressionString ¶
func (n *LambdaNode) ExpressionString() string
func (*LambdaNode) Format ¶
func (n *LambdaNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*LambdaNode) MarshalJSON ¶ added in v1.4.0
func (n *LambdaNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*LambdaNode) SetComment ¶
func (n *LambdaNode) SetComment(c *CommentNode)
func (*LambdaNode) String ¶
func (n *LambdaNode) String() string
func (*LambdaNode) Unmarshal ¶ added in v1.4.0
func (n *LambdaNode) Unmarshal(props map[string]interface{}) error
Unmarshal deserializes the props map into this LambdaNode
func (*LambdaNode) UnmarshalJSON ¶ added in v1.4.0
func (n *LambdaNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a LambdaNode
type ListNode ¶
type ListNode struct { Nodes []Node Comment *CommentNode // contains filtered or unexported fields }
Holds the list of other nodes
func (*ListNode) MarshalJSON ¶ added in v1.4.0
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*ListNode) SetComment ¶
func (n *ListNode) SetComment(c *CommentNode)
func (*ListNode) UnmarshalJSON ¶ added in v1.4.0
UnmarshalJSON converts JSON bytes to a ListNode
type Node ¶
type Node interface { Position String() string Format(buf *bytes.Buffer, indent string, onNewLine bool) // Report whether to nodes are functionally equal, ignoring position and comments Equal(interface{}) bool json.Marshaler json.Unmarshaler // contains filtered or unexported methods }
func Parse ¶
Parse returns a Node, created by parsing the DSL described in the argument string. If an error is encountered, parsing stops and a nil Node is returned with the error.
func ValueToLiteralNode ¶
Convert raw value to literal node, for all supported basic types.
type NumberNode ¶
type NumberNode struct { IsInt bool // Number has an integral value. IsFloat bool // Number has a floating-point value. Int64 int64 // The integer value. Float64 float64 // The floating-point value. Base int // The base of an integer value. Comment *CommentNode // contains filtered or unexported fields }
numberNode holds a number: signed or unsigned integer or float. The value is parsed and stored under all the types that can represent the value. This simulates in a small amount of code the behavior of Go's ideal constants.
func (*NumberNode) Equal ¶
func (n *NumberNode) Equal(o interface{}) bool
func (*NumberNode) Format ¶
func (n *NumberNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*NumberNode) MarshalJSON ¶ added in v1.4.0
func (n *NumberNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*NumberNode) SetComment ¶
func (n *NumberNode) SetComment(c *CommentNode)
func (*NumberNode) String ¶
func (n *NumberNode) String() string
func (*NumberNode) UnmarshalJSON ¶ added in v1.4.0
func (n *NumberNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a Number node.
type ProgramNode ¶
type ProgramNode struct { Nodes []Node // contains filtered or unexported fields }
Holds a function call with its args
func (*ProgramNode) Add ¶
func (n *ProgramNode) Add(node Node)
func (*ProgramNode) Equal ¶
func (n *ProgramNode) Equal(o interface{}) bool
func (*ProgramNode) Format ¶
func (n *ProgramNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*ProgramNode) MarshalJSON ¶ added in v1.4.0
func (n *ProgramNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*ProgramNode) String ¶
func (n *ProgramNode) String() string
func (*ProgramNode) UnmarshalJSON ¶ added in v1.4.0
func (n *ProgramNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a ProgramNode
type ReferenceNode ¶
type ReferenceNode struct { Reference string // The field reference Comment *CommentNode // contains filtered or unexported fields }
Holds the textual representation of an identifier
func (*ReferenceNode) Equal ¶
func (n *ReferenceNode) Equal(o interface{}) bool
func (*ReferenceNode) Format ¶
func (n *ReferenceNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*ReferenceNode) MarshalJSON ¶ added in v1.4.0
func (n *ReferenceNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*ReferenceNode) SetComment ¶
func (n *ReferenceNode) SetComment(c *CommentNode)
func (*ReferenceNode) String ¶
func (n *ReferenceNode) String() string
func (*ReferenceNode) UnmarshalJSON ¶ added in v1.4.0
func (n *ReferenceNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a ReferenceNode
type RegexNode ¶
type RegexNode struct { Regex *regexp.Regexp Literal string Comment *CommentNode // contains filtered or unexported fields }
Holds the textual representation of a regex literal
func (*RegexNode) MarshalJSON ¶ added in v1.4.0
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*RegexNode) SetComment ¶
func (n *RegexNode) SetComment(c *CommentNode)
func (*RegexNode) UnmarshalJSON ¶ added in v1.4.0
UnmarshalJSON converts JSON bytes to a RegexNode
type StarNode ¶
type StarNode struct { Comment *CommentNode // contains filtered or unexported fields }
Represents a standalone '*' token.
func (*StarNode) MarshalJSON ¶ added in v1.4.0
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*StarNode) SetComment ¶
func (n *StarNode) SetComment(c *CommentNode)
func (*StarNode) UnmarshalJSON ¶ added in v1.4.0
UnmarshalJSON converts JSON bytes to a StarNode
type StringNode ¶
type StringNode struct { Literal string // The string literal TripleQuotes bool Comment *CommentNode // contains filtered or unexported fields }
Holds the textual representation of a string literal
func (*StringNode) Equal ¶
func (n *StringNode) Equal(o interface{}) bool
func (*StringNode) Format ¶
func (n *StringNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*StringNode) MarshalJSON ¶ added in v1.4.0
func (n *StringNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*StringNode) SetComment ¶
func (n *StringNode) SetComment(c *CommentNode)
func (*StringNode) String ¶
func (n *StringNode) String() string
func (*StringNode) UnmarshalJSON ¶ added in v1.4.0
func (n *StringNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a StringNode
type TokenType ¶
type TokenType int
const ( TokenError TokenType = iota TokenEOF TokenVar TokenDBRP TokenAsgn TokenDot TokenPipe TokenAt TokenIdent TokenReference TokenLambda TokenNumber TokenString TokenDuration TokenLParen TokenRParen TokenLSBracket TokenRSBracket TokenComma TokenNot TokenTrue TokenFalse TokenRegex TokenComment TokenStar TokenPlus TokenMinus TokenMult TokenDiv TokenMod TokenAnd TokenOr TokenEqual TokenNotEqual TokenLess TokenGreater TokenLessEqual TokenGreaterEqual TokenRegexEqual TokenRegexNotEqual )
func NewTokenType ¶ added in v1.4.0
NewTokenType converts string to TokenType
type TypeDeclarationNode ¶
type TypeDeclarationNode struct { Node *IdentifierNode Type *IdentifierNode Comment *CommentNode // contains filtered or unexported fields }
func (*TypeDeclarationNode) Equal ¶
func (n *TypeDeclarationNode) Equal(o interface{}) bool
func (*TypeDeclarationNode) Format ¶
func (n *TypeDeclarationNode) Format(buf *bytes.Buffer, indent string, onNewLine bool)
func (*TypeDeclarationNode) MarshalJSON ¶ added in v1.4.0
func (n *TypeDeclarationNode) MarshalJSON() ([]byte, error)
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*TypeDeclarationNode) SetComment ¶
func (n *TypeDeclarationNode) SetComment(c *CommentNode)
func (*TypeDeclarationNode) String ¶
func (n *TypeDeclarationNode) String() string
func (*TypeDeclarationNode) UnmarshalJSON ¶ added in v1.4.0
func (n *TypeDeclarationNode) UnmarshalJSON(data []byte) error
UnmarshalJSON converts JSON bytes to a TypeDeclarationNode
type UnaryNode ¶
type UnaryNode struct { Node Node Operator TokenType Comment *CommentNode // contains filtered or unexported fields }
unaryNode holds one argument and an operator.
func (*UnaryNode) MarshalJSON ¶ added in v1.4.0
MarshalJSON converts the node to JSON with an additional typeOf field.
func (*UnaryNode) SetComment ¶
func (n *UnaryNode) SetComment(c *CommentNode)
func (*UnaryNode) UnmarshalJSON ¶ added in v1.4.0
UnmarshalJSON converts JSON bytes to a UnaryNode