Lukasz Sokol wrote:
On 31/07/15 14:46, Mark Morgan Lloyd wrote:
Lukasz Sokol wrote:
Hi,
I tried piecing something like in $topic together,
intended as an 'interactive' command interpreter for my program.
(which will in time grow an 'embedded' web server and intended to
run as a (windows) service, but it's too early for that at the
moment)
Looking at your question another way, I suppose that you also have the
issue of parsing a command as well as handling the data entry. I think
that there's various possibilities here depending on what you're trying
to handle:
* A simple sequence of names/numbers.
* A unix-style command line, with leading options.
* A sequence of email/HTTP headers.
* XML.
* Any of the above but with macro and/or numeric evaluation.
I note in particular that PostgreSQL uses Flex and Bison, and if they'll
parse (a fairly comprehensively extended) SQL I guess they'll parse
about anything. Apart from that I've hacked something together for my
own use based on Smalltalk (as an outer parser) with various evaluation
possibilities (as an inner parser), this was intended as a way for
programs to talk to each other and has its good points.
I'm not sure whether getopts from the RTL provides a facility for you to
feed it an arbitrary string for processing, but it would probably be a
good place to start.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal