Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!usenet.ukfsn.org!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: regexp(ing) Backus-Naurish expressions ... Date: Sun, 10 Mar 2013 12:55:22 +0000 (UTC) Organization: UK Free Software Network Lines: 29 Message-ID: References: NNTP-Posting-Host: 84.45.235.129 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: localhost.localdomain 1362920122 20331 84.45.235.129 (10 Mar 2013 12:55:22 GMT) X-Complaints-To: usenet@localhost.localdomain NNTP-Posting-Date: Sun, 10 Mar 2013 12:55:22 +0000 (UTC) User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Xref: csiph.com comp.lang.java.programmer:22872 On Sun, 10 Mar 2013 02:27:32 +0000, qwertmonkey wrote: > I need to set up some code's running context via properties files and I > want to make sure that users don't get too playful messing with them, > because that could alter results greatly and in unexpected ways (they > must probably won't be able to make sense of and then they would bother > the hell out of you) > I wrote my own extended Java equivalent of the C getopt() function, which separates arguments from options, accepts both short form (-h) and long form (--help) and allows you to specify whether an option must never, may, or must have an associated value, which may be written as -xvalue -x value -x=value in short form or --opt=value --opt value in long form. Option validity and value presence are checked by the parser but both argument checks and option value checks are left for the calling code. This is implemented as the ArgParser class in my environ.jar library and can be found at: http://sourceforge.net/projects/cdocumenter/files/cdocumenter/ environment/ and is fully documented in javadoc comments at class and method level. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |