Beispiel #1
0
        private ExpressionTokens TakeSetTokens(IList <ExpressionToken> Tokens, Boolean RemoveTakenTokens = true)
        {
            ExpressionTokens result = null;

            if (Tokens.Count >= 2)
            {
                if (Tokens.Any(t => t.TokenType == TokenType.EQUAL_OPERATOR))
                {
                    for (var i = 0; i < Tokens.Count; i++)
                    {
                        ExpressionToken token = Tokens[i];

                        if (token.TokenType == TokenType.EQUAL_OPERATOR)
                        {
                            if (RemoveTakenTokens)
                            {
                                Tokens.RemoveAt(i);
                            }
                            break;
                        }

                        if (result == null)
                        {
                            result = new ExpressionTokens();
                        }
                        result.Add(token.Clone());

                        if (RemoveTakenTokens)
                        {
                            Tokens.RemoveAt(i);
                            i--;
                        }
                    }
                }
            }
            return(result);
        }