>Beware though that if you have enum items set {"da","moo"} and
>supply a string "dada" or "mooable", no error is returned. You'll
>have to test the if the remaining string is empty. But even when
>doing that it might not be wise to rely on enum item sets such
>as {"bah","ba"} to lead to non-ambiguous results. Given an
>input of "bah", result "bah" or result "ba" with remainder "h"
>are both reasonable, though it seems to do the former.

I handle this problem via the case structure's Default case.  With string
driven state machines, my default case is always "invalid case."  If a
string does not exactly match the state names, the structure executes the
default case ("invalid case") which generates an error and gives the
invalid string.  I find this very helpful for debugging as well.

Paul Brown


Reply via email to