/* * EliasDB * * Copyright 2016 Matthias Ladkau. All rights reserved. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* Package interpreter contains the ECAL interpreter. */ package interpreter import ( "sync" "devt.de/krotik/common/lang/ecal/parser" ) // TODO: Scope with value buckets which can be read only - auto provide access to parent scopes /* DataBucket models a storage bucket for data. */ type DataBucket struct { data interface{} // Data of this bucket canWrite bool // Flag if data can be written to this bucket } /* Scope models an ECAL scope. It is used to store variable data. */ type Scope struct { name string // Name of the scope parent *Scope // Parent scope storage map[string]*DataBucket // Storage for variables lock sync.RWMutex // Lock for this scope } /* NewChild creates a new child scope. */ func (s *Scope) NewChild(name string) parser.VarsScope { return nil } /* SetValue sets a new value for a variable. */ func (s *Scope) SetValue(varName string, varValue interface{}) error { return nil } /* GetValue gets the current value of a variable. */ func (s *Scope) GetValue(varName string) (interface{}, bool, error) { return nil, false, nil } /* String returns a string representation of this variable scope. */ func (s *Scope) String() string { return "" }