Am 05.08.2011 16:39, schrieb Alexander Klenin:
On Sat, Aug 6, 2011 at 01:26, Sven Barth<[email protected]> wrote:
Am 05.08.2011 15:06, schrieb Marco van de Voort:
On Fri, Aug 05, 2011 at 08:55:39AM +0000, Mark Morgan Lloyd wrote:
A few months ago I was reading lots of SNMP MIBs (sming format), and
wrote a parser using a Meta-2 derivative. However in the general case,
and particularly for line-oriented input, it's probably a job for either
regexes or an (as yet unwritten) equivalent to format() etc. However,
error recovery (when a line departs from the accepted format part-way
through) is not going to be easy.
sscanf's like constructs are also a possibility. ARRAY OF CONST is strong
enough to implement it.
And there seems to be already a starting point:
http://www.freepascal.org/docs-html/rtl/sysutils/sscanf.html
It is based on "array of pointer", not "array of const".
I have no doubts that the former is possible -- my question was about
the latter.
That's why I said "starting point" ^^
Anyway, good find -- original poster might find this procedure useable.
Might not as you can't use length and precision declarators as with
Format. And especially the first one would be what the original poster
needs.
Also someone already has implemented a scanf port for Delphi that's based on
"array of const" though the license isn't suitable for FPC:
http://reocities.com/siliconvalley/grid/9828/Delphi/scanf_d.html
This link doesnot work for me.
Huh O.o It works here. Can somebody else that link, please?
Alternatively you can try this link:
http://www.torry.net/authorsmore.php?id=1441
This seems to be a newer version (1.7 instead of 1.0), but the license
isn't mentioned anywhere there... (I haven't looked inside the download
though)
Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus