Tutorialstructural-search direction s-text categories r-text action respect-case




Prev | Up | Next | Back | Forward | Online Documentation Home Page
  Keys Menu
X Alt+S or Control+F5 Edit/Search...


Let direction be either forward or backward, s-text be a string, categories be a comma-separated list of syntactic categories, r-text be a string, and action be search, replace, or replace-all.

respect-case is a switch, which if on means that search will find only those strings that match the search string exactly. If off, then both upper and lower case are matched.

Search(direction, s-text, categories) first parses s-text according to each of the syntactic categories categories. If s-text does not parse as at least one of the categories, an error message is printed and no action is taken. Each successful parse determines a corresponding abstract structure. Then, starting at the current structural selection, search for the next (previous) occurrence of one of those abstract structures that is also a resting place for the structural selection. If no such occurrence is found before the end (beginning) of the buffer, an error message is printed; if the command is repeated, the search is continued at the beginning (end) of the buffer.

Replace(direction, s-text, categories, r-text) first parses both s-text and r-text according to each of the syntactic categories in categories. If s-text and r-text do not both parse as at least one of the given categories, an error message is printed and no action is taken. Each category for which s-text and r-text both parse determines a pair of corresponding abstract structures. Second, confirm that the current selection of the given buffer is an instance of one of the abstract structures corresponding to s-text and give an error message if it is not. Third, replace the selection by the abstract structure corresponding to r-text and the matched category. Fourth, search for the next occurrence of s-text, as described above, starting to the right (left) of the current selection.

Replace-all(direction, s-text, categories, r-text) first parses both s-text and r-text according to each of the syntactic categories in categories. If s-text and r-text do not both parse as at least one of the categories, an error message is printed and no action is taken. Each category for which s-text and r-text both parse determines a pair of corresponding abstract structures. Replace every occurrence in the object of one of the structures matching s-text with the corresponding structure matching r-text.


Forward