Exemplo n.º 1
0
        public State()
        {
            _stack = new Stack<Step>();
            _prevStep = null;

            _resultStack = new Stack<object>();

            _constScope = new ConstScope( null );
            _lookupScope = new LookupScope( _constScope );
            _rootScope = new StandardScope( _lookupScope );

            _baggage = new StandardScope();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns true if this step represents the marker that ends the whole while loop.
 /// </summary>
 public static bool IsLoopMarker( Step step )
 {
     return step.description == LoopMarker;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns true if this step represents the marker that will start a new loop iteration.
 /// </summary>
 /// <remarks>The marker itself should be left on.</remarks>
 public static bool IsBlockMarker( Step step )
 {
     return step.description == BlockMarker;
 }
Exemplo n.º 4
0
 static bool IsTryMarker( Step step )
 {
     return step.description == TryMarker;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Returns true if the specified step is a function call scope marker.
 /// </summary>
 public static bool IsScopeMarker( Step s )
 {
     return s.description == ScopeMarker;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Push a set of actions onto the step stack. They are pushed in order.
 /// </summary>
 public void pushActions( Step[] actions )
 {
     foreach( Step a in actions )
     _stack.Push( a );
 }
Exemplo n.º 7
0
 /// <summary>
 /// Push a single action onto the step stack, creating a new security context.
 /// </summary>
 public void pushActionAndSecurityContext( Step action, ISecurityContext context )
 {
     action.securityContext = context;
     action.description = "security context: {0}".FormatI( context.name );
     _stack.Push( action );
 }
Exemplo n.º 8
0
 /// <summary>
 /// Push a single action onto the step stack, creating a new variable scope.
 /// </summary>
 public void pushActionAndScope( Step action, IScope scope )
 {
     action.scope = scope;
     _stack.Push( action );
 }
Exemplo n.º 9
0
 /// <summary>
 /// Push a single action onto the step stack.
 /// </summary>
 public void pushAction( Step action )
 {
     _stack.Push( action );
 }
Exemplo n.º 10
0
 /// <summary>
 /// Pop a single action from the step stack.
 /// </summary>
 public Step popAction()
 {
     if( !_stack.Any() )
     throw new InvalidOperationException( "Action stack is empty" );
     _prevStep = _stack.Pop();
     return _prevStep;
 }