Ejemplo n.º 1
0
        public static Symbol For(string value)
        {
            Symbol result;
            if (Symbol.table.TryGetValue(value, out result))
                return result;

            result = new Symbol(value);
            Symbol.table.Add(value, result);
            return result;
        }
Ejemplo n.º 2
0
 public SchemeObject GetValue(Symbol key)
 {
     for (SchemeEnvironment env = this; env != null; env = env.parent)
     {
         SchemeObject value;
         if (env.dictionary.TryGetValue(key, out value))
             return value;
     }
     throw new InvalidSyntaxException();
 }
Ejemplo n.º 3
0
        public void SetValue(Symbol key, SchemeObject value, bool isDefinition)
        {
            SchemeEnvironment env = this;
            if (!isDefinition)
            {
                for (; env != null; env = env.parent)
                    if (env.dictionary.ContainsKey(key))
                        break;

                if (env == null)
                    throw new InvalidSyntaxException();
            }
            env.dictionary[key] = value;
        }
Ejemplo n.º 4
0
 public void Add(Symbol key, SchemeObject value)
 {
     this.dictionary[key] = value;
 }
Ejemplo n.º 5
0
 internal AssignmentContinuation(Symbol destination, bool isDefinition, SchemeEnvironment environment)
     : base(environment, ContinuationKind.Assignment)
 {
     this.Destination = destination;
     this.IsDefinition = isDefinition;
 }