Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Pascal Форум Информер Страны мира
   Разбор и Анализ Строк    >>    rpl60
   
 
 RPL 1.21.60b - Pattern Replacer [TP6]  Steve Whalen 01.01.93

Утилита для поиска и замены частей текста на основе регулярных выражений.
Text replace utility based on regular expressions and pattern matching algorithms.



40k 
 

---------------------------------------- TurboPower Utilities Programmer's Manual RPL Utility ---------------------------------------- Copyright (C) 1985 TurboPower Software. All Rights Reserved. 1. Introduction RPL is based on the pattern matching algorithms presented in the book "Software Tools in Pascal". However, we have significantly extended the capabilities of the tools presented there, and have also used more of the powerful data structures available in Pascal to improve the performance of the program. We are very interested in hearing of any general purpose match/replace expressions that you develop using RPL. 2. Algorithms For a basic introduction to regular expressions or pattern matching algorithms we direct you to the references given in section 6. RPL uses a record and pointer-based approach to storing regular expressions. The following type declarations are key to all of the operations of RPL. TYPE longstring = string[255]; tokens = (tnil, tlitchar, tccl, tnccl, tclosure, tmaybeone, tany, tbol, teol, tgroup, tbtag, tetag, tditto); patptr = ^patrecord; sptr = ^longstring; patrecord = RECORD tok : tokens; one : Char; nextok : Boolean; strptr : sptr; nestptr, next : patptr; END; Each regular expression used by RPL is stored internally as a linked list of PATRECORDs. The function of each record is described by the .TOK field of the record. The most straightforward function for one of these records is the TLITCHAR token type. This indicates that the record will match a single literal character, and that character is stored in the .ONE field of the record. The record fields perform the following functions: TOK - a scalar type that classifies the function of this regular expression token. ONE - a single character, only used when the token