Exemplo n.º 1
0
 public ParsingScope(ParsingScopes parsingScopes, ParsingScope parent, RangeAddress address)
 {
     _parsingScopes = parsingScopes;
     Parent         = parent;
     Address        = address;
     ScopeId        = Guid.NewGuid();
 }
Exemplo n.º 2
0
 public ParsingScope(ParsingScopes parsingScopes, ParsingScope parent, RangeAddress address)
 {
     _parsingScopes = parsingScopes;
     Parent = parent;
     Address = address;
     ScopeId = Guid.NewGuid();
 }
 /// <summary>
 /// Removes the current scope, setting the calling scope to current.
 /// </summary>
 /// <param name="parsingScope"></param>
 public virtual void KillScope(ParsingScope parsingScope)
 {
     _scopes.Pop();
     if (_scopes.Count() == 0)
     {
         _lifetimeEventHandler.ParsingCompleted();
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Removes the current scope, setting the calling scope to current.
 /// </summary>
 /// <param name="parsingScope"></param>
 public virtual void KillScope(ParsingScope parsingScope)
 {
     _scopes.Pop();
     if (_scopes.Count() == 0)
     {
         _lifetimeEventHandler.ParsingCompleted();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a new <see cref="ParsingScope"/> and puts it on top of the stack.
 /// </summary>
 /// <param name="address"></param>
 /// <returns></returns>
 public virtual ParsingScope NewScope(RangeAddress address)
 {
     ParsingScope scope;
     if (_scopes.Count() > 0)
     {
         scope = new ParsingScope(this, _scopes.Peek(), address);
     }
     else
     {
         scope = new ParsingScope(this, address);
     }
     _scopes.Push(scope);
     return scope;
 }
        /// <summary>
        /// Creates a new <see cref="ParsingScope"/> and puts it on top of the stack.
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public virtual ParsingScope NewScope(RangeAddress address)
        {
            ParsingScope scope;

            if (_scopes.Count() > 0)
            {
                scope = new ParsingScope(this, _scopes.Peek(), address);
            }
            else
            {
                scope = new ParsingScope(this, address);
            }
            _scopes.Push(scope);
            return(scope);
        }
Exemplo n.º 7
0
 public void ScopeShouldCallKillScopeOnDispose()
 {
     var scope = new ParsingScope(_parsingScopes, _factory.Create("A1"));
     ((IDisposable)scope).Dispose();
     _parsingScopes.AssertWasCalled(x => x.KillScope(scope));
 }
Exemplo n.º 8
0
 public void ConstructorShouldSetParent()
 {
     var parent = new ParsingScope(_parsingScopes, _factory.Create("A1"));
     var scope = new ParsingScope(_parsingScopes, parent, _factory.Create("A2"));
     Assert.AreEqual(parent, scope.Parent);
 }
Exemplo n.º 9
0
 public void ConstructorShouldSetAddress()
 {
     var expectedAddress =  _factory.Create("A1");
     var scope = new ParsingScope(_parsingScopes, expectedAddress);
     Assert.AreEqual(expectedAddress, scope.Address);
 }
Exemplo n.º 10
0
 public void Setup()
 {
     _parsingContext = ParsingContext.Create();
     _scope = _parsingContext.Scopes.NewScope(RangeAddress.Empty);
 }