[fpc-pascal] Re: Parsing parameters inside an interpreter
Jorge Aldo G. de F. Junior
jagfj80 at gmail.com
Mon May 14 14:23:27 CEST 2012
I have a parser function somewhere around that can do more than
that... let me find it...
2012/5/14 Lukasz Sokol <el.es.cr at gmail.com>:
> On 14/05/2012 10:39, Lukasz Sokol wrote:
>> On 13/05/2012 11:20, luciano de souza wrote:
>>> Hello all,
>>> I trying to build a very small interpreter. I can type commands
>>> $ add "Luciano de Souza"
>>> luchyanus at gmail.com
>>> Somewhere in my code, I can have something like:
>>> procedure parse(commandline: string; var params: array of string);
>>> In this case, the commandline has the format: "add %s %s". So I would
>>> parse('add "Luciano de Souza"
>>> luchyanus at gmail.com', params);
>>> After this command, the parameter would have the following values:
>>> params := 'add'; params := 'Luciano de Souza'; params :=
>>> 'luchyanus at gmail.com';
>>> My question is: there is a way to do it easily using a standard
>>> class of Freepascal?
>> In my 'poor-mans interpreter' I use and pass around TStringList's
>> quite a lot; although some special treatment of the string
>> is required, to preserve spaces within parameter strings.
> Or use StrictDelimiter := False like Ludo suggested :)))
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
More information about the fpc-pascal