private void NAppendValue(FuzzyLogicNonNumericValue value, StrongIdentifierValue holder)
        {
#if DEBUG
            //Log($"value = {value}");
#endif

            var name = value.Name;

            if (_valuesDict.ContainsKey(name))
            {
                var dict = _valuesDict[name];

                if (dict.ContainsKey(holder))
                {
                    var targetList = dict[holder];

#if DEBUG
                    //Log($"dict[holder].Count = {dict[holder].Count}");
                    //Log($"targetList = {targetList.WriteListToString()}");
#endif
                    var targetLongConditionalHashCode = value.GetLongConditionalHashCode();

#if DEBUG
                    //Log($"targetLongConditionalHashCode = {targetLongConditionalHashCode}");
#endif

                    var itemsWithTheSameLongConditionalHashCodeList = targetList.Where(p => p.GetLongConditionalHashCode() == targetLongConditionalHashCode).ToList();

#if DEBUG
                    //Log($"itemsWithTheSameLongConditionalHashCodeList = {itemsWithTheSameLongConditionalHashCodeList.WriteListToString()}");
#endif

                    foreach (var itemWithTheSameLongConditionalHashCode in itemsWithTheSameLongConditionalHashCodeList)
                    {
                        targetList.Remove(itemWithTheSameLongConditionalHashCode);
                    }

                    targetList.Add(value);
                }
                else
                {
                    dict[holder] = new List <FuzzyLogicNonNumericValue>()
                    {
                        value
                    };
                }
            }
            else
            {
                var dict = new Dictionary <StrongIdentifierValue, List <FuzzyLogicNonNumericValue> >();
                dict[holder] = new List <FuzzyLogicNonNumericValue>()
                {
                    value
                };
                _valuesDict[name] = dict;
            }
        }
 private void GetTermName()
 {
     _nameOfPredefinedMembershipFunction       = string.Empty;
     _parametersOfPredefinedMembershipFunction = null;
     _currentFuzzyLogicNonNumericValue         = new FuzzyLogicNonNumericValue();
     _linguisticVariable.Values.Add(_currentFuzzyLogicNonNumericValue);
     _currentFuzzyLogicNonNumericValue.Parent = _linguisticVariable;
     _currentFuzzyLogicNonNumericValue.Name   = ParseName(_currToken.Content);
     _state = State.GotTermName;
 }
        /// <inheritdoc/>
        protected override void OnRun()
        {
#if DEBUG
            //Log($"_state = {_state}");
            //Log($"_currToken = {_currToken}");
            //Log($"Result = {Result}");
#endif

            switch (_state)
            {
            case State.Init:
                switch (_currToken.KeyWordTokenKind)
                {
                case KeyWordTokenKind.LinguisticVariable:
                    _state = State.GotLinguisticVariableMark;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotLinguisticVariableMark:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                case TokenKind.Identifier:
                    var name = ParseName(_currToken.Content);
                    Result.Name = name;
                    _linguisticVariable.Name = name;
                    _state = State.GotName;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotName:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                    switch (_currToken.KeyWordTokenKind)
                    {
                    case KeyWordTokenKind.For:
                        _state = State.GotFor;
                        break;

                    default:
                        throw new UnexpectedTokenException(_currToken);
                    }
                    break;

                case TokenKind.OpenFigureBracket:
                    _state = State.InContent;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotFor:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                    switch (_currToken.KeyWordTokenKind)
                    {
                    case KeyWordTokenKind.Range:
                    {
                        _context.Recovery(_currToken);

                        var parser = new InlineRangeParser(_context);
                        parser.Run();

#if DEBUG
                        //Log($"parser.Result = {parser.Result}");
#endif

                        _linguisticVariable.Range = parser.Result;
                        _state = State.GotRange;
                    }
                    break;

                    default:
                        throw new UnexpectedTokenException(_currToken);
                    }
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotRange:
                switch (_currToken.TokenKind)
                {
                case TokenKind.OpenFigureBracket:
                    _state = State.InContent;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.InContent:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Identifier:
                    _context.Recovery(_currToken);
                    _state = State.WaitTerm;
                    break;

                case TokenKind.Word:
                    switch (_currToken.KeyWordTokenKind)
                    {
                    case KeyWordTokenKind.Terms:
                    {
                        var nextToken = _context.GetToken();

#if DEBUG
                        //Log($"nextToken = {nextToken}");
#endif

                        if (nextToken.TokenKind == TokenKind.Colon)
                        {
                            _state = State.WaitTerm;
                            break;
                        }

                        _context.Recovery(_currToken);
                        _context.Recovery(nextToken);
                        _state = State.WaitTerm;
                    }
                    break;

                    case KeyWordTokenKind.Constraints:
                    {
                        var nextToken = _context.GetToken();

#if DEBUG
                        //Log($"nextToken = {nextToken}");
#endif

                        if (nextToken.TokenKind == TokenKind.Colon)
                        {
                            _state = State.WaitConstraint;
                            break;
                        }

                        _context.Recovery(_currToken);
                        _context.Recovery(nextToken);
                        _state = State.WaitTerm;
                    }
                    break;


                    default:
                        _context.Recovery(_currToken);
                        _state = State.WaitTerm;
                        break;
                    }
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.WaitTerm:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                    switch (_currToken.KeyWordTokenKind)
                    {
                    case KeyWordTokenKind.Constraints:
                    {
                        var nextToken = _context.GetToken();

#if DEBUG
                        //Log($"nextToken = {nextToken}");
#endif

                        if (nextToken.TokenKind == TokenKind.Colon)
                        {
                            _state = State.WaitConstraint;
                            break;
                        }

                        _context.Recovery(_currToken);
                        _context.Recovery(nextToken);
                        _state = State.WaitTerm;
                    }
                    break;

                    default:
                        GetTermName();
                        break;
                    }
                    break;

                case TokenKind.Identifier:
                    GetTermName();
                    break;

                case TokenKind.CloseFigureBracket:
                    Exit();
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotTermName:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Assign:
                    _state = State.WaitPredefinedMembershipFunction;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.WaitPredefinedMembershipFunction:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                case TokenKind.Identifier:
                    _nameOfPredefinedMembershipFunction = _currToken.Content;
                    _state = State.GotNameOfPredefinedMembershipFunction;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotNameOfPredefinedMembershipFunction:
                switch (_currToken.TokenKind)
                {
                case TokenKind.OpenRoundBracket:
                    _parametersOfPredefinedMembershipFunction = new List <NumberValue>();
                    _state = State.WaitForParameterOfMembershipFunction;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.WaitForParameterOfMembershipFunction:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Number:
                {
                    _context.Recovery(_currToken);
                    var parser = new NumberParser(_context);
                    parser.Run();

#if DEBUG
                    //Log($"parser.Result = {parser.Result}");
#endif

                    _parametersOfPredefinedMembershipFunction.Add(parser.Result.AsNumberValue);

                    _state = State.GotParameterOfMembershipFunction;
                }
                break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotParameterOfMembershipFunction:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Comma:
                    _state = State.WaitForParameterOfMembershipFunction;
                    break;

                case TokenKind.CloseRoundBracket:
                    _currentFuzzyLogicNonNumericValue.Handler = CreateMembershipPredefinedHandler();

#if DEBUG
                    //Log($"_currentFuzzyLogicNonNumericValue = {_currentFuzzyLogicNonNumericValue}");
#endif

                    _state = State.GotPredefinedMembershipFunction;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotPredefinedMembershipFunction:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Semicolon:
                    _nameOfPredefinedMembershipFunction       = string.Empty;
                    _parametersOfPredefinedMembershipFunction = null;
                    _currentFuzzyLogicNonNumericValue         = null;
                    _state = State.WaitTerm;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.WaitConstraint:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                    switch (_currToken.KeyWordTokenKind)
                    {
                    case KeyWordTokenKind.For:
                        _currentConstraintItem = new LinguisticVariableConstraintItem();
                        _linguisticVariable.Constraint.AddItem(_currentConstraintItem);
                        _state = State.GotConstraintFor;
                        break;

                    case KeyWordTokenKind.Terms:
                    {
                        var nextToken = _context.GetToken();

#if DEBUG
                        //Log($"nextToken = {nextToken}");
#endif

                        if (nextToken.TokenKind == TokenKind.Colon)
                        {
                            _state = State.WaitTerm;
                            break;
                        }

                        throw new UnexpectedTokenException(_currToken);
                    }

                    default:
                        throw new UnexpectedTokenException(_currToken);
                    }
                    break;

                case TokenKind.CloseFigureBracket:
                    Exit();
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotConstraintFor:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                    switch (_currToken.KeyWordTokenKind)
                    {
                    case KeyWordTokenKind.Relation:
                        _currentConstraintItem.Kind = KindOfLinguisticVariableConstraintItem.Relation;
                        _state = State.GotConstraintRelationMark;
                        break;

                    case KeyWordTokenKind.Inheritance:
                        _currentConstraintItem.Kind = KindOfLinguisticVariableConstraintItem.Inheritance;
                        _state = State.GotConstraintInheritanceMark;
                        break;

                    default:
                        throw new UnexpectedTokenException(_currToken);
                    }
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotConstraintRelationMark:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Word:
                    _currentConstraintItem.RelationName = ParseName(_currToken.Content);
                    _state = State.GotConstraintRelationName;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotConstraintRelationName:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Semicolon:
                    _state = State.WaitConstraint;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            case State.GotConstraintInheritanceMark:
                switch (_currToken.TokenKind)
                {
                case TokenKind.Semicolon:
                    _state = State.WaitConstraint;
                    break;

                default:
                    throw new UnexpectedTokenException(_currToken);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(_state), _state, null);
            }
        }