Documentation ¶
Index ¶
- Variables
- type Arg
- type Args
- func (as *Args) AcceptConstant(cons *Constant) error
- func (as *Args) AcceptExpression(exp *Expression) error
- func (as *Args) AcceptFunctionCall(funcCall *FunctionCall) error
- func (as *Args) AcceptMapVar(mapVar *MapVar) error
- func (as *Args) AcceptMethodCall(methodCall *MethodCall) error
- func (as *Args) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
- func (as *Args) AcceptVariable(name string) error
- func (as *Args) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) ([]reflect.Value, error)
- type ArgsHolder
- type Assignment
- func (a *Assignment) AcceptExpression(exp *Expression) error
- func (a *Assignment) AcceptMapVar(mapVar *MapVar) error
- func (a *Assignment) AcceptMathExpression(me *MathExpression) error
- func (a *Assignment) AcceptVariable(name string) error
- func (a *Assignment) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (value reflect.Value, err error)
- type AssignmentHolder
- type AtDescHolder
- type AtIdHolder
- type AtNameHolder
- type AtSalienceHolder
- type BreakStmt
- type ConcStatement
- func (cs *ConcStatement) AcceptAssignment(assignment *Assignment) error
- func (cs *ConcStatement) AcceptFunctionCall(funcCall *FunctionCall) error
- func (cs *ConcStatement) AcceptMethodCall(methodCall *MethodCall) error
- func (cs *ConcStatement) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
- func (cs *ConcStatement) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error)
- type Constant
- func (cons *Constant) AcceptDesc(desc string) error
- func (cons *Constant) AcceptId(id int64) error
- func (cons *Constant) AcceptInteger(i64 int64) error
- func (cons *Constant) AcceptName(name string) error
- func (cons *Constant) AcceptSalience(sal int64) error
- func (cons *Constant) AcceptString(str string) error
- func (cons *Constant) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error)
- type ConstantHolder
- type ContinueStmt
- type ElseIfStmt
- type ElseStmt
- type Expression
- func (e *Expression) AcceptExpression(expression *Expression) error
- func (e *Expression) AcceptExpressionAtom(atom *ExpressionAtom) error
- func (e *Expression) AcceptMathExpression(atom *MathExpression) error
- func (e *Expression) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error)
- type ExpressionAtom
- func (e *ExpressionAtom) AcceptConstant(cons *Constant) error
- func (e *ExpressionAtom) AcceptFunctionCall(funcCall *FunctionCall) error
- func (e *ExpressionAtom) AcceptMapVar(mapVar *MapVar) error
- func (e *ExpressionAtom) AcceptMethodCall(methodCall *MethodCall) error
- func (e *ExpressionAtom) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
- func (e *ExpressionAtom) AcceptVariable(name string) error
- func (e *ExpressionAtom) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error)
- type ExpressionAtomHolder
- type ExpressionHolder
- type ForRangeStmt
- type ForStmt
- func (forStmt *ForStmt) AcceptAssignment(assignment *Assignment) error
- func (forStmt *ForStmt) AcceptExpression(expr *Expression) error
- func (forStmt *ForStmt) AcceptStatements(stmts *Statements) error
- func (forStmt *ForStmt) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool)
- type FunctionCall
- type FunctionCallHolder
- type IfStmt
- type IntegerHolder
- type KnowledgeContext
- type MapVar
- type MapVarHolder
- type MathExpression
- type MathExpressionHolder
- type MethodCall
- type MethodCallHolder
- type ReturnStatement
- type RuleContent
- type RuleEntity
- type SourceCode
- type Statement
- func (s *Statement) AcceptAssignment(assignment *Assignment) error
- func (s *Statement) AcceptFunctionCall(funcCall *FunctionCall) error
- func (s *Statement) AcceptMethodCall(methodCall *MethodCall) error
- func (s *Statement) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
- func (s *Statement) Evaluate(dc *context.DataContext, Vars map[string]reflect.Value) (reflect.Value, error, bool)
- type Statements
- type StatementsHolder
- type StringHolder
- type ThreeLevelCall
- type ThreeLevelCallHolder
- type VariableHolder
Constants ¶
This section is empty.
Variables ¶
View Source
var BREAKFLAG = errors.New("break")
View Source
var CONTINUEFLAG = errors.New("break")
View Source
var TypeMap = map[string]string{
"int": "int",
"int8": "int8",
"int16": "int16",
"int32": "int32",
"int64": "int64",
"uint": "uint",
"uint8": "uint8",
"uint16": "uint16",
"uint32": "uint32",
"uint64": "uint64",
"float32": "float32",
"float64": "float64",
"decimal.Decimal": "decimal.Decimal",
}
Functions ¶
This section is empty.
Types ¶
type Arg ¶
type Arg struct { Constant *Constant Variable string FunctionCall *FunctionCall MethodCall *MethodCall ThreeLevelCall *ThreeLevelCall MapVar *MapVar Expression *Expression }
type Args ¶
type Args struct {
ArgList []*Arg
}
func (*Args) AcceptConstant ¶
func (*Args) AcceptExpression ¶
func (as *Args) AcceptExpression(exp *Expression) error
func (*Args) AcceptFunctionCall ¶
func (as *Args) AcceptFunctionCall(funcCall *FunctionCall) error
func (*Args) AcceptMapVar ¶
func (*Args) AcceptMethodCall ¶
func (as *Args) AcceptMethodCall(methodCall *MethodCall) error
func (*Args) AcceptThreeLevelCall ¶
func (as *Args) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
func (*Args) AcceptVariable ¶
type ArgsHolder ¶
type Assignment ¶
type Assignment struct { SourceCode Variable string MapVar *MapVar AssignOperator string MathExpression *MathExpression Expression *Expression }
:= or =
func (*Assignment) AcceptExpression ¶
func (a *Assignment) AcceptExpression(exp *Expression) error
func (*Assignment) AcceptMapVar ¶
func (a *Assignment) AcceptMapVar(mapVar *MapVar) error
func (*Assignment) AcceptMathExpression ¶
func (a *Assignment) AcceptMathExpression(me *MathExpression) error
func (*Assignment) AcceptVariable ¶
func (a *Assignment) AcceptVariable(name string) error
type AssignmentHolder ¶
type AssignmentHolder interface {
AcceptAssignment(a *Assignment) error
}
type AtDescHolder ¶
type AtIdHolder ¶
type AtNameHolder ¶
type AtSalienceHolder ¶
type ConcStatement ¶
type ConcStatement struct { Assignments []*Assignment FunctionCalls []*FunctionCall MethodCalls []*MethodCall ThreeLevelCalls []*ThreeLevelCall }
func (*ConcStatement) AcceptAssignment ¶
func (cs *ConcStatement) AcceptAssignment(assignment *Assignment) error
func (*ConcStatement) AcceptFunctionCall ¶
func (cs *ConcStatement) AcceptFunctionCall(funcCall *FunctionCall) error
func (*ConcStatement) AcceptMethodCall ¶
func (cs *ConcStatement) AcceptMethodCall(methodCall *MethodCall) error
func (*ConcStatement) AcceptThreeLevelCall ¶
func (cs *ConcStatement) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
type Constant ¶
func (*Constant) AcceptDesc ¶
receive rule's description
func (*Constant) AcceptInteger ¶
func (*Constant) AcceptName ¶
receive rule's name
func (*Constant) AcceptSalience ¶
func (*Constant) AcceptString ¶
type ConstantHolder ¶
type ContinueStmt ¶
type ContinueStmt struct { }
type ElseIfStmt ¶
type ElseIfStmt struct { Expression *Expression StatementList *Statements }
func (*ElseIfStmt) AcceptExpression ¶
func (ef *ElseIfStmt) AcceptExpression(expr *Expression) error
func (*ElseIfStmt) AcceptStatements ¶
func (ef *ElseIfStmt) AcceptStatements(stmts *Statements) error
type ElseStmt ¶
type ElseStmt struct {
StatementList *Statements
}
func (*ElseStmt) AcceptStatements ¶
func (e *ElseStmt) AcceptStatements(stmts *Statements) error
type Expression ¶
type Expression struct { SourceCode ExpressionLeft *Expression ExpressionRight *Expression ExpressionAtom *ExpressionAtom MathExpression *MathExpression LogicalOperator string ComparisonOperator string NotOperator string }
func (*Expression) AcceptExpression ¶
func (e *Expression) AcceptExpression(expression *Expression) error
func (*Expression) AcceptExpressionAtom ¶
func (e *Expression) AcceptExpressionAtom(atom *ExpressionAtom) error
func (*Expression) AcceptMathExpression ¶
func (e *Expression) AcceptMathExpression(atom *MathExpression) error
type ExpressionAtom ¶
type ExpressionAtom struct { SourceCode Variable string Constant *Constant FunctionCall *FunctionCall MethodCall *MethodCall ThreeLevelCall *ThreeLevelCall MapVar *MapVar }
func (*ExpressionAtom) AcceptConstant ¶
func (e *ExpressionAtom) AcceptConstant(cons *Constant) error
func (*ExpressionAtom) AcceptFunctionCall ¶
func (e *ExpressionAtom) AcceptFunctionCall(funcCall *FunctionCall) error
func (*ExpressionAtom) AcceptMapVar ¶
func (e *ExpressionAtom) AcceptMapVar(mapVar *MapVar) error
func (*ExpressionAtom) AcceptMethodCall ¶
func (e *ExpressionAtom) AcceptMethodCall(methodCall *MethodCall) error
func (*ExpressionAtom) AcceptThreeLevelCall ¶
func (e *ExpressionAtom) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
func (*ExpressionAtom) AcceptVariable ¶
func (e *ExpressionAtom) AcceptVariable(name string) error
type ExpressionAtomHolder ¶
type ExpressionAtomHolder interface {
AcceptExpressionAtom(atom *ExpressionAtom) error
}
type ExpressionHolder ¶
type ExpressionHolder interface {
AcceptExpression(expression *Expression) error
}
type ForRangeStmt ¶
type ForRangeStmt struct { SourceCode StatementList *Statements // contains filtered or unexported fields }
forRane循环语法 forRange key=mapInfo{}
func (*ForRangeStmt) AcceptStatements ¶
func (forRangeStmt *ForRangeStmt) AcceptStatements(stmts *Statements) error
func (*ForRangeStmt) AcceptVariable ¶
func (forRangeStmt *ForRangeStmt) AcceptVariable(name string) error
type ForStmt ¶
type ForStmt struct { SourceCode Expression *Expression // 表达式 StatementList *Statements // 执行语句列表 Assignments []*Assignment // 赋值语句 }
for循环语法 for i=0;i<100;i+=1
func (*ForStmt) AcceptAssignment ¶
func (forStmt *ForStmt) AcceptAssignment(assignment *Assignment) error
func (*ForStmt) AcceptExpression ¶
func (forStmt *ForStmt) AcceptExpression(expr *Expression) error
func (*ForStmt) AcceptStatements ¶
func (forStmt *ForStmt) AcceptStatements(stmts *Statements) error
type FunctionCall ¶
type FunctionCall struct { SourceCode FunctionName string FunctionArgs *Args }
func (*FunctionCall) AcceptArgs ¶
func (fc *FunctionCall) AcceptArgs(funcArg *Args) error
type FunctionCallHolder ¶
type FunctionCallHolder interface {
AcceptFunctionCall(funcCall *FunctionCall) error
}
type IfStmt ¶
type IfStmt struct { Expression *Expression StatementList *Statements ElseIfStmtList []*ElseIfStmt ElseStmt *ElseStmt }
func (*IfStmt) AcceptExpression ¶
func (i *IfStmt) AcceptExpression(expr *Expression) error
func (*IfStmt) AcceptStatements ¶
func (i *IfStmt) AcceptStatements(stmts *Statements) error
type IntegerHolder ¶
type KnowledgeContext ¶
type KnowledgeContext struct { // ruleName - RuleEntity RuleEntities map[string]*RuleEntity SortRules []*RuleEntity SortRulesIndexMap map[string]int }
func NewKnowledgeContext ¶
func NewKnowledgeContext() *KnowledgeContext
func (*KnowledgeContext) ClearRules ¶
func (k *KnowledgeContext) ClearRules()
type MapVar ¶
type MapVar struct { SourceCode Name string // map name Intkey int64 // array index Strkey string // map key Varkey string // array index or map key }
support map or array
func (*MapVar) AcceptInteger ¶
func (*MapVar) AcceptString ¶
func (*MapVar) AcceptVariable ¶
type MapVarHolder ¶
type MathExpression ¶
type MathExpression struct { SourceCode MathExpressionLeft *MathExpression MathPmOperator string MathMdOperator string MathExpressionRight *MathExpression ExpressionAtom *ExpressionAtom }
func (*MathExpression) AcceptExpressionAtom ¶
func (e *MathExpression) AcceptExpressionAtom(atom *ExpressionAtom) error
func (*MathExpression) AcceptMathExpression ¶
func (e *MathExpression) AcceptMathExpression(atom *MathExpression) error
type MathExpressionHolder ¶
type MathExpressionHolder interface {
AcceptMathExpression(mh *MathExpression) error
}
type MethodCall ¶
type MethodCall struct { SourceCode MethodName string MethodArgs *Args }
func (*MethodCall) AcceptArgs ¶
func (mc *MethodCall) AcceptArgs(funcArg *Args) error
type MethodCallHolder ¶
type MethodCallHolder interface {
AcceptMethodCall(methodCall *MethodCall) error
}
type ReturnStatement ¶
type ReturnStatement struct {
Expression *Expression
}
func (*ReturnStatement) AcceptExpression ¶
func (rs *ReturnStatement) AcceptExpression(expr *Expression) error
type RuleContent ¶
type RuleContent struct {
Statements *Statements
}
func (*RuleContent) AcceptStatements ¶
func (t *RuleContent) AcceptStatements(stmts *Statements) error
type RuleEntity ¶
type RuleEntity struct { RuleName string Salience int64 RuleDescription string RuleContent *RuleContent }
func (*RuleEntity) AcceptInteger ¶
func (r *RuleEntity) AcceptInteger(val int64) error
func (*RuleEntity) AcceptString ¶
func (r *RuleEntity) AcceptString(s string) error
func (*RuleEntity) Execute ¶
func (r *RuleEntity) Execute(dc *context.DataContext) (interface{}, error, bool)
type SourceCode ¶
type Statement ¶
type Statement struct { IfStmt *IfStmt MethodCall *MethodCall FunctionCall *FunctionCall ThreeLevelCall *ThreeLevelCall Assignment *Assignment ConcStatement *ConcStatement ForStmt *ForStmt // for语句 BreakStmt *BreakStmt // break语句 ForRangeStmt *ForRangeStmt // forRange语句 ContinueStmt *ContinueStmt // continue语句 }
func (*Statement) AcceptAssignment ¶
func (s *Statement) AcceptAssignment(assignment *Assignment) error
func (*Statement) AcceptFunctionCall ¶
func (s *Statement) AcceptFunctionCall(funcCall *FunctionCall) error
func (*Statement) AcceptMethodCall ¶
func (s *Statement) AcceptMethodCall(methodCall *MethodCall) error
func (*Statement) AcceptThreeLevelCall ¶
func (s *Statement) AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
type Statements ¶
type Statements struct { StatementList []*Statement ReturnStatement *ReturnStatement }
type StatementsHolder ¶
type StatementsHolder interface {
AcceptStatements(statement *Statements) error
}
type StringHolder ¶
type ThreeLevelCall ¶
type ThreeLevelCall struct { SourceCode ThreeLevel string MethodArgs *Args }
func (*ThreeLevelCall) AcceptArgs ¶
func (tlc *ThreeLevelCall) AcceptArgs(funcArg *Args) error
type ThreeLevelCallHolder ¶
type ThreeLevelCallHolder interface {
AcceptThreeLevelCall(threeLevelCall *ThreeLevelCall) error
}
type VariableHolder ¶
Source Files ¶
- arg.go
- args.go
- args_holder.go
- assignment.go
- assignment_holder.go
- at_desc_holder.go
- at_id_holder.go
- at_name_holder.go
- at_salience_holder.go
- break_stmt.go
- code.go
- conc_statement.go
- constant.go
- constant_holder.go
- continue.go
- else_if_stmt.go
- else_stmt.go
- expression.go
- expression_atom.go
- expression_atom_holder.go
- expression_holder.go
- for_range_stmt.go
- for_stmt.go
- function_call.go
- function_call_holder.go
- if_stmt.go
- integer_holder.go
- knowledge_context.go
- map_var.go
- map_var_holder.go
- math_expression.go
- math_expression_holder.go
- method_call.go
- method_call_holder.go
- return_statment.go
- rule_content.go
- rule_entity.go
- statement.go
- statements.go
- statements_holder.go
- string_holder.go
- three_level_call.go
- three_level_call_holder.go
- variable_holder.go
Click to show internal directories.
Click to hide internal directories.