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(); }
/// <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; }
/// <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; }
static bool IsTryMarker( Step step ) { return step.description == TryMarker; }
/// <summary> /// Returns true if the specified step is a function call scope marker. /// </summary> public static bool IsScopeMarker( Step s ) { return s.description == ScopeMarker; }
/// <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 ); }
/// <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 ); }
/// <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 ); }
/// <summary> /// Push a single action onto the step stack. /// </summary> public void pushAction( Step action ) { _stack.Push( action ); }
/// <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; }