home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / oberon / tool / rx.tool (.txt) < prev    next >
Oberon Text  |  1977-12-31  |  3KB  |  90 lines

  1. Syntax10.Scn.Fnt
  2. ParcElems
  3. Alloc
  4. Syntax10i.Scn.Fnt
  5. Syntax12b.Scn.Fnt
  6. RX.SetSearch "F"
  7. RX.SetReplace "kr:"
  8. RX.Search
  9. RX.Replace
  10. RX.ReplaceAll
  11. RX.Grep 
  12. Search and Replace Commands
  13. RX.SetSearch [option] RegExpr
  14. Sets RegExpr as the current search pattern. 
  15. The end of RegExpr is determined by the end of the command line.
  16. Up to ten factors can be marked as subexpressions.
  17.     RegExpr        = term { "|" term }.
  18.     term            = extdfactor { extdfactor }.
  19.     extdfactor    = factor [ subexprid ].
  20.     factor        = "(" RegExpr ")" | "[" RegExpr "]" | "{ RegExpr "}"
  21.                         | ["~"] ( """ literal """ | shorthand )
  22.                         | """ literal { literal } """.
  23.     subexprid    = "X" digit.
  24.     shorthand    = "A" | "a" | "b" | "c" | "d" | "h" | "i" | "l" | "o"
  25.                         | "t" | "w".
  26.     option        = "/c".
  27. Predefined character classes and their meaning :
  28.     A        : "A" - "Z"
  29.     a        : "a" - "z"
  30.     b        : "0" - "1"
  31.     c        :  carriage return
  32.     d        : "0" - "9"
  33.     h        : "0" - "9" or "A" - "F"
  34.     l        : character classes A or a
  35.     i        : character classes l or d
  36.     o        : "0" - "7"
  37.     t        : tab
  38.     w    : tab, carriage return or blank
  39. Option c ignores the case of the letters
  40. RX.SetReplace {""" literal {literal} """ | subexprid | "t" | "c"}
  41. Defines the current replace pattern as a sequence of strings,
  42. subexpressions, tabulator or carriage return characters.
  43. RX.Search
  44. Searches the current search pattern in the focused text. Searching is started at the position of the caret. If the caret doesn't exist in the focused text, searching starts at the beginning. The command searches for the longuest pattern, matching the regular expression ( the same rule is applied to subexpressions ).
  45. RX.Replace
  46. Replaces a found regular expression by the current replace pattern and searches for the next occurence of the current search pattern.
  47. RX.ReplaceAll
  48. Repeats RX.Replace until the end of text.
  49. The Grep Command
  50. RX.Grep ( filename | "*" ) [option] RegExpr
  51. Searches in the file filename or the marked text for the regular expression
  52. RegExpr. The output will be diplayed in a seperate text viewer.
  53.     option    = "/" { "c" | "i" }.
  54. Options :
  55.     c    : Ignores the case of the letters
  56.     i    : Invert the search and displays only the lines that do not match
  57. Examples
  58. indent (non empty) lines by one tab
  59.     RX.SetSearch (~c {~c} c) X0
  60.     RX.SetReplace t X0
  61. display all procedure headers
  62.     RX.Grep Texts.Mod "PROCEDURE"
  63. generate the parameters for a System.CopyFiles or System.RenameFiles
  64. command from a directory listing
  65.     RX.SetSearch ( i {i|"."} ) X0 ".Txt"
  66.     RX.SetReplace X0 ".Txt => " X0 ".Text"
  67. replace occurrences of identifier "next" with "prev"
  68.     RX.SetSearch (~i{~i}) X0 "next" (~i{~i}) X1
  69.     RX.SetReplace X0 "prev" X1
  70. Automatic.Do
  71.     RX.SetSearch "(**"
  72.     RX.SetReplace "(**"
  73.     RX.Search
  74.     RX.ReplaceAll
  75. Automatic.Do
  76.     RX.SetSearch "(*"
  77.     RX.SetReplace "(*"
  78.     RX.Search
  79.     RX.ReplaceAll
  80. Automatic.Do
  81.     RX.SetSearch "**)"
  82.     RX.SetReplace "*)"
  83.     RX.Search
  84.     RX.ReplaceAll
  85. Automatic.Do
  86.     RX.SetSearch "*)"
  87.     RX.SetReplace "*)"
  88.     RX.Search
  89.     RX.ReplaceAll
  90.