Beispiel #1
0
 private State(VM vm, RantPattern derivedSource, IEnumerable <Token <R> > tokens,
               ChannelStack output)
 {
     Output       = output;
     Reader       = new PatternReader(new RantPattern(derivedSource, tokens));
     SharesOutput = (output == vm._output && vm.PrevState != null) || (vm._stateStack.Any() && output == vm._stateStack.Peek().Output);
 }
Beispiel #2
0
 public State(VM vm, RantPattern source, ChannelStack output)
 {
     Output       = output;
     Reader       = new PatternReader(source);
     SharesOutput = (output == vm._output && vm.PrevState != null) || (vm._stateStack.Any() && output == vm._stateStack.Peek().Output);
 }
Beispiel #3
0
            /// <summary>
            /// Creates a state object that reads tokens from a custom collection that is associated with the specified source. Specifying an output that is distinct from the one below it in the stack will cause the output to be pushed to the result stack when finished.
            /// </summary>
            /// <param name="derivedSource">The source with which to associate the tokens.</param>
            /// <param name="tokens">The tokens to read.</param>
            /// <param name="interpreter">The interpreter that will read the tokens.</param>
            /// <param name="output">The output of the state. Excluding this will create a new output.</param>
            /// <returns></returns>

            public static State CreateSub(RantPattern derivedSource, IEnumerable <Token <R> > tokens,
                                          VM interpreter, ChannelStack output = null)
            {
                return(new State(interpreter, derivedSource, tokens, output ?? new ChannelStack(interpreter.Format, interpreter.CharLimit)));
            }