예제 #1
0
        public virtual void Visit(SymbolDataStore langSymbol)
        {
            if (SimpleLoggingEnabled)
            {
                Log.Append(langSymbol.SymbolAccessName);

                return;
            }

            Log.Append("{");

            Log.Append(" <Symbol: " + langSymbol.SymbolAccessName + "> ");

            if (EnableLogObjectClass)
            {
                Log.Append(" <Class: " + langSymbol.GetType().Name + "> ");
            }

            if (EnableLogSymbolRole)
            {
                Log.Append(" <Role: " + langSymbol.SymbolRoleName + "> ");
            }

            if (EnableLogSymbolType)
            {
                Log.Append(" <Type: " + langSymbol.SymbolType.TypeSignature + "> ");
            }

            Log.Append("} ");
        }
예제 #2
0
        public virtual TSymbolData GetSymbolData(SymbolDataStore symbol)
        {
            var symbolData = default(TSymbolData);

            if (ActiveAr.StaticChain.Any(record => record.TryGetSymbolData(symbol, out symbolData)))
            {
                return(symbolData);
            }

            throw new KeyNotFoundException("Data store variable " + symbol.ObjectName + " not found in static chain");
        }
예제 #3
0
        public virtual void SetSymbolData(SymbolDataStore symbol, TSymbolData symbolData)
        {
            foreach (var record in ActiveAr.StaticChain.Where(record => record.ContainsSymbol(symbol)))
            {
                record.SetSymbolData(symbol, symbolData);

                return;
            }

            throw new KeyNotFoundException("Data store variable " + symbol.ObjectName + " not found in static chain");
        }
예제 #4
0
        public bool TryGetSymbolData(SymbolDataStore symbol, out TSymbolData value)
        {
            ActivationRecordEntry <TSymbolData> entry;

            if (_variableValueDictionary.TryGetValue(symbol.ObjectName, out entry))
            {
                value = entry.SymbolData;
                return(true);
            }

            value = default(TSymbolData);
            return(false);
        }
예제 #5
0
        private LanguageValueAccess translate_StartAt_DataSymbol(SymbolDataStore startSymbol)
        {
            //Macro output parameters can only be written to (i.e. in LHS of assignment) but never read from (i.e. in RHS expression of assignment).
            if (_isLValue == false && startSymbol is SymbolProcedureParameter && ((SymbolProcedureParameter)startSymbol).DirectionOut)
            {
                return(CompilationLog.RaiseGeneratorError <LanguageValueAccess>("Cannot use output parameter" + startSymbol.ObjectName + " in RHS of an expression", RootParseNode));
            }

            if (_qualList.ActiveLength == 0)
            {
                return(LanguageValueAccess.Create(startSymbol));
            }

            if (!startSymbol.SymbolType.IsStructure())
            {
                return(CompilationLog.RaiseGeneratorError <LanguageValueAccess>("Data components not recognized", RootParseNode));
            }

            var valAccess = LanguageValueAccess.Create(startSymbol);
            var structure = (GMacStructure)startSymbol.SymbolType;

            return(translate_FollowComponentsSequence(structure, valAccess));
        }
예제 #6
0
 public virtual LanguageCommand AddCommand_Declare(SymbolDataStore dataStore)
 {
     return(AddCommand(new CommandDeclareVariable(ChildCommandBlockScope, dataStore)));
 }
예제 #7
0
 public TSymbolData GetSymbolData(SymbolDataStore symbol)
 {
     return(_variableValueDictionary[symbol.ObjectName].SymbolData);
 }
예제 #8
0
 public void SetSymbolData(SymbolDataStore symbol, TSymbolData symbolData)
 {
     _variableValueDictionary[symbol.ObjectName] = new ActivationRecordEntry <TSymbolData>(symbol, symbolData);
 }
예제 #9
0
 public void AddSymbolData(SymbolDataStore symbol, TSymbolData symbolData)
 {
     _variableValueDictionary.Add(symbol.ObjectName, new ActivationRecordEntry <TSymbolData>(symbol, symbolData));
 }
예제 #10
0
        //public void RemoveUpperStaticAR()
        //{
        //    UpperStaticAR = null;
        //}


        public bool ContainsSymbol(SymbolDataStore symbol)
        {
            return(_variableValueDictionary.ContainsKey(symbol.ObjectName));
        }
 /// <summary>
 /// Convert a value access with a root SymbolDataStore into a list of value access objects having
 /// types other than structures (i.e. primitives and multivectors only)
 /// </summary>
 /// <param name="symbol"></param>
 /// <returns></returns>
 public static IEnumerable <LanguageValueAccess> ExpandStructures(this SymbolDataStore symbol)
 {
     return(ExpandStructures(LanguageValueAccess.Create(symbol)));
 }
예제 #12
0
        public ActivationRecordEntry(SymbolDataStore symbol, T symbolData)
        {
            Symbol = symbol;

            SymbolData = symbolData;
        }
예제 #13
0
 public CommandDeclareVariable(LanguageScope parentScope, SymbolDataStore dataStore)
     : base(parentScope)
 {
     DataStore = dataStore;
 }