@@ -33,8 +33,7 @@ public static IEnumerable<Token> Partition(
3333 break ;
3434
3535 case SequenceState . TokenFound :
36- //IsValueForced are tokens after --
37- if ( token . IsValue ( ) && ! token . IsValueForced ( ) )
36+ if ( token . IsValue ( ) )
3837 {
3938 if ( sequences . TryGetValue ( nameToken , out var sequence ) )
4039 {
@@ -67,16 +66,85 @@ public static IEnumerable<Token> Partition(
6766
6867 foreach ( var kvp in sequences )
6968 {
70-
7169 yield return kvp . Key ;
7270 foreach ( var value in kvp . Value )
7371 {
7472 yield return value ;
7573 }
76- }
74+ }
75+
76+ //return from tseq in tokens.Pairwise(
77+ //(f, s) =>
78+ // f.IsName() && s.IsValue()
79+ // ? typeLookup(f.Text).MapValueOrDefault(info =>
80+ // info.TargetType == TargetType.Sequence
81+ // ? new[] { f }.Concat(tokens.OfSequence(f, info))
82+ // : new Token[] { }, new Token[] { })
83+ // : new Token[] { })
84+ // from t in tseq
85+ // select t;
7786 }
7887
79-
88+ //private static IEnumerable<Token> OfSequence(this IEnumerable<Token> tokens, Token nameToken, TypeDescriptor info)
89+ //{
90+ // var state = SequenceState.TokenSearch;
91+ // var count = 0;
92+ // var max = info.MaxItems.GetValueOrDefault(int.MaxValue);
93+ // var values = max != int.MaxValue
94+ // ? new List<Token>(max)
95+ // : new List<Token>();
96+
97+ // foreach (var token in tokens)
98+ // {
99+ // if (count == max)
100+ // {
101+ // break;
102+ // }
103+
104+ // switch (state)
105+ // {
106+ // case SequenceState.TokenSearch:
107+ // if (token.IsName() && token.Text.Equals(nameToken.Text))
108+ // {
109+ // state = SequenceState.TokenFound;
110+ // }
111+ // break;
112+
113+ // case SequenceState.TokenFound:
114+ // if (token.IsValue())
115+ // {
116+ // state = SequenceState.ValueFound;
117+ // count++;
118+ // values.Add(token);
119+ // }
120+ // else
121+ // {
122+ // // Invalid to provide option without value
123+ // return Enumerable.Empty<Token>();
124+ // }
125+ // break;
126+
127+ // case SequenceState.ValueFound:
128+ // if (token.IsValue())
129+ // {
130+ // count++;
131+ // values.Add(token);
132+ // }
133+ // else if (token.IsName() && token.Text.Equals(nameToken.Text))
134+ // {
135+ // state = SequenceState.TokenFound;
136+ // }
137+ // else
138+ // {
139+ // state = SequenceState.TokenSearch;
140+ // }
141+ // break;
142+ // }
143+ // }
144+
145+ // return values;
146+ //}
147+
80148 private enum SequenceState
81149 {
82150 TokenSearch ,
0 commit comments