1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
6
using System.Collections.Generic;
8
namespace ICSharpCode.XamlBinding
10
public class PropertyPathTokenizer
15
public static readonly char[] ControlChars = new char[] { '.', ',', '(', ')', '[', ']', '/' };
17
PropertyPathTokenizer(string value)
23
bool NextToken(out string token)
28
switch (value[offset]) {
36
token = value[offset].ToString();
41
while (!AtEnd() && char.IsLetterOrDigit(value[offset])) {
42
text += value[offset];
56
// skip all invalid chars
57
while (!AtEnd() && !char.IsLetterOrDigit(value[offset]) && !ControlChars.Contains(value[offset]))
65
return offset >= value.Length;
68
public static IEnumerable<string> Tokenize(string value)
71
throw new ArgumentNullException("value");
73
PropertyPathTokenizer tokenizer = new PropertyPathTokenizer(value);
77
while (tokenizer.NextToken(out token))