Parsing Flags
Brought to you by:
ptmcg
I am trying to get the system to generate a flag based on the results of a parsing operation. I am pretty sure I could write a wrapper and set the .setFailAction() / .setParseAction(), but I am trying to see if there is a cleaner way.
What I am trying to accomplish is to have a string that I parse, but I want to be able to report back to the user why it failed, or why it parsed it as it did, or warnings that do not generate failures...
so, with the following addresses, return the following flags:
Address | Flags |
---|---|
'dan.strohl' | ERR_NO_AT_SYMBOL, ERR_NO_DOMAIN |
'dan@strohl' | WARN_SINGLE_DOMAIN_ELEMENT, WARN_NO_TLD |
'dan@(neat name strohl).com' | CONTAINS_COMMENT, ERR_DONAIN_STARTS_WITH_DOT |
'dan@[127.0.0.1] | WARN_LOOPBACK_ADDRESS_LITERAL |
As I said, I am sure I could do something using the setFailAction that saves flags to a ceneral list, but is there a better approach?