// AcceptVariable implements Visitor
335308
func (s *numericCompilerVisitor) AcceptVariable(v tree.Variable) {
	s.err = errors.New("a variable was found in an expression - this is likely a programmer error")
}
1327520
func (l *lexer) acceptRun(valid string) bool {
	pos := l.pos
	for strings.IndexRune(valid, l.next()) >= 0 {
	}
	l.backup()
	return l.pos > pos
}
532191
func NewVariable(v interface{}) (result Variable, err error) {
	switch v := reflect.ValueOf(v); v.Kind() {
	case reflect.String:
		result.Type = TypeString
	default:
		err = fmt.Errorf("Unknown type: %s", v.Kind())
	}

	result.Value = v
	return
}
615843
func (sv *StringVisitor) AcceptNumericLiteral(v NumericLiteral) {
	sv.result += fmt.Sprintf("%d", v.Value)
}
1053076
func (v *ContentEncryptionAlgorithm) Accept(value interface{}) error {
	var tmp ContentEncryptionAlgorithm
	switch x := value.(type) {
	case string:
		tmp = ContentEncryptionAlgorithm(x)
	case ContentEncryptionAlgorithm:
		tmp = x
	default:
		return errors.Errorf(`invalid type for jwa.ContentEncryptionAlgorithm: %T`, value)
	}
	switch tmp {
	case A128CBC_HS256, A128GCM, A192CBC_HS384, A192GCM, A256CBC_HS512, A256GCM:
	default:
		return errors.Errorf(`invalid jwa.ContentEncryptionAlgorithm value`)
	}

	*v = tmp
	return nil
}
530850
func (t *typeChecker) AcceptBinaryNegation(v tree.BinaryNegation) {
	if t.expectBoolean {
		t.result = fmt.Errorf("expected boolean expression but found: %s", tree.ExpressionString(v))
		return
	}

	res := typeCheckExpectingNumeric(v.Operand)
	if res != nil {
		t.result = res
	}
}
1171436
func (n *Conditional) Accept(v Visitor) Node {
	n.CondExpr = n.CondExpr.Accept(v)
	n.TrueExpr = n.TrueExpr.Accept(v)
	n.FalseExpr = n.FalseExpr.Accept(v)

	return v(n)
}
1318308
func (s *VariableService) UpdateVariable(ctx context.Context, id influxdb.ID, upd *influxdb.VariableUpdate) (*influxdb.Variable, error) {
	m, err := s.FindVariableByID(ctx, id)
	if err != nil {
		return nil, err
	}

	if err := authorizeWriteVariable(ctx, m.OrganizationID, id); err != nil {
		return nil, err
	}

	return s.s.UpdateVariable(ctx, id, upd)
}
830604
func SetVariable(id string, v int64) {
	monitor.RLock()
	defer monitor.RUnlock()
	monitor.backend().SetVariable(id, v)
}
849142
func (n *ValuesExpr) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*ValuesExpr)
	node, ok := n.Column.Accept(v)
	if !ok {
		return n, false
	}
	n.Column = node.(*ColumnNameExpr)
	return v.Leave(n)
}
318080
func BindVariableToValue(bv *querypb.BindVariable) (Value, error) {
	if bv.Type == querypb.Type_TUPLE {
		return NULL, errors.New("cannot convert a TUPLE bind var into a value")
	}
	return MakeTrusted(bv.Type, bv.Value), nil
}
795278
func (n *SetStmt) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*SetStmt)
	for i, val := range n.Variables {
		node, ok := val.Accept(v)
		if !ok {
			return n, false
		}
		n.Variables[i] = node.(*VariableAssignment)
	}
	return v.Leave(n)
}
701539
func (s *Service) UpdateVariable(ctx context.Context, id platform.ID, update *platform.VariableUpdate) (*platform.Variable, error) {
	op := OpPrefix + platform.OpUpdateVariable
	variable, err := s.FindVariableByID(ctx, id)
	if err != nil {
		return nil, &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	if err := update.Apply(variable); err != nil {
		return nil, &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	if err := s.ReplaceVariable(ctx, variable); err != nil {
		return nil, &platform.Error{
			Op:  op,
			Err: err,
		}
	}

	return variable, nil
}
610016
func (n *TableSource) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*TableSource)
	node, ok := n.Source.Accept(v)
	if !ok {
		return n, false
	}
	n.Source = node.(ResultSetNode)
	return v.Leave(n)
}
238349
func (b *stdBackend) ReadVariable(id string) (StaySetVariable, error) {
	resp, err := b.command(cmdStaySetVariableRead, id)
	if err != nil {
		return nil, err
	}
	return resp.(StaySetVariable), nil
}
338737
func (s *VariableService) CreateVariable(ctx context.Context, m *influxdb.Variable) error {
	p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.VariablesResourceType, m.OrganizationID)
	if err != nil {
		return err
	}

	if err := IsAllowed(ctx, *p); err != nil {
		return err
	}

	return s.s.CreateVariable(ctx, m)
}
981348
func BytesBindVariable(v []byte) *querypb.BindVariable {
	return &querypb.BindVariable{Type: VarBinary, Value: v}
}