Re: Data table text I/O package?
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: Thu, 16 Jun 2005 16:51:37 +0200
On Thu, 16 Jun 2005 16:46:39 +0200, Georg Bauhaus wrote:
> Dmitry A. Kazakov wrote:
>
>> There is a better technique to parse strings than to tokenize them first.
>> Get rid of scanner. Just take the date from the current position of the
>> string and advance the position to the first character following the date.
>> Because the procedure that gets the date knows the format it also knows
>> where the date ends. It can also support various concurrent formats,
>> provided that they are distinguishable. This way you can parse a string
>> virtually knowing nothing about the formats of its fields. An additional
>> advantage is that error messages (if it comes to a more advanced system)
>> will be pretty easy to generate.
>
> IIUC, what you describe is a (more binary) DTD, either language-standardised
> or proprietary.
>
> And also, what does the sentence "don't scan a string, and don't
> produce tokens, but advance [something] to the first character
> following the date that was taken[?] form the string" mean,
> other than a contradiction in terms?
Field_1 : Float;
Field_2 : Integer;
...
Line : String := ...; -- The current line
Pointer : Integer; -- The current position in Line
Pointer := Line'First;
Get (Line, Pointer, Delimiters); -- Skip blanks
Get (Line, Pointer, Field_1); -- Get field and move Pointer
Get (Line, Pointer, Delimiters); -- Skip blanks
Get (Line, Pointer, Field_2); -- Get field and move Pointer
...
etc
Quite trivial.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.
- Follow-Ups:
- Re: Data table text I/O package?
- From: Georg Bauhaus
- Re: Data table text I/O package?
- References:
- Data table text I/O package?
- From: Jacob Sparre Andersen
- Re: Data table text I/O package?
- From: Preben Randhol
- Re: Data table text I/O package?
- From: Jacob Sparre Andersen
- Re: Data table text I/O package?
- From: Preben Randhol
- Re: Data table text I/O package?
- From: Jacob Sparre Andersen
- Re: Data table text I/O package?
- From: Randy Brukardt
- Re: Data table text I/O package?
- From: Jacob Sparre Andersen
- Re: Data table text I/O package?
- From: Marius Amado Alves
- Re: Data table text I/O package?
- From: Georg Bauhaus
- Re: Data table text I/O package?
- From: Dmitry A. Kazakov
- Re: Data table text I/O package?
- From: Georg Bauhaus
- Data table text I/O package?
- Prev by Date: Re: Data table text I/O package?
- Next by Date: XML EZ Out 1.04 Posted
- Previous by thread: Re: Data table text I/O package?
- Next by thread: Re: Data table text I/O package?
- Index(es):
Relevant Pages
|