Put together

Top  Previous  Next

Examples > GrepUrls > Put together

 

The complete code of the Url production is:

 

"<a href=\"http://www."

SKIP

{{

m_fPosition % GetRelPath() % xState.Line();

AddPosition(xState.str(), m_fPosition.str());

}}

 

 

After the text of the URL was recognized by SKIP, it is passed to the AddPosition class method, together with the information about the position, where the address was found.

 

 

And finally the complete GrepUrls production:

 

(

Url

| SKIP

)*

{{

if ( IsLastFile() )

PrintAll();

}}

 

An important point still has to be added. The program shall print the sorted list of the Internet addresses, which were found in all files. But the sorting is only possible after all files were processed. Because of this, the PrintAll function is executed only, if this condition is fulfilled. Whether the condition is fulfilled, can be obtained from the method IsLastFile of the parse state class. IsLastFile only returns true, if no further file will follow.

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German