public static System.Collections.Generic.IEnumerable<System.String> ReadWord( System.String input ) {
input ??= System.String.Empty;
var inlen = input.Length;
System.Int32 start = 0;
System.Int32 stop;
do {
while ( ( start < inlen ) && System.Char.IsWhiteSpace( input[ start ] ) ) {
start++;
}
if ( start == inlen ) {
throw new System.ApplicationException();
} else if ( '(' == input[ start ] ) {
stop = ReadString( input, start );
} else {
stop = ReadWord( input, start );
}
if ( start == stop ) {
yield break;
} else {
yield return input.Substring( start, stop - start );
}
start = stop;
} while ( start < inlen );
yield break;
}
private static System.Int32 ReadWord( System.String input, System.Int32 pos ) {
var inlen = input.Length;
while ( ( pos < inlen ) && !System.Char.IsWhiteSpace( input[ pos ] ) ) {
pos++;
}
return pos;
}
private static System.Int32 ReadString( System.String input, System.Int32 pos ) {
var inlen = input.Length;
while ( ( pos < inlen ) && ( ')' != input[ pos ] ) ) {
if ( '\\' == input[ pos ] ) {
pos++;
}
pos++;
}
return ++pos;
}
Comments