Documentation ¶
Overview ¶
Package cst implements the Miller programming language. It is named for the concrete syntax tree data structure.
Index ¶
- Constants
- Variables
- func AnyHOF(input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, state *runtime.State) *mlrval.Mlrval
- func ApplyHOF(input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, state *runtime.State) *mlrval.Mlrval
- func BinaryShortCircuitPlaceholder(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval
- func ENVKeywordUsage()
- func EveryHOF(input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, state *runtime.State) *mlrval.Mlrval
- func FILENAMEKeywordUsage()
- func FILENUMKeywordUsage()
- func FNRKeywordUsage()
- func FoldHOF(input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, input3 *mlrval.Mlrval, ...) *mlrval.Mlrval
- func IFSKeywordUsage()
- func IPSKeywordUsage()
- func IRSKeywordUsage()
- func ListKeywordsAsParagraph()
- func ListKeywordsVertically()
- func M_EKeywordUsage()
- func M_PIKeywordUsage()
- func NFKeywordUsage()
- func NRKeywordUsage()
- func OFSKeywordUsage()
- func OPSKeywordUsage()
- func ORSKeywordUsage()
- func ReduceHOF(input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, state *runtime.State) *mlrval.Mlrval
- func SelectHOF(input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, state *runtime.State) *mlrval.Mlrval
- func SortHOF(inputs []*mlrval.Mlrval, state *runtime.State) *mlrval.Mlrval
- func TernaryShortCircuitPlaceholder(input1, input2, input3 *mlrval.Mlrval) *mlrval.Mlrval
- func TryUsageForKeyword(name string) bool
- func TryUsageForKeywordApproximate(searchString string) bool
- func UsageForKeyword(name string)
- func UsageKeywords()
- func ValidateAST(ast *dsl.AST, dslInstanceType DSLInstanceType) error
- func WarnOnAST(ast *dsl.AST) bool
- type ASTBuildVisitorFunc
- type AbsentCoalesceOperatorNode
- type ArrayLiteralNode
- type ArrayOrMapIndexAccessNode
- type ArrayOrMapPositionalNameAccessNode
- type ArrayOrMapPositionalValueAccessNode
- type ArraySliceAccessNode
- type AssignmentNode
- type BareBooleanStatementNode
- type BinaryFuncWithState
- type BinaryFunctionCallsiteNode
- type BinaryFunctionWithStateCallsiteNode
- type BlockExitPayload
- type BlockExitStatus
- type BoolLiteralNode
- type BreakNode
- type BuiltinFunctionInfo
- type BuiltinFunctionManager
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionClasses()
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionNamesAsParagraph()
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionNamesVertically()
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsage(functionName string)
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsageApproximate(text string) bool
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsages()
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsagesByClass()
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionsAsTable()
- func (manager *BuiltinFunctionManager) ListBuiltinFunctionsInClass(class string)
- func (manager *BuiltinFunctionManager) LookUp(functionName string) *BuiltinFunctionInfo
- func (manager *BuiltinFunctionManager) TryListBuiltinFunctionUsage(functionName string) bool
- func (manager *BuiltinFunctionManager) TryListBuiltinFunctionUsageApproximate(searchString string) bool
- type CondBlockNode
- type ContinueNode
- type DSLInstanceType
- type DirectFieldRvalueNode
- type DirectFieldValueLvalueNode
- func (node *DirectFieldValueLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *DirectFieldValueLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *DirectFieldValueLvalueNode) Unassign(state *runtime.State)
- func (node *DirectFieldValueLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type DirectOosvarRvalueNode
- type DirectOosvarValueLvalueNode
- func (node *DirectOosvarValueLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *DirectOosvarValueLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *DirectOosvarValueLvalueNode) Unassign(state *runtime.State)
- func (node *DirectOosvarValueLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type DoWhileLoopNode
- type DotCallsiteNode
- type DumpStatementNode
- type Emit1StatementNode
- type EmitFStatementNode
- type EmitXStatementNode
- type EmptyCoalesceOperatorNode
- type EnvironmentVariableLvalueNode
- func (node *EnvironmentVariableLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *EnvironmentVariableLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *EnvironmentVariableLvalueNode) Unassign(state *runtime.State)
- func (node *EnvironmentVariableLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type EnvironmentVariableNode
- type EvaluablePair
- type Executor
- type FILENAMENode
- type FILENUMNode
- type FLATSEPNode
- type FNRNode
- type FilterStatementNode
- type FloatLiteralNode
- type ForLoopMultivariableNode
- type ForLoopOneVariableNode
- type ForLoopTwoVariableNode
- type FullOosvarLvalueNode
- func (node *FullOosvarLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *FullOosvarLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *FullOosvarLvalueNode) Unassign(state *runtime.State)
- func (node *FullOosvarLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type FullOosvarRvalueNode
- type FullSrecLvalueNode
- func (node *FullSrecLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *FullSrecLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *FullSrecLvalueNode) Unassign(state *runtime.State)
- func (node *FullSrecLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type FullSrecRvalueNode
- type IAssignable
- type IEvaluable
- type IExecutable
- type IFSNode
- type IPSNode
- type IRSNode
- type IfChainNode
- type IfItem
- type IndexedLvalueNode
- func (node *IndexedLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *IndexedLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *IndexedLvalueNode) Unassign(state *runtime.State)
- func (node *IndexedLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type IndirectFieldValueLvalueNode
- func (node *IndirectFieldValueLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *IndirectFieldValueLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *IndirectFieldValueLvalueNode) Unassign(state *runtime.State)
- func (node *IndirectFieldValueLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type IndirectFieldValueNode
- type IndirectOosvarValueLvalueNode
- func (node *IndirectOosvarValueLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *IndirectOosvarValueLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *IndirectOosvarValueLvalueNode) Unassign(state *runtime.State)
- func (node *IndirectOosvarValueLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type IndirectOosvarValueNode
- type IntLiteralNode
- type LiteralEmptyStringNode
- type LiteralOneNode
- type LocalVariableLvalueNode
- func (node *LocalVariableLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *LocalVariableLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *LocalVariableLvalueNode) Unassign(state *runtime.State)
- func (node *LocalVariableLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type LocalVariableNode
- type LogicalANDOperatorNode
- type LogicalOROperatorNode
- type MapLiteralNode
- type MathENode
- type MathPINode
- type MlrvalLiteralNode
- type NFNode
- type NRNode
- type NodeBuilder
- type NullLiteralNode
- type OFSNode
- type OPSNode
- type ORSNode
- type PanicNode
- type PositionalFieldNameLvalueNode
- func (node *PositionalFieldNameLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *PositionalFieldNameLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *PositionalFieldNameLvalueNode) Unassign(state *runtime.State)
- func (node *PositionalFieldNameLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type PositionalFieldNameNode
- type PositionalFieldValueLvalueNode
- func (node *PositionalFieldValueLvalueNode) Assign(rvalue *mlrval.Mlrval, state *runtime.State) error
- func (node *PositionalFieldValueLvalueNode) AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error
- func (node *PositionalFieldValueLvalueNode) Unassign(state *runtime.State)
- func (node *PositionalFieldValueLvalueNode) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State)
- type PositionalFieldValueNode
- type PrintStatementNode
- type RegexCaptureBinaryFunctionCallsiteNode
- type RegexCaptureReplacementNode
- type RegexLiteralNode
- type ReturnNode
- type RootNode
- func (root *RootNode) Build(dslStrings []string, dslInstanceType DSLInstanceType, isReplImmediate bool, ...) (hadWarnings bool, err error)
- func (root *RootNode) BuildAndInstallUDF(astNode *dsl.ASTNode) error
- func (root *RootNode) BuildAndInstallUDS(astNode *dsl.ASTNode) error
- func (node *RootNode) BuildArrayLiteralNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (node *RootNode) BuildArrayOrMapIndexAccessNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (node *RootNode) BuildArrayOrMapPositionalNameAccessNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (node *RootNode) BuildArrayOrMapPositionalValueAccessNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (node *RootNode) BuildArraySliceAccessNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildArraySliceEmptyLowerIndexNode(astNode *dsl.ASTNode) (*LiteralOneNode, error)
- func (root *RootNode) BuildArraySliceEmptyUpperIndexNode(astNode *dsl.ASTNode) (*LiteralEmptyStringNode, error)
- func (root *RootNode) BuildAssignableNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildAssignmentNode(astNode *dsl.ASTNode) (*AssignmentNode, error)
- func (root *RootNode) BuildBareBooleanStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildBinaryFunctionCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildBinaryFunctionWithStateCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildBoolLiteralNode(literal string) *BoolLiteralNode
- func (root *RootNode) BuildBreakNode(astNode *dsl.ASTNode) (*BreakNode, error)
- func (root *RootNode) BuildBuiltinFunctionCallsiteNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildCondBlockNode(astNode *dsl.ASTNode) (*CondBlockNode, error)
- func (root *RootNode) BuildConstantNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildContextVariableNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildContinueNode(astNode *dsl.ASTNode) (*ContinueNode, error)
- func (root *RootNode) BuildDirectFieldRvalueNode(fieldName string) *DirectFieldRvalueNode
- func (root *RootNode) BuildDirectFieldValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildDirectOosvarRvalueNode(variableName string) *DirectOosvarRvalueNode
- func (root *RootNode) BuildDirectOosvarValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildDoWhileLoopNode(astNode *dsl.ASTNode) (*DoWhileLoopNode, error)
- func (root *RootNode) BuildDotCallsiteNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildDottedLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildDumpStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEdumpStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEmit1StatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEmitFStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEmitPStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEmitStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEnvironmentVariableLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildEnvironmentVariableNode(astNode *dsl.ASTNode) (*EnvironmentVariableNode, error)
- func (root *RootNode) BuildEprintStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEprintnStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildEvaluableNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildFILENAMENode() *FILENAMENode
- func (root *RootNode) BuildFILENUMNode() *FILENUMNode
- func (root *RootNode) BuildFLATSEPNode() *FLATSEPNode
- func (root *RootNode) BuildFNRNode() *FNRNode
- func (root *RootNode) BuildFilterStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildFloatLiteralNode(literal string) *FloatLiteralNode
- func (root *RootNode) BuildForLoopMultivariableNode(astNode *dsl.ASTNode) (*ForLoopMultivariableNode, error)
- func (root *RootNode) BuildForLoopOneVariableNode(astNode *dsl.ASTNode) (*ForLoopOneVariableNode, error)
- func (root *RootNode) BuildForLoopTwoVariableNode(astNode *dsl.ASTNode) (*ForLoopTwoVariableNode, error)
- func (root *RootNode) BuildFullOosvarLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildFullOosvarRvalueNode() *FullOosvarRvalueNode
- func (root *RootNode) BuildFullSrecLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildFullSrecRvalueNode() *FullSrecRvalueNode
- func (root *RootNode) BuildFunctionCallsiteNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildIFSNode() *IFSNode
- func (root *RootNode) BuildIPSNode() *IPSNode
- func (root *RootNode) BuildIRSNode() *IRSNode
- func (root *RootNode) BuildIfChainNode(astNode *dsl.ASTNode) (*IfChainNode, error)
- func (root *RootNode) BuildIndexedLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildIndirectFieldValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildIndirectFieldValueNode(astNode *dsl.ASTNode) (*IndirectFieldValueNode, error)
- func (root *RootNode) BuildIndirectOosvarValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildIndirectOosvarValueNode(astNode *dsl.ASTNode) (*IndirectOosvarValueNode, error)
- func (root *RootNode) BuildIntLiteralNode(literal string) *IntLiteralNode
- func (root *RootNode) BuildLeafNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildLocalVariableLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (root *RootNode) BuildLocalVariableNode(variableName string) *LocalVariableNode
- func (node *RootNode) BuildMapLiteralNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildMathENode() *MathENode
- func (root *RootNode) BuildMathPINode() *MathPINode
- func (root *RootNode) BuildMultipleArityFunctionCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildNFNode() *NFNode
- func (root *RootNode) BuildNRNode() *NRNode
- func (root *RootNode) BuildNullLiteralNode() *NullLiteralNode
- func (root *RootNode) BuildOFSNode() *OFSNode
- func (root *RootNode) BuildOPSNode() *OPSNode
- func (root *RootNode) BuildORSNode() *ORSNode
- func (root *RootNode) BuildPanicNode(astNode *dsl.ASTNode) (*PanicNode, error)
- func (root *RootNode) BuildPositionalFieldNameLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (node *RootNode) BuildPositionalFieldNameNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildPositionalFieldValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
- func (node *RootNode) BuildPositionalFieldValueNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildPrintStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildPrintnStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildRegexCaptureBinaryFunctionCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildRegexLiteralNode(literal string) IEvaluable
- func (root *RootNode) BuildReturnNode(astNode *dsl.ASTNode) (*ReturnNode, error)
- func (root *RootNode) BuildStatementBlockNode(astNode *dsl.ASTNode) (*StatementBlockNode, error)
- func (root *RootNode) BuildStatementBlockNodeFromBeginOrEnd(astBeginOrEndNode *dsl.ASTNode) (*StatementBlockNode, error)
- func (root *RootNode) BuildStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildStringLiteralNode(literal string) IEvaluable
- func (root *RootNode) BuildSubroutineCallsiteNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildTeeStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
- func (root *RootNode) BuildTernaryFunctionCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildTernaryFunctionWithStateCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildTripleForLoopNode(astNode *dsl.ASTNode) (*TripleForLoopNode, error)
- func (root *RootNode) BuildUDF(astNode *dsl.ASTNode, functionName string, isFunctionLiteral bool) (*UDF, error)
- func (root *RootNode) BuildUnaryFunctionCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildUnaryFunctionWithContextCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildUnnamedUDFNode(astNode *dsl.ASTNode) (IEvaluable, error)
- func (root *RootNode) BuildUnsetNode(astNode *dsl.ASTNode) (*UnsetNode, error)
- func (root *RootNode) BuildVariadicFunctionCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildVariadicFunctionWithStateCallsiteNode(astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo) (IEvaluable, error)
- func (root *RootNode) BuildWhileLoopNode(astNode *dsl.ASTNode) (*WhileLoopNode, error)
- func (root *RootNode) ExecuteBeginBlocks(state *runtime.State) error
- func (root *RootNode) ExecuteEndBlocks(state *runtime.State) error
- func (root *RootNode) ExecuteMainBlock(state *runtime.State) (outrec *mlrval.Mlrmap, err error)
- func (root *RootNode) ExecuteREPLImmediate(state *runtime.State) (outrec *mlrval.Mlrmap, err error)
- func (root *RootNode) IngestAST(ast *dsl.AST, isReplImmediate bool, doWarnings bool) (hadWarnings bool, err error)
- func (root *RootNode) ProcessEndOfStream()
- func (root *RootNode) RegisterOutputHandlerManager(outputHandlerManager output.OutputHandlerManager)
- func (root *RootNode) ResetBeginBlocksForREPL()
- func (root *RootNode) ResetEndBlocksForREPL()
- func (root *RootNode) ResetForREPL()
- func (root *RootNode) ResetMainBlockForREPL()
- func (root *RootNode) Resolve() error
- func (root *RootNode) ShowBlockReport()
- func (root *RootNode) WithRedefinableUDFUDS() *RootNode
- func (root *RootNode) WithStrictMode(strictMode bool) *RootNode
- type Signature
- type StandardTernaryOperatorNode
- type StatementBlockNode
- type StringLiteralNode
- type TFunctionClass
- type TeeStatementNode
- type TernaryFuncWithState
- type TernaryFunctionCallsiteNode
- type TernaryFunctionWithStateCallsiteNode
- type TripleForLoopNode
- type UDF
- type UDFCallsite
- type UDFManager
- type UDS
- type UDSCallsite
- type UDSManager
- type UnaryFunctionCallsiteNode
- type UnaryFunctionWithContextCallsiteNode
- type UnnamedUDFNode
- type UnsetNode
- type VariadicFuncWithState
- type VariadicFunctionCallsiteNode
- type VariadicFunctionWithStateCallsiteNode
- type WhileLoopNode
- type ZaryFunctionCallsiteNode
Constants ¶
const ( DSLInstanceTypePut = iota DSLInstanceTypeFilter DSLInstanceTypeREPL )
Variables ¶
var EMITX_NAMED_NODE_TYPES = map[dsl.TNodeType]bool{ dsl.NodeTypeLocalVariable: true, dsl.NodeTypeDirectOosvarValue: true, dsl.NodeTypeIndirectOosvarValue: true, dsl.NodeTypeDirectFieldValue: true, dsl.NodeTypeIndirectFieldValue: true, }
var EMITX_NAMELESS_NODE_TYPES = map[dsl.TNodeType]bool{ dsl.NodeTypeFullSrec: true, dsl.NodeTypeFullOosvar: true, dsl.NodeTypeMapLiteral: true, }
var KEYWORD_USAGE_TABLE = []tKeywordUsageEntry{ {"all", allKeywordUsage}, {"begin", beginKeywordUsage}, {"bool", boolKeywordUsage}, {"break", breakKeywordUsage}, {"call", callKeywordUsage}, {"continue", continueKeywordUsage}, {"do", doKeywordUsage}, {"dump", dumpKeywordUsage}, {"edump", edumpKeywordUsage}, {"elif", elifKeywordUsage}, {"else", elseKeywordUsage}, {"emit1", emit1KeywordUsage}, {"emit", emitKeywordUsage}, {"emitf", emitfKeywordUsage}, {"emitp", emitpKeywordUsage}, {"end", endKeywordUsage}, {"eprint", eprintKeywordUsage}, {"eprintn", eprintnKeywordUsage}, {"false", falseKeywordUsage}, {"filter", filterKeywordUsage}, {"float", floatKeywordUsage}, {"for", forKeywordUsage}, {"func", funcKeywordUsage}, {"funct", functKeywordUsage}, {"if", ifKeywordUsage}, {"in", inKeywordUsage}, {"int", intKeywordUsage}, {"map", mapKeywordUsage}, {"num", numKeywordUsage}, {"print", printKeywordUsage}, {"printn", printnKeywordUsage}, {"return", returnKeywordUsage}, {"stderr", stderrKeywordUsage}, {"stdout", stdoutKeywordUsage}, {"str", strKeywordUsage}, {"subr", subrKeywordUsage}, {"tee", teeKeywordUsage}, {"true", trueKeywordUsage}, {"unset", unsetKeywordUsage}, {"var", varKeywordUsage}, {"while", whileKeywordUsage}, {"ENV", ENVKeywordUsage}, {"FILENAME", FILENAMEKeywordUsage}, {"FILENUM", FILENUMKeywordUsage}, {"FNR", FNRKeywordUsage}, {"IFS", IFSKeywordUsage}, {"IPS", IPSKeywordUsage}, {"IRS", IRSKeywordUsage}, {"M_E", M_EKeywordUsage}, {"M_PI", M_PIKeywordUsage}, {"NF", NFKeywordUsage}, {"NR", NRKeywordUsage}, {"OFS", OFSKeywordUsage}, {"OPS", OPSKeywordUsage}, {"ORS", ORSKeywordUsage}, }
var VALID_LHS_NODE_TYPES = map[dsl.TNodeType]bool{ dsl.NodeTypeArrayOrMapIndexAccess: true, dsl.NodeTypeDotOperator: true, dsl.NodeTypeArrayOrMapPositionalNameAccess: true, dsl.NodeTypeArrayOrMapPositionalValueAccess: true, dsl.NodeTypeArraySliceAccess: true, dsl.NodeTypeDirectFieldValue: true, dsl.NodeTypeDirectOosvarValue: true, dsl.NodeTypeEnvironmentVariable: true, dsl.NodeTypeFullOosvar: true, dsl.NodeTypeFullSrec: true, dsl.NodeTypeIndirectFieldValue: true, dsl.NodeTypeIndirectOosvarValue: true, dsl.NodeTypeLocalVariable: true, dsl.NodeTypePositionalFieldName: true, dsl.NodeTypePositionalFieldValue: true, }
Functions ¶
func ENVKeywordUsage ¶
func ENVKeywordUsage()
func FILENAMEKeywordUsage ¶
func FILENAMEKeywordUsage()
func FILENUMKeywordUsage ¶
func FILENUMKeywordUsage()
func FNRKeywordUsage ¶
func FNRKeywordUsage()
func IFSKeywordUsage ¶
func IFSKeywordUsage()
func IPSKeywordUsage ¶
func IPSKeywordUsage()
func IRSKeywordUsage ¶
func IRSKeywordUsage()
func ListKeywordsAsParagraph ¶
func ListKeywordsAsParagraph()
----------------------------------------------------------------
func ListKeywordsVertically ¶
func ListKeywordsVertically()
----------------------------------------------------------------
func M_EKeywordUsage ¶
func M_EKeywordUsage()
func M_PIKeywordUsage ¶
func M_PIKeywordUsage()
func NFKeywordUsage ¶
func NFKeywordUsage()
func NRKeywordUsage ¶
func NRKeywordUsage()
func OFSKeywordUsage ¶
func OFSKeywordUsage()
func OPSKeywordUsage ¶
func OPSKeywordUsage()
func ORSKeywordUsage ¶
func ORSKeywordUsage()
func TryUsageForKeyword ¶
func UsageForKeyword ¶
func UsageForKeyword(name string)
func ValidateAST ¶
func ValidateAST( ast *dsl.AST, dslInstanceType DSLInstanceType, ) error
----------------------------------------------------------------
Types ¶
type ASTBuildVisitorFunc ¶
ASTBuildVisitorFunc is a callback, used by RootNode's Build method, which CST-builder callsites can use to visit parse-to-AST result of multi-string DSL inputs. Nominal use: mlr put -v, mlr put -d, etc.
type AbsentCoalesceOperatorNode ¶
type AbsentCoalesceOperatorNode struct {
// contains filtered or unexported fields
}
================================================================ a ?? b evaluates to b only when a is absent. Example: '$foo ?? 0' when the current record has no field $foo.
func BuildAbsentCoalesceOperatorNode ¶
func BuildAbsentCoalesceOperatorNode(a, b IEvaluable) *AbsentCoalesceOperatorNode
type ArrayLiteralNode ¶
type ArrayLiteralNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type ArrayOrMapIndexAccessNode ¶
type ArrayOrMapIndexAccessNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type ArrayOrMapPositionalNameAccessNode ¶
type ArrayOrMapPositionalNameAccessNode struct {
// contains filtered or unexported fields
}
================================================================ For x = [7,8,9], x[[2]] = 2 For y = {"a":7,"b":8,"c":9}, y[[2]] = "b"
type ArrayOrMapPositionalValueAccessNode ¶
type ArrayOrMapPositionalValueAccessNode struct {
// contains filtered or unexported fields
}
================================================================ For x = [7,8,9], x[[2]] = 8 For y = {"a":7,"b":8,"c":9}, y[[2]] = 8
type ArraySliceAccessNode ¶
type ArraySliceAccessNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type AssignmentNode ¶
type AssignmentNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewAssignmentNode ¶
func NewAssignmentNode( lvalueNode IAssignable, rvalueNode IEvaluable, ) *AssignmentNode
func (*AssignmentNode) Execute ¶
func (node *AssignmentNode) Execute( state *runtime.State, ) (*BlockExitPayload, error)
type BareBooleanStatementNode ¶
type BareBooleanStatementNode struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------- BareBooleanStatementNode is for implicit filter statements such as mlr filter 'NR < 10' -- "implicit" since the word "filter" doesn't appear within the single quotes as part of the DSL expression per se. Or (as noted above) mlr put 'NR < 10' is a no-op.
func (*BareBooleanStatementNode) Execute ¶
func (node *BareBooleanStatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type BinaryFuncWithState ¶
type BinaryFuncWithState func( input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, state *runtime.State, ) *mlrval.Mlrval
BinaryFuncWithState is for select, apply, and reduce.
type BinaryFunctionCallsiteNode ¶
type BinaryFunctionCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type BinaryFunctionWithStateCallsiteNode ¶
type BinaryFunctionWithStateCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type BlockExitPayload ¶
type BlockExitPayload struct {
// contains filtered or unexported fields
}
type BlockExitStatus ¶
type BlockExitStatus int
---------------------------------------------------------------- Things a block of statements can do: * execute all the way to the end without a return * break * continue * (throw an exception if the Miller DSL were to support that) * return void * return a value
const ( // BLOCK_EXIT_RUN_TO_END is implemented as *BlockExitPayload being nil BLOCK_EXIT_BREAK BlockExitStatus = 1 BLOCK_EXIT_CONTINUE BlockExitStatus = 2 BLOCK_EXIT_RETURN_VOID BlockExitStatus = 3 BLOCK_EXIT_RETURN_VALUE BlockExitStatus = 4 )
type BoolLiteralNode ¶
type BoolLiteralNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type BreakNode ¶
type BreakNode struct { }
----------------------------------------------------------------
type BuiltinFunctionInfo ¶
type BuiltinFunctionInfo struct {
// contains filtered or unexported fields
}
================================================================
func (*BuiltinFunctionInfo) JoinHelp ¶
func (info *BuiltinFunctionInfo) JoinHelp() string
JoinHelp must be used to format any function help-strings for output. for source-code storage, these have newlines in them. For any presentation to the user, they must be formatted using the JoinHelp() method which joins newlines. This is crucial for rendering of help-strings for manual page, webdocs, etc wherein we must let the user's resizing of the terminal window or browser determine -- at their choosing -- where lines wrap.
type BuiltinFunctionManager ¶
type BuiltinFunctionManager struct {
// contains filtered or unexported fields
}
================================================================
var BuiltinFunctionManagerInstance *BuiltinFunctionManager = NewBuiltinFunctionManager()
================================================================ This is a singleton so the online-help functions can query it for listings, online help, etc.
func NewBuiltinFunctionManager ¶
func NewBuiltinFunctionManager() *BuiltinFunctionManager
func (*BuiltinFunctionManager) ListBuiltinFunctionClasses ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionClasses()
func (*BuiltinFunctionManager) ListBuiltinFunctionNamesAsParagraph ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionNamesAsParagraph()
func (*BuiltinFunctionManager) ListBuiltinFunctionNamesVertically ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionNamesVertically()
func (*BuiltinFunctionManager) ListBuiltinFunctionUsage ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsage(functionName string)
func (*BuiltinFunctionManager) ListBuiltinFunctionUsageApproximate ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsageApproximate( text string, ) bool
func (*BuiltinFunctionManager) ListBuiltinFunctionUsages ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsages()
----------------------------------------------------------------
func (*BuiltinFunctionManager) ListBuiltinFunctionUsagesByClass ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionUsagesByClass()
func (*BuiltinFunctionManager) ListBuiltinFunctionsAsTable ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionsAsTable()
func (*BuiltinFunctionManager) ListBuiltinFunctionsInClass ¶
func (manager *BuiltinFunctionManager) ListBuiltinFunctionsInClass(class string)
func (*BuiltinFunctionManager) LookUp ¶
func (manager *BuiltinFunctionManager) LookUp(functionName string) *BuiltinFunctionInfo
func (*BuiltinFunctionManager) TryListBuiltinFunctionUsage ¶
func (manager *BuiltinFunctionManager) TryListBuiltinFunctionUsage( functionName string, ) bool
func (*BuiltinFunctionManager) TryListBuiltinFunctionUsageApproximate ¶
func (manager *BuiltinFunctionManager) TryListBuiltinFunctionUsageApproximate( searchString string, ) bool
type CondBlockNode ¶
type CondBlockNode struct {
// contains filtered or unexported fields
}
func (*CondBlockNode) Execute ¶
func (node *CondBlockNode) Execute( state *runtime.State, ) (*BlockExitPayload, error)
----------------------------------------------------------------
type ContinueNode ¶
type ContinueNode struct { }
----------------------------------------------------------------
func (*ContinueNode) Execute ¶
func (node *ContinueNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type DSLInstanceType ¶
type DSLInstanceType int
---------------------------------------------------------------- DSLInstanceType is for minor differences in DSL handling between mlr put, mlr filter, and mlr repl.
Namely, for "bare booleans" which are non-assignment statements like 'NR > 10' or 'true' or '$x =~ "(..)_(...)" or even '1+2'.
- For mlr put, bare booleans are no-ops; except side-effects (like regex-captures)
- For mlr filter, they set the filter condition only if they're the last statement in the main block.
- For mlr repl, similar to mlr filter: they are used to track the output to be printed for an expression entered at the REPL prompt.
type DirectFieldRvalueNode ¶
type DirectFieldRvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type DirectFieldValueLvalueNode ¶
type DirectFieldValueLvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewDirectFieldValueLvalueNode ¶
func NewDirectFieldValueLvalueNode(lhsFieldName *mlrval.Mlrval) *DirectFieldValueLvalueNode
func (*DirectFieldValueLvalueNode) AssignIndexed ¶
func (*DirectFieldValueLvalueNode) Unassign ¶
func (node *DirectFieldValueLvalueNode) Unassign( state *runtime.State, )
func (*DirectFieldValueLvalueNode) UnassignIndexed ¶
func (node *DirectFieldValueLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type DirectOosvarRvalueNode ¶
type DirectOosvarRvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type DirectOosvarValueLvalueNode ¶
type DirectOosvarValueLvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewDirectOosvarValueLvalueNode ¶
func NewDirectOosvarValueLvalueNode(lhsOosvarName *mlrval.Mlrval) *DirectOosvarValueLvalueNode
func (*DirectOosvarValueLvalueNode) AssignIndexed ¶
func (*DirectOosvarValueLvalueNode) Unassign ¶
func (node *DirectOosvarValueLvalueNode) Unassign( state *runtime.State, )
func (*DirectOosvarValueLvalueNode) UnassignIndexed ¶
func (node *DirectOosvarValueLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type DoWhileLoopNode ¶
type DoWhileLoopNode struct {
// contains filtered or unexported fields
}
================================================================
func NewDoWhileLoopNode ¶
func NewDoWhileLoopNode( statementBlockNode *StatementBlockNode, conditionNode IEvaluable, conditionToken *token.Token, ) *DoWhileLoopNode
func (*DoWhileLoopNode) Execute ¶
func (node *DoWhileLoopNode) Execute(state *runtime.State) (*BlockExitPayload, error)
----------------------------------------------------------------
type DotCallsiteNode ¶
type DotCallsiteNode struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------- DotCallsiteNode special-cases the dot operator, which is: * string + string, with coercion to string if either side is int/float/bool/etc. * map attribute access, if the left-hand side is a map.
type DumpStatementNode ¶
type DumpStatementNode struct {
// contains filtered or unexported fields
}
func (*DumpStatementNode) Execute ¶
func (node *DumpStatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
----------------------------------------------------------------
type Emit1StatementNode ¶
type Emit1StatementNode struct {
// contains filtered or unexported fields
}
func (*Emit1StatementNode) Execute ¶
func (node *Emit1StatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type EmitFStatementNode ¶
type EmitFStatementNode struct {
// contains filtered or unexported fields
}
func (*EmitFStatementNode) Execute ¶
func (node *EmitFStatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type EmitXStatementNode ¶
type EmitXStatementNode struct {
// contains filtered or unexported fields
}
func (*EmitXStatementNode) Execute ¶
func (node *EmitXStatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
================================================================
type EmptyCoalesceOperatorNode ¶
type EmptyCoalesceOperatorNode struct {
// contains filtered or unexported fields
}
================================================================ a ?? b evaluates to b only when a is absent or empty. Example: '$foo ?? 0' when the current record has no field $foo, or when $foo is empty..
func BuildEmptyCoalesceOperatorNode ¶
func BuildEmptyCoalesceOperatorNode(a, b IEvaluable) *EmptyCoalesceOperatorNode
type EnvironmentVariableLvalueNode ¶
type EnvironmentVariableLvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewEnvironmentVariableLvalueNode ¶
func NewEnvironmentVariableLvalueNode( nameExpression IEvaluable, ) *EnvironmentVariableLvalueNode
func (*EnvironmentVariableLvalueNode) AssignIndexed ¶
func (*EnvironmentVariableLvalueNode) Unassign ¶
func (node *EnvironmentVariableLvalueNode) Unassign( state *runtime.State, )
func (*EnvironmentVariableLvalueNode) UnassignIndexed ¶
func (node *EnvironmentVariableLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type EnvironmentVariableNode ¶
type EnvironmentVariableNode struct {
// contains filtered or unexported fields
}
type EvaluablePair ¶
type EvaluablePair struct { Key IEvaluable Value IEvaluable }
func NewEvaluablePair ¶
func NewEvaluablePair(key IEvaluable, value IEvaluable) *EvaluablePair
type FILENAMENode ¶
type FILENAMENode struct { }
----------------------------------------------------------------
type FILENUMNode ¶
type FILENUMNode struct { }
----------------------------------------------------------------
type FLATSEPNode ¶
type FLATSEPNode struct { }
----------------------------------------------------------------
type FNRNode ¶
type FNRNode struct { }
----------------------------------------------------------------
type FilterStatementNode ¶
type FilterStatementNode struct {
// contains filtered or unexported fields
}
func (*FilterStatementNode) Execute ¶
func (node *FilterStatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type FloatLiteralNode ¶
type FloatLiteralNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type ForLoopMultivariableNode ¶
type ForLoopMultivariableNode struct {
// contains filtered or unexported fields
}
================================================================
func NewForLoopMultivariableNode ¶
func NewForLoopMultivariableNode( keyIndexVariables []*runtime.StackVariable, valueIndexVariable *runtime.StackVariable, indexableNode IEvaluable, statementBlockNode *StatementBlockNode, ) *ForLoopMultivariableNode
func (*ForLoopMultivariableNode) Execute ¶
func (node *ForLoopMultivariableNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type ForLoopOneVariableNode ¶
type ForLoopOneVariableNode struct {
// contains filtered or unexported fields
}
================================================================
func NewForLoopOneVariableNode ¶
func NewForLoopOneVariableNode( variableName string, indexableNode IEvaluable, statementBlockNode *StatementBlockNode, ) *ForLoopOneVariableNode
func (*ForLoopOneVariableNode) Execute ¶
func (node *ForLoopOneVariableNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type ForLoopTwoVariableNode ¶
type ForLoopTwoVariableNode struct {
// contains filtered or unexported fields
}
================================================================
func NewForLoopTwoVariableNode ¶
func NewForLoopTwoVariableNode( keyIndexVariable *runtime.StackVariable, valueIndexVariable *runtime.StackVariable, indexableNode IEvaluable, statementBlockNode *StatementBlockNode, ) *ForLoopTwoVariableNode
func (*ForLoopTwoVariableNode) Execute ¶
func (node *ForLoopTwoVariableNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type FullOosvarLvalueNode ¶
type FullOosvarLvalueNode struct { }
----------------------------------------------------------------
func NewFullOosvarLvalueNode ¶
func NewFullOosvarLvalueNode() *FullOosvarLvalueNode
func (*FullOosvarLvalueNode) AssignIndexed ¶
func (*FullOosvarLvalueNode) Unassign ¶
func (node *FullOosvarLvalueNode) Unassign( state *runtime.State, )
func (*FullOosvarLvalueNode) UnassignIndexed ¶
func (node *FullOosvarLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type FullOosvarRvalueNode ¶
type FullOosvarRvalueNode struct { }
----------------------------------------------------------------
type FullSrecLvalueNode ¶
type FullSrecLvalueNode struct { }
----------------------------------------------------------------
func NewFullSrecLvalueNode ¶
func NewFullSrecLvalueNode() *FullSrecLvalueNode
func (*FullSrecLvalueNode) AssignIndexed ¶
func (*FullSrecLvalueNode) Unassign ¶
func (node *FullSrecLvalueNode) Unassign( state *runtime.State, )
func (*FullSrecLvalueNode) UnassignIndexed ¶
func (node *FullSrecLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type FullSrecRvalueNode ¶
type FullSrecRvalueNode struct { }
----------------------------------------------------------------
type IAssignable ¶
type IAssignable interface { Assign(rvalue *mlrval.Mlrval, state *runtime.State) error // 'foo = "bar"' or 'foo[3]["abc"] = "bar"' // For non-indexed assignment, which is the normal case, indices can be // zero-length or nil. AssignIndexed(rvalue *mlrval.Mlrval, indices []*mlrval.Mlrval, state *runtime.State) error Unassign(state *runtime.State) UnassignIndexed(indices []*mlrval.Mlrval, state *runtime.State) }
================================================================ This is for any left-hand side (LHS or Lvalue) of an assignment statement.
type IEvaluable ¶
================================================================ This is for any right-hand side (RHS or Rvalue) of an assignment statement. Also, for computed field names on the left-hand side, like '$a . $b' in mlr put '$[$a . $b]' = $x + $y'.
func BuildZaryFunctionCallsiteNode ¶
func BuildZaryFunctionCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
type IExecutable ¶
type IExecutable interface {
Execute(state *runtime.State) (*BlockExitPayload, error)
}
---------------------------------------------------------------- This is for all statements and statement blocks within the CST.
type IFSNode ¶
type IFSNode struct { }
----------------------------------------------------------------
type IPSNode ¶
type IPSNode struct { }
----------------------------------------------------------------
type IRSNode ¶
type IRSNode struct { }
----------------------------------------------------------------
type IfChainNode ¶
type IfChainNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewIfChainNode ¶
func NewIfChainNode(ifItems []*IfItem) *IfChainNode
func (*IfChainNode) Execute ¶
func (node *IfChainNode) Execute(state *runtime.State) (*BlockExitPayload, error)
----------------------------------------------------------------
type IfItem ¶
type IfItem struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------- For each if/elif/elif/else portion: the conditional part (...) and the statement-block part {...}. For "else", the conditional is nil.
type IndexedLvalueNode ¶
type IndexedLvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewIndexedLvalueNode ¶
func NewIndexedLvalueNode( baseLvalue IAssignable, indexEvaluables []IEvaluable, ) *IndexedLvalueNode
func (*IndexedLvalueNode) Assign ¶
Computes Lvalue indices and then delegates to the baseLvalue. E.g. for '$x[1][2] = 3' or '@x[1][2] = 3', the indices are [1,2], and the baseLvalue is '$x' or '@x' respectively.
func (*IndexedLvalueNode) AssignIndexed ¶
func (*IndexedLvalueNode) Unassign ¶
func (node *IndexedLvalueNode) Unassign( state *runtime.State, )
func (*IndexedLvalueNode) UnassignIndexed ¶
func (node *IndexedLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type IndirectFieldValueLvalueNode ¶
type IndirectFieldValueLvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewIndirectFieldValueLvalueNode ¶
func NewIndirectFieldValueLvalueNode( lhsFieldNameExpression IEvaluable, ) *IndirectFieldValueLvalueNode
func (*IndirectFieldValueLvalueNode) AssignIndexed ¶
func (*IndirectFieldValueLvalueNode) Unassign ¶
func (node *IndirectFieldValueLvalueNode) Unassign( state *runtime.State, )
func (*IndirectFieldValueLvalueNode) UnassignIndexed ¶
func (node *IndirectFieldValueLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type IndirectFieldValueNode ¶
type IndirectFieldValueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type IndirectOosvarValueLvalueNode ¶
type IndirectOosvarValueLvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewIndirectOosvarValueLvalueNode ¶
func NewIndirectOosvarValueLvalueNode( lhsOosvarNameExpression IEvaluable, ) *IndirectOosvarValueLvalueNode
func (*IndirectOosvarValueLvalueNode) AssignIndexed ¶
func (*IndirectOosvarValueLvalueNode) Unassign ¶
func (node *IndirectOosvarValueLvalueNode) Unassign( state *runtime.State, )
func (*IndirectOosvarValueLvalueNode) UnassignIndexed ¶
func (node *IndirectOosvarValueLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type IndirectOosvarValueNode ¶
type IndirectOosvarValueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type IntLiteralNode ¶
type IntLiteralNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type LiteralEmptyStringNode ¶
type LiteralEmptyStringNode struct { }
================================================================
type LiteralOneNode ¶
type LiteralOneNode struct { }
================================================================
type LocalVariableLvalueNode ¶
type LocalVariableLvalueNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewLocalVariableLvalueNode ¶
func NewLocalVariableLvalueNode( stackVariable *runtime.StackVariable, typeName string, defineTypedAtScope bool, ) *LocalVariableLvalueNode
func (*LocalVariableLvalueNode) AssignIndexed ¶
func (*LocalVariableLvalueNode) Unassign ¶
func (node *LocalVariableLvalueNode) Unassign( state *runtime.State, )
func (*LocalVariableLvalueNode) UnassignIndexed ¶
func (node *LocalVariableLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type LocalVariableNode ¶
type LocalVariableNode struct {
// contains filtered or unexported fields
}
type LogicalANDOperatorNode ¶
type LogicalANDOperatorNode struct {
// contains filtered or unexported fields
}
================================================================
func BuildLogicalANDOperatorNode ¶
func BuildLogicalANDOperatorNode(a, b IEvaluable) *LogicalANDOperatorNode
type LogicalOROperatorNode ¶
type LogicalOROperatorNode struct {
// contains filtered or unexported fields
}
================================================================
func BuildLogicalOROperatorNode ¶
func BuildLogicalOROperatorNode(a, b IEvaluable) *LogicalOROperatorNode
type MapLiteralNode ¶
type MapLiteralNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type MathENode ¶
type MathENode struct { }
----------------------------------------------------------------
type MathPINode ¶
type MathPINode struct { }
----------------------------------------------------------------
type MlrvalLiteralNode ¶
type MlrvalLiteralNode struct {
// contains filtered or unexported fields
}
func BuildMlrvalLiteralNode ¶
func BuildMlrvalLiteralNode(literal *mlrval.Mlrval) *MlrvalLiteralNode
type NFNode ¶
type NFNode struct { }
----------------------------------------------------------------
type NRNode ¶
type NRNode struct { }
----------------------------------------------------------------
type NodeBuilder ¶
type NodeBuilder func(astNode *dsl.ASTNode) (IEvaluable, error)
---------------------------------------------------------------- Many functions have this signature. This type-alias is for function-name lookup tables.
type NullLiteralNode ¶
type NullLiteralNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type OFSNode ¶
type OFSNode struct { }
----------------------------------------------------------------
type OPSNode ¶
type OPSNode struct { }
----------------------------------------------------------------
type ORSNode ¶
type ORSNode struct { }
----------------------------------------------------------------
type PositionalFieldNameLvalueNode ¶
type PositionalFieldNameLvalueNode struct {
// contains filtered or unexported fields
}
func NewPositionalFieldNameLvalueNode ¶
func NewPositionalFieldNameLvalueNode( lhsFieldIndexExpression IEvaluable, ) *PositionalFieldNameLvalueNode
func (*PositionalFieldNameLvalueNode) AssignIndexed ¶
func (*PositionalFieldNameLvalueNode) Unassign ¶
func (node *PositionalFieldNameLvalueNode) Unassign( state *runtime.State, )
func (*PositionalFieldNameLvalueNode) UnassignIndexed ¶
func (node *PositionalFieldNameLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type PositionalFieldNameNode ¶
type PositionalFieldNameNode struct {
// contains filtered or unexported fields
}
type PositionalFieldValueLvalueNode ¶
type PositionalFieldValueLvalueNode struct {
// contains filtered or unexported fields
}
func NewPositionalFieldValueLvalueNode ¶
func NewPositionalFieldValueLvalueNode( lhsFieldIndexExpression IEvaluable, ) *PositionalFieldValueLvalueNode
func (*PositionalFieldValueLvalueNode) AssignIndexed ¶
func (*PositionalFieldValueLvalueNode) Unassign ¶
func (node *PositionalFieldValueLvalueNode) Unassign( state *runtime.State, )
Same code as PositionalFieldNameLvalueNode. May as well let them do 'unset $[[[7]]]' as well as $[[7]]'.
func (*PositionalFieldValueLvalueNode) UnassignIndexed ¶
func (node *PositionalFieldValueLvalueNode) UnassignIndexed( indices []*mlrval.Mlrval, state *runtime.State, )
type PositionalFieldValueNode ¶
type PositionalFieldValueNode struct {
// contains filtered or unexported fields
}
type PrintStatementNode ¶
type PrintStatementNode struct {
// contains filtered or unexported fields
}
func (*PrintStatementNode) Execute ¶
func (node *PrintStatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
----------------------------------------------------------------
type RegexCaptureBinaryFunctionCallsiteNode ¶
type RegexCaptureBinaryFunctionCallsiteNode struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------- RegexCaptureBinaryFunctionCallsiteNode special-cases the =~ and !=~ operators which set the CST State object's captures array for "\1".."\9". This is identical to BinaryFunctionCallsite except that BinaryFunctionCallsite's impl function takes two *mlrval.Mlrval arguments and returns a *mlrval.Mlrval, whereas RegexCaptureBinaryFunctionCallsiteNode's impl function takes two *mlrval.Mlrval arguments but returns *mlrval.Mlrval along with a []string captures array. The captures are stored in the State object for use in subsequent statements.
Note the use of "capture" is ambiguous:
- There is the regex-match part which captures submatches out of a full match expression, and saves them.
* Then there is the part which inserts these captures into another string.
For sub/gsub, the former and latter are both within the sub/gsub routine. E.g. with $y = sub($x, "(..)_(...)", "\2:\1" and $x being "ab_cde", $y will be "cde:ab".
For =~ and !=~, the former are right there, but the latter can be several lines later. E.g. if ($x =~ "(..)_(...)") { ... other lines of code ... $y = "\2:\1"; }
So: this RegexCaptureBinaryFunctionCallsiteNode only refers to the =~ and !=~ callsites only -- not sub/gsub, and not the capture-using replacement statements like '$y = "\2:\1".
type RegexCaptureReplacementNode ¶
type RegexCaptureReplacementNode struct {
// contains filtered or unexported fields
}
RegexCaptureReplacementNode is for any string literal that has any "\0" .. "\9" in it. As of the original design of Miller, submatches are captured in one place and interpolated in another. For example:
if ($x =~ "(..)_(...)" { ... other lines of code ... $y = "\2:\1"; }
This node type is for things like "\2:\1". They can occur quite far from the =~ callsite so we need to check all string literals to see if they have "\0" .. "\9" anywhere within them. If they do, we precompute a replacementCaptureMatrix which is basically compiled information about the replacement string -- the start/end offsets of the "\1", "\2", etc substrings.
func (*RegexCaptureReplacementNode) Evaluate ¶
func (node *RegexCaptureReplacementNode) Evaluate( state *runtime.State, ) *mlrval.Mlrval
As noted above, in things like
if ($x =~ "(..)_(...)" { ... other lines of code ... $y = "\2:\1"; }
the captures can be set (by =~ or !=~) quite far from where they are used. This is why we consult the state's regex captures here, to see if they've been set on some previous invocation of =~ or !=~.
type RegexLiteralNode ¶
type RegexLiteralNode struct {
// contains filtered or unexported fields
}
type ReturnNode ¶
type ReturnNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func (*ReturnNode) Execute ¶
func (node *ReturnNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type RootNode ¶
type RootNode struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------- Please see root.go for context and comments.
func NewEmptyRoot ¶
func NewEmptyRoot( recordWriterOptions *cli.TWriterOptions, dslInstanceType DSLInstanceType, ) *RootNode
NewEmptyRoot sets up an empty CST, before ingesting any DSL strings. For mlr put and mlr filter, CSTs are constructed, then ASTs are ingested from DSL strings. For the REPL, a CST is constructed once, then an AST is ingested on every line of input from the REPL.
func (*RootNode) Build ¶
func (root *RootNode) Build( dslStrings []string, dslInstanceType DSLInstanceType, isReplImmediate bool, doWarnings bool, astBuildVisitorFunc ASTBuildVisitorFunc, ) (hadWarnings bool, err error)
Used by DSL -> AST -> CST callsites including mlr put, mlr filter, and mlr repl. The RootNode must be separately instantiated (e.g. NewEmptyRoot()) since the CST is partially reset on every line of input from the REPL prompt.
func (*RootNode) BuildAndInstallUDF ¶
BuildAndInstallUDF is for named UDFs, like `func f(a, b) { return b - a}'.
func (*RootNode) BuildAndInstallUDS ¶
func (*RootNode) BuildArrayLiteralNode ¶
func (node *RootNode) BuildArrayLiteralNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildArrayOrMapIndexAccessNode ¶
func (node *RootNode) BuildArrayOrMapIndexAccessNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildArrayOrMapPositionalNameAccessNode ¶
func (node *RootNode) BuildArrayOrMapPositionalNameAccessNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildArrayOrMapPositionalValueAccessNode ¶
func (node *RootNode) BuildArrayOrMapPositionalValueAccessNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildArraySliceAccessNode ¶
func (node *RootNode) BuildArraySliceAccessNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildArraySliceEmptyLowerIndexNode ¶
func (root *RootNode) BuildArraySliceEmptyLowerIndexNode( astNode *dsl.ASTNode, ) (*LiteralOneNode, error)
In array slices like 'myarray[:4]', the lower index is always 1 since Miller user-space indices are 1-up.
func (*RootNode) BuildArraySliceEmptyUpperIndexNode ¶
func (root *RootNode) BuildArraySliceEmptyUpperIndexNode( astNode *dsl.ASTNode, ) (*LiteralEmptyStringNode, error)
In array slices like 'myarray[4:]', the upper index is always n, where n is the length of the array, since Miller user-space indices are 1-up. However, we don't have access to the array length in this AST node so we return "" so the slice-index CST node can compute it.
func (*RootNode) BuildAssignableNode ¶
func (root *RootNode) BuildAssignableNode( astNode *dsl.ASTNode, ) (IAssignable, error)
----------------------------------------------------------------
func (*RootNode) BuildAssignmentNode ¶
func (root *RootNode) BuildAssignmentNode( astNode *dsl.ASTNode, ) (*AssignmentNode, error)
================================================================
func (*RootNode) BuildBareBooleanStatementNode ¶
func (root *RootNode) BuildBareBooleanStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
----------------------------------------------------------------
func (*RootNode) BuildBinaryFunctionCallsiteNode ¶
func (root *RootNode) BuildBinaryFunctionCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildBinaryFunctionWithStateCallsiteNode ¶
func (root *RootNode) BuildBinaryFunctionWithStateCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildBoolLiteralNode ¶
func (root *RootNode) BuildBoolLiteralNode(literal string) *BoolLiteralNode
func (*RootNode) BuildBreakNode ¶
func (*RootNode) BuildBuiltinFunctionCallsiteNode ¶
func (root *RootNode) BuildBuiltinFunctionCallsiteNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
----------------------------------------------------------------
func (*RootNode) BuildCondBlockNode ¶
func (root *RootNode) BuildCondBlockNode(astNode *dsl.ASTNode) (*CondBlockNode, error)
func (*RootNode) BuildConstantNode ¶
func (root *RootNode) BuildConstantNode(astNode *dsl.ASTNode) (IEvaluable, error)
================================================================
func (*RootNode) BuildContextVariableNode ¶
func (root *RootNode) BuildContextVariableNode(astNode *dsl.ASTNode) (IEvaluable, error)
================================================================
func (*RootNode) BuildContinueNode ¶
func (root *RootNode) BuildContinueNode(astNode *dsl.ASTNode) (*ContinueNode, error)
func (*RootNode) BuildDirectFieldRvalueNode ¶
func (root *RootNode) BuildDirectFieldRvalueNode(fieldName string) *DirectFieldRvalueNode
func (*RootNode) BuildDirectFieldValueLvalueNode ¶
func (root *RootNode) BuildDirectFieldValueLvalueNode( astNode *dsl.ASTNode, ) (IAssignable, error)
func (*RootNode) BuildDirectOosvarRvalueNode ¶
func (root *RootNode) BuildDirectOosvarRvalueNode(variableName string) *DirectOosvarRvalueNode
func (*RootNode) BuildDirectOosvarValueLvalueNode ¶
func (root *RootNode) BuildDirectOosvarValueLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
func (*RootNode) BuildDoWhileLoopNode ¶
func (root *RootNode) BuildDoWhileLoopNode(astNode *dsl.ASTNode) (*DoWhileLoopNode, error)
func (*RootNode) BuildDotCallsiteNode ¶
func (root *RootNode) BuildDotCallsiteNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildDottedLvalueNode ¶
func (root *RootNode) BuildDottedLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
BuildDottedLvalueNode is basically the same as BuildIndexedLvalueNode except at the syntax level: 'mymap["x"]["y"]' is the same as 'mymap.x.y'.
func (*RootNode) BuildDumpStatementNode ¶
func (root *RootNode) BuildDumpStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
----------------------------------------------------------------
func (*RootNode) BuildEdumpStatementNode ¶
func (root *RootNode) BuildEdumpStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildEmit1StatementNode ¶
func (root *RootNode) BuildEmit1StatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildEmitFStatementNode ¶
func (root *RootNode) BuildEmitFStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildEmitPStatementNode ¶
func (root *RootNode) BuildEmitPStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildEmitStatementNode ¶
func (root *RootNode) BuildEmitStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildEnvironmentVariableLvalueNode ¶
func (root *RootNode) BuildEnvironmentVariableLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
func (*RootNode) BuildEnvironmentVariableNode ¶
func (root *RootNode) BuildEnvironmentVariableNode(astNode *dsl.ASTNode) (*EnvironmentVariableNode, error)
func (*RootNode) BuildEprintStatementNode ¶
func (root *RootNode) BuildEprintStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildEprintnStatementNode ¶
func (root *RootNode) BuildEprintnStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildEvaluableNode ¶
func (root *RootNode) BuildEvaluableNode(astNode *dsl.ASTNode) (IEvaluable, error)
----------------------------------------------------------------
func (*RootNode) BuildFILENAMENode ¶
func (root *RootNode) BuildFILENAMENode() *FILENAMENode
func (*RootNode) BuildFILENUMNode ¶
func (root *RootNode) BuildFILENUMNode() *FILENUMNode
func (*RootNode) BuildFLATSEPNode ¶
func (root *RootNode) BuildFLATSEPNode() *FLATSEPNode
func (*RootNode) BuildFNRNode ¶
func (*RootNode) BuildFilterStatementNode ¶
func (root *RootNode) BuildFilterStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildFloatLiteralNode ¶
func (root *RootNode) BuildFloatLiteralNode(literal string) *FloatLiteralNode
func (*RootNode) BuildForLoopMultivariableNode ¶
func (root *RootNode) BuildForLoopMultivariableNode( astNode *dsl.ASTNode, ) (*ForLoopMultivariableNode, error)
func (*RootNode) BuildForLoopOneVariableNode ¶
func (root *RootNode) BuildForLoopOneVariableNode(astNode *dsl.ASTNode) (*ForLoopOneVariableNode, error)
func (*RootNode) BuildForLoopTwoVariableNode ¶
func (root *RootNode) BuildForLoopTwoVariableNode(astNode *dsl.ASTNode) (*ForLoopTwoVariableNode, error)
func (*RootNode) BuildFullOosvarLvalueNode ¶
func (root *RootNode) BuildFullOosvarLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
func (*RootNode) BuildFullOosvarRvalueNode ¶
func (root *RootNode) BuildFullOosvarRvalueNode() *FullOosvarRvalueNode
func (*RootNode) BuildFullSrecLvalueNode ¶
func (root *RootNode) BuildFullSrecLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
func (*RootNode) BuildFullSrecRvalueNode ¶
func (root *RootNode) BuildFullSrecRvalueNode() *FullSrecRvalueNode
func (*RootNode) BuildFunctionCallsiteNode ¶
func (root *RootNode) BuildFunctionCallsiteNode(astNode *dsl.ASTNode) (IEvaluable, error)
func (*RootNode) BuildIFSNode ¶
func (*RootNode) BuildIPSNode ¶
func (*RootNode) BuildIRSNode ¶
func (*RootNode) BuildIfChainNode ¶
func (root *RootNode) BuildIfChainNode(astNode *dsl.ASTNode) (*IfChainNode, error)
func (*RootNode) BuildIndexedLvalueNode ¶
func (root *RootNode) BuildIndexedLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
Either 'mymap["attr"]' or 'mymap.attr'. Furthermore they can be mixed as in 'mymap["foo"].bar' or 'mymap.foo["bar"]'.
func (*RootNode) BuildIndirectFieldValueLvalueNode ¶
func (root *RootNode) BuildIndirectFieldValueLvalueNode( astNode *dsl.ASTNode, ) (IAssignable, error)
func (*RootNode) BuildIndirectFieldValueNode ¶
func (root *RootNode) BuildIndirectFieldValueNode( astNode *dsl.ASTNode, ) (*IndirectFieldValueNode, error)
func (*RootNode) BuildIndirectOosvarValueLvalueNode ¶
func (root *RootNode) BuildIndirectOosvarValueLvalueNode( astNode *dsl.ASTNode, ) (IAssignable, error)
func (*RootNode) BuildIndirectOosvarValueNode ¶
func (root *RootNode) BuildIndirectOosvarValueNode( astNode *dsl.ASTNode, ) (*IndirectOosvarValueNode, error)
func (*RootNode) BuildIntLiteralNode ¶
func (root *RootNode) BuildIntLiteralNode(literal string) *IntLiteralNode
func (*RootNode) BuildLeafNode ¶
func (root *RootNode) BuildLeafNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
----------------------------------------------------------------
func (*RootNode) BuildLocalVariableLvalueNode ¶
func (root *RootNode) BuildLocalVariableLvalueNode(astNode *dsl.ASTNode) (IAssignable, error)
func (*RootNode) BuildLocalVariableNode ¶
func (root *RootNode) BuildLocalVariableNode(variableName string) *LocalVariableNode
func (*RootNode) BuildMapLiteralNode ¶
func (node *RootNode) BuildMapLiteralNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildMathENode ¶
func (*RootNode) BuildMathPINode ¶
func (root *RootNode) BuildMathPINode() *MathPINode
func (*RootNode) BuildMultipleArityFunctionCallsiteNode ¶
func (root *RootNode) BuildMultipleArityFunctionCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
----------------------------------------------------------------
func (*RootNode) BuildNFNode ¶
func (*RootNode) BuildNRNode ¶
func (*RootNode) BuildNullLiteralNode ¶
func (root *RootNode) BuildNullLiteralNode() *NullLiteralNode
func (*RootNode) BuildOFSNode ¶
func (*RootNode) BuildOPSNode ¶
func (*RootNode) BuildORSNode ¶
func (*RootNode) BuildPanicNode ¶
func (*RootNode) BuildPositionalFieldNameLvalueNode ¶
func (root *RootNode) BuildPositionalFieldNameLvalueNode( astNode *dsl.ASTNode, ) (IAssignable, error)
func (*RootNode) BuildPositionalFieldNameNode ¶
func (node *RootNode) BuildPositionalFieldNameNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildPositionalFieldValueLvalueNode ¶
func (root *RootNode) BuildPositionalFieldValueLvalueNode( astNode *dsl.ASTNode, ) (IAssignable, error)
func (*RootNode) BuildPositionalFieldValueNode ¶
func (node *RootNode) BuildPositionalFieldValueNode( astNode *dsl.ASTNode, ) (IEvaluable, error)
func (*RootNode) BuildPrintStatementNode ¶
func (root *RootNode) BuildPrintStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
----------------------------------------------------------------
func (*RootNode) BuildPrintnStatementNode ¶
func (root *RootNode) BuildPrintnStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildRegexCaptureBinaryFunctionCallsiteNode ¶
func (root *RootNode) BuildRegexCaptureBinaryFunctionCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildRegexLiteralNode ¶
func (root *RootNode) BuildRegexLiteralNode(literal string) IEvaluable
func (*RootNode) BuildReturnNode ¶
func (root *RootNode) BuildReturnNode(astNode *dsl.ASTNode) (*ReturnNode, error)
func (*RootNode) BuildStatementBlockNode ¶
func (root *RootNode) BuildStatementBlockNode( astNode *dsl.ASTNode, ) (*StatementBlockNode, error)
----------------------------------------------------------------
func (*RootNode) BuildStatementBlockNodeFromBeginOrEnd ¶
func (root *RootNode) BuildStatementBlockNodeFromBeginOrEnd( astBeginOrEndNode *dsl.ASTNode, ) (*StatementBlockNode, error)
----------------------------------------------------------------
func (*RootNode) BuildStatementNode ¶
func (root *RootNode) BuildStatementNode( astNode *dsl.ASTNode, ) (IExecutable, error)
----------------------------------------------------------------
func (*RootNode) BuildStringLiteralNode ¶
func (root *RootNode) BuildStringLiteralNode(literal string) IEvaluable
func (*RootNode) BuildSubroutineCallsiteNode ¶
func (root *RootNode) BuildSubroutineCallsiteNode(astNode *dsl.ASTNode) (IExecutable, error)
func (*RootNode) BuildTeeStatementNode ¶
func (root *RootNode) BuildTeeStatementNode(astNode *dsl.ASTNode) (IExecutable, error)
----------------------------------------------------------------
func (*RootNode) BuildTernaryFunctionCallsiteNode ¶
func (root *RootNode) BuildTernaryFunctionCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildTernaryFunctionWithStateCallsiteNode ¶
func (root *RootNode) BuildTernaryFunctionWithStateCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildTripleForLoopNode ¶
func (root *RootNode) BuildTripleForLoopNode(astNode *dsl.ASTNode) (*TripleForLoopNode, error)
func (*RootNode) BuildUDF ¶
func (root *RootNode) BuildUDF( astNode *dsl.ASTNode, functionName string, isFunctionLiteral bool, ) (*UDF, error)
BuildUDF is for named UDFs, like `func f(a, b) { return b - a}', or, unnamed UDFs like `func (a, b) { return b - a }'.
func (*RootNode) BuildUnaryFunctionCallsiteNode ¶
func (root *RootNode) BuildUnaryFunctionCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildUnaryFunctionWithContextCallsiteNode ¶
func (root *RootNode) BuildUnaryFunctionWithContextCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildUnnamedUDFNode ¶
func (root *RootNode) BuildUnnamedUDFNode(astNode *dsl.ASTNode) (IEvaluable, error)
func (*RootNode) BuildUnsetNode ¶
================================================================
func (*RootNode) BuildVariadicFunctionCallsiteNode ¶
func (root *RootNode) BuildVariadicFunctionCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildVariadicFunctionWithStateCallsiteNode ¶
func (root *RootNode) BuildVariadicFunctionWithStateCallsiteNode( astNode *dsl.ASTNode, builtinFunctionInfo *BuiltinFunctionInfo, ) (IEvaluable, error)
func (*RootNode) BuildWhileLoopNode ¶
func (root *RootNode) BuildWhileLoopNode(astNode *dsl.ASTNode) (*WhileLoopNode, error)
func (*RootNode) ExecuteBeginBlocks ¶
func (*RootNode) ExecuteEndBlocks ¶
func (*RootNode) ExecuteMainBlock ¶
func (*RootNode) ExecuteREPLImmediate ¶
This is the 'execute once' part of that.
func (*RootNode) IngestAST ¶
func (root *RootNode) IngestAST( ast *dsl.AST, isReplImmediate bool, doWarnings bool, ) (hadWarnings bool, err error)
If the user has multiple put -f / put -e pieces, we can AST-parse each separately and build them. However we cannot resolve UDF/UDS references until after they're all ingested -- e.g. first piece calls a function which the second defines, or mutual recursion across pieces, etc.
func (*RootNode) ProcessEndOfStream ¶
func (root *RootNode) ProcessEndOfStream()
func (*RootNode) RegisterOutputHandlerManager ¶
func (root *RootNode) RegisterOutputHandlerManager( outputHandlerManager output.OutputHandlerManager, )
func (*RootNode) ResetBeginBlocksForREPL ¶
func (root *RootNode) ResetBeginBlocksForREPL()
This is for the REPL's resetblocks command.
func (*RootNode) ResetEndBlocksForREPL ¶
func (root *RootNode) ResetEndBlocksForREPL()
This is for the REPL's resetblocks command.
func (*RootNode) ResetForREPL ¶
func (root *RootNode) ResetForREPL()
This is the 'and then discarded' part of that.
func (*RootNode) ResetMainBlockForREPL ¶
func (root *RootNode) ResetMainBlockForREPL()
This is for the REPL's resetblocks command.
func (*RootNode) Resolve ¶
Resolve is called after IngestAST has been called one or more times. See comments above IngestAST.
func (*RootNode) ShowBlockReport ¶
func (root *RootNode) ShowBlockReport()
This is for the REPL's context-printer command.
func (*RootNode) WithRedefinableUDFUDS ¶
Nominally for mlr put/filter we want to flag overwritten UDFs/UDSs as an error. But in the REPL, which is interactive, people should be able to redefine. This method allows the latter use-case.
func (*RootNode) WithStrictMode ¶
WithStrictMode allows for runtime handling of absent-reads and untyped assignments.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewSignature ¶
func NewSignature( funcOrSubrName string, arity int, typeGatedParameterNames []*types.TypeGatedMlrvalName, typeGatedReturnValue *types.TypeGatedMlrvalName, ) *Signature
type StandardTernaryOperatorNode ¶
type StandardTernaryOperatorNode struct {
// contains filtered or unexported fields
}
================================================================
func BuildStandardTernaryOperatorNode ¶
func BuildStandardTernaryOperatorNode(a, b, c IEvaluable) *StandardTernaryOperatorNode
type StatementBlockNode ¶
type StatementBlockNode struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------- Also implements IExecutable
func NewStatementBlockNode ¶
func NewStatementBlockNode() *StatementBlockNode
----------------------------------------------------------------
func (*StatementBlockNode) AppendStatementNode ¶
func (node *StatementBlockNode) AppendStatementNode(executable IExecutable)
----------------------------------------------------------------
func (*StatementBlockNode) Execute ¶
func (node *StatementBlockNode) Execute(state *runtime.State) (*BlockExitPayload, error)
----------------------------------------------------------------
func (*StatementBlockNode) ExecuteFrameless ¶
func (node *StatementBlockNode) ExecuteFrameless(state *runtime.State) (*BlockExitPayload, error)
type StringLiteralNode ¶
type StringLiteralNode struct {
// contains filtered or unexported fields
}
---------------------------------------------------------------- StringLiteralNode is for any string literal that doesn't have any "\0" .. "\9" in it.
type TFunctionClass ¶
type TFunctionClass string
const ( FUNC_CLASS_ARITHMETIC TFunctionClass = "arithmetic" FUNC_CLASS_MATH TFunctionClass = "math" FUNC_CLASS_STATS TFunctionClass = "stats" FUNC_CLASS_BOOLEAN TFunctionClass = "boolean" FUNC_CLASS_STRING TFunctionClass = "string" FUNC_CLASS_HASHING TFunctionClass = "hashing" FUNC_CLASS_CONVERSION TFunctionClass = "conversion" FUNC_CLASS_TYPING TFunctionClass = "typing" FUNC_CLASS_COLLECTIONS TFunctionClass = "collections" FUNC_CLASS_HOFS TFunctionClass = "higher-order-functions" FUNC_CLASS_SYSTEM TFunctionClass = "system" FUNC_CLASS_TIME TFunctionClass = "time" )
type TeeStatementNode ¶
type TeeStatementNode struct {
// contains filtered or unexported fields
}
func (*TeeStatementNode) Execute ¶
func (node *TeeStatementNode) Execute(state *runtime.State) (*BlockExitPayload, error)
----------------------------------------------------------------
type TernaryFuncWithState ¶
type TernaryFuncWithState func( input1 *mlrval.Mlrval, input2 *mlrval.Mlrval, input3 *mlrval.Mlrval, state *runtime.State, ) *mlrval.Mlrval
TernaryFuncWithState is for fold.
type TernaryFunctionCallsiteNode ¶
type TernaryFunctionCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type TernaryFunctionWithStateCallsiteNode ¶
type TernaryFunctionWithStateCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type TripleForLoopNode ¶
type TripleForLoopNode struct {
// contains filtered or unexported fields
}
================================================================
func NewTripleForLoopNode ¶
func NewTripleForLoopNode( startBlockNode *StatementBlockNode, precontinuationAssignments []IExecutable, continuationExpressionNode IEvaluable, continuationExpressionToken *token.Token, updateBlockNode *StatementBlockNode, bodyBlockNode *StatementBlockNode, ) *TripleForLoopNode
func (*TripleForLoopNode) Execute ¶
func (node *TripleForLoopNode) Execute(state *runtime.State) (*BlockExitPayload, error)
type UDF ¶
type UDF struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewUDF ¶
func NewUDF( signature *Signature, functionBody *StatementBlockNode, isFunctionLiteral bool, ) *UDF
func NewUnresolvedUDF ¶
For when a function is called before being defined. This gives us something to go back and fill in later once we've encountered the function definition.
type UDFCallsite ¶
type UDFCallsite struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewUDFCallsite ¶
func NewUDFCallsite( argumentNodes []IEvaluable, udf *UDF, ) *UDFCallsite
NewUDFCallsite is for the normal UDF callsites outside of sortaf/sortmf, e.g. $z = f($a+$b, $c/2). The argument nodes are evaluables since they need to be computed, e.g. binding the field names a,b,c, evaluating the arithmetic operators, etc.
func NewUDFCallsiteForHigherOrderFunction ¶
func NewUDFCallsiteForHigherOrderFunction( udf *UDF, arity int, ) *UDFCallsite
NewUDFCallsiteForHigherOrderFunction is for UDF callsites such as sortaf/sortmf. Here, the array/map to be sorted has already been evaluated and is an array of *mlrval.Mlrval. The UDF needs to be invoked on pairs of array elements.
func (*UDFCallsite) Evaluate ¶
func (site *UDFCallsite) Evaluate( state *runtime.State, ) *mlrval.Mlrval
Evaluate is for the normal UDF callsites outside of sortaf/sortmf. See comments above NewUDFCallsite.
func (*UDFCallsite) EvaluateWithArguments ¶
func (site *UDFCallsite) EvaluateWithArguments( state *runtime.State, udf *UDF, arguments []*mlrval.Mlrval, ) *mlrval.Mlrval
EvaluateWithArguments is for UDF callsites in sortaf/sortmf, where the arguments are already evaluated. Or, for normal UDF callsites, as a helper function for Evaluate.
type UDFManager ¶
type UDFManager struct {
// contains filtered or unexported fields
}
UDFManager tracks named UDFs like 'func f(a, b) { return b - a }'
func (*UDFManager) ExistsByName ¶
func (manager *UDFManager) ExistsByName(name string) bool
func (*UDFManager) Install ¶
func (manager *UDFManager) Install(udf *UDF)
func (*UDFManager) LookUp ¶
func (manager *UDFManager) LookUp(functionName string, callsiteArity int) (*UDF, error)
LookUp is for callsites invoking UDFs whose names are known at CST-build time.
func (*UDFManager) LookUpDisregardingArity ¶
func (manager *UDFManager) LookUpDisregardingArity(functionName string) *UDF
LookUpDisregardingArity is used for evaluating right-hand sides of 'f = udf' where f will be a local variable of type funct and udf is an existing UDF.
type UDS ¶
type UDS struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewUDS ¶
func NewUDS( signature *Signature, subroutineBody *StatementBlockNode, ) *UDS
func NewUnresolvedUDS ¶
For when a subroutine is called before being defined. This gives us something to go back and fill in later once we've encountered the subroutine definition.
type UDSCallsite ¶
type UDSCallsite struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewUDSCallsite ¶
func NewUDSCallsite( argumentNodes []IEvaluable, uds *UDS, ) *UDSCallsite
func (*UDSCallsite) Execute ¶
func (site *UDSCallsite) Execute(state *runtime.State) (*BlockExitPayload, error)
type UDSManager ¶
type UDSManager struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewUDSManager ¶
func NewUDSManager() *UDSManager
func (*UDSManager) ExistsByName ¶
func (manager *UDSManager) ExistsByName(name string) bool
func (*UDSManager) Install ¶
func (manager *UDSManager) Install(uds *UDS)
type UnaryFunctionCallsiteNode ¶
type UnaryFunctionCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type UnaryFunctionWithContextCallsiteNode ¶
type UnaryFunctionWithContextCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type UnnamedUDFNode ¶
type UnnamedUDFNode struct {
// contains filtered or unexported fields
}
UnnamedUDFNode holds function literals like 'func (a, b) { return b - a }'.
type UnsetNode ¶
type UnsetNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
func NewUnsetNode ¶
func NewUnsetNode( lvalueNodes []IAssignable, ) *UnsetNode
type VariadicFuncWithState ¶
VariadicFuncWithState is for sort.
type VariadicFunctionCallsiteNode ¶
type VariadicFunctionCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type VariadicFunctionWithStateCallsiteNode ¶
type VariadicFunctionWithStateCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
type WhileLoopNode ¶
type WhileLoopNode struct {
// contains filtered or unexported fields
}
================================================================
func NewWhileLoopNode ¶
func NewWhileLoopNode( conditionNode IEvaluable, conditionToken *token.Token, statementBlockNode *StatementBlockNode, ) *WhileLoopNode
func (*WhileLoopNode) Execute ¶
func (node *WhileLoopNode) Execute(state *runtime.State) (*BlockExitPayload, error)
----------------------------------------------------------------
type ZaryFunctionCallsiteNode ¶
type ZaryFunctionCallsiteNode struct {
// contains filtered or unexported fields
}
----------------------------------------------------------------
Source Files ¶
- assignments.go
- block_exit.go
- blocks.go
- builtin_function_manager.go
- builtin_functions.go
- collections.go
- cond.go
- doc.go
- dump.go
- emit1.go
- emit_emitp.go
- emitf.go
- env.go
- evaluable.go
- filter.go
- for.go
- functions.go
- hofs.go
- if.go
- keyword_usage.go
- leaves.go
- lvalues.go
- print.go
- root.go
- signature.go
- statements.go
- subroutines.go
- tee.go
- types.go
- udf.go
- uds.go
- validate.go
- warn.go
- while.go