Beispiel #1
0
        private bool PopInterpolatedStringItem(InterpolatedStringStackItem item)
        {
            if (myInterpolatedStringStates.IsEmpty || !(myInterpolatedStringStates.Peek() is var state))
            {
                return(false);
            }

            if (state.InterpolatedStringStack.IsEmpty && item == InterpolatedStringStackItem.Brace)
            {
                yypushback(1);
                yybegin(ToState(myInterpolatedStringStates.Peek()));
                Clear();

                return(true);
            }

            if (state.InterpolatedStringStack.Peek() == item)
            {
                state.InterpolatedStringStack = state.InterpolatedStringStack.Pop();
                myInterpolatedStringStates    = myInterpolatedStringStates.Pop();
                myInterpolatedStringStates    = myInterpolatedStringStates.Push(state);
            }

            return(false);
        }
Beispiel #2
0
        private void PushInterpolatedStringItem(InterpolatedStringStackItem item)
        {
            if (!myInterpolatedStringStates.IsEmpty && myInterpolatedStringStates.Peek() is var state)
            {
                myInterpolatedStringStates = myInterpolatedStringStates.Pop();

                state.InterpolatedStringStack = state.InterpolatedStringStack.Push(item);
                myInterpolatedStringStates    = myInterpolatedStringStates.Push(state);
            }
        }