예제 #1
0
파일: Memory.cs 프로젝트: Lopla/Language
        private MemoryPointer LocateByKey(VariablePointer pointer)
        {
            var d = _data.Keys
                    .FirstOrDefault(me => me.Name == pointer.Name);

            return(d);
        }
예제 #2
0
 public VariableName(ASTNode?node, IMnemonicsCompiler runtime) : base(node)
 {
     Pointer = new VariablePointer
     {
         Name = node.GetChildAndAddError(0, "LITERAL", runtime)?.Value
     };
 }
예제 #3
0
 public ValueTable(ASTNode?node, IMnemonicsCompiler runtime) : base(node)
 {
     TablePointer = new VariablePointer
     {
         Name = node
                .GetChildAndAddError(0, "variable_name", runtime)?
                .GetChildAndAddError(0, "LITERAL", runtime)?.Value
     };
     ElementPositionInTable = runtime.Get(node.Value.Children[1]);
 }
예제 #4
0
파일: Memory.cs 프로젝트: Lopla/Language
        public IValue Get(VariablePointer pointer)
        {
            var d = LocateByKey(pointer);

            if (d != null)
            {
                return(_data[d]);
            }

            return(null);
        }
예제 #5
0
파일: Memory.cs 프로젝트: Lopla/Language
        public void Set(VariablePointer pointer, IValue value)
        {
            var m = LocateByKey(pointer);

            if (m == null)
            {
                m = new MemoryPointer
                {
                    Name = pointer.Name
                };
                _data.Add(m, null);
            }

            _data[m] = value;
        }
예제 #6
0
 public DataElement Visit(VariablePointer expr)
 {
     return(_dataSet.CreateVariablePointer(expr.VariableType, expr.PointerId));
 }
예제 #7
0
 public ValueTable(ASTNode?node, VariablePointer tablePointer, Mnemonic positionInTable) : base(node)
 {
     this.TablePointer           = tablePointer;
     this.ElementPositionInTable = positionInTable;
 }
예제 #8
0
 public virtual object Visit(VariablePointer expr)
 {
     return(null);
 }