Menu

#14 Parsing Flags

v1.0 (example)
open
nobody
None
5
2016-02-17
2016-02-17
Dan Strohl
No

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?

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.