Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1589 > unrolled thread

Parsing/defining getopt style strings

Started bymtreibton@googlemail.com
First post2015-08-17 13:51 -0700
Last post2015-09-01 03:03 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.compilers


Contents

  Parsing/defining getopt style strings mtreibton@googlemail.com - 2015-08-17 13:51 -0700
    Re: Parsing/defining getopt style strings Jens Kallup <jkallup@web.de> - 2015-09-01 03:03 +0200

#1589 — Parsing/defining getopt style strings

Frommtreibton@googlemail.com
Date2015-08-17 13:51 -0700
SubjectParsing/defining getopt style strings
Message-ID<15-08-013@comp.compilers>
Hello all,

I have an existing application which uses a lot of YACC for its
configuration file.  In trying to stream-line a lot of options, and
for wider changes surrounding the application itself, I'm looking at
trying to define something in YACC which would allow to the inclusion
of getopt style strings.

Is this possible?

By getopt, I mean BSD-style getopt where there's only a single-letter
option.  Hence, in terms of what this might look like in the
configuration file itself, I was thinking:

        some_command -ab -c option some_other_option

Where you can see "-ab" in this case are just options, with "-c"
taking an "option", and then "some_other_option" being separate.

Is this even possible, I wonder?

TIA!
[Sure.  Find a copy of the 1992 lex&yacc and it was one of our examples.
You'll have to write your own yyinput routine to feed the argument strings
to the parser but that's not hard. -John]

[toc] | [next] | [standalone]


#1594

FromJens Kallup <jkallup@web.de>
Date2015-09-01 03:03 +0200
Message-ID<15-08-018@comp.compilers>
In reply to#1589
Hi,

You can do this with the "boost" libs (program_options).
www.boost.org

Hope this helps.
Jens
[Most people use getopt() from the standard C library.  That's what
it's for, after all. -John]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.compilers


csiph-web