[fpc-devel] New feature discussion: for-in loop
Alexander Klenin
klenin at gmail.com
Tue Oct 20 11:33:15 CEST 2009
On Tue, Oct 20, 2009 at 20:29, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> On 20/10/2009, Alexander Klenin <klenin at gmail.com> wrote:
>> Hm. I can not see where lookahead aka peeking
>> is required in using any of the enumerators you mention.
>> UTF8String enumerator is even among the samples on the wiki page.
>>
>
> I just completed a parser for a custom RichText component I wrote for
> fpGUI Toolkit. This will probably apply to HTML, XML etc as well. Say
> you have the following string
>
> "Hello <b>World</b>!:
>
> When I parse that and I get the the "<" characters, I peak ahead to
> see if I am working with a actual styling tag, or if I am working with
> the actual "<" character in the contents. So when I tokenize that
> string, with the help of "peak ahead" I know what token type to set.
The iterator itself have to look ahead, yes, but this should be hidden
from the caller -- i.e. the user of HTMLIterator have no need to know that the
iterators looks ahead.
> Please pay more attention to the wiki article! :-) Neither "reverse
> Enumerators" nor "reverseEnumerators" are text in the for-in loop wiki
> page. At least that is what Firefox tells me when I do a Find.
Ok, ok, I did not mean to search a literal string, just the topic.
--
Alexander S. Klenin
More information about the fpc-devel
mailing list