For example, you can search for assignments of the value 1234 to a variable named myVar
with:
This will find the assignments even if the code is formatted with whiteSpaceor comments or both.
myVar := 1234
` (backquote) character.
Immediately following the ` character, other character can be entered to specify
what type of node this meta-variable can match.
After all the special character have been entered, you must then enter a valid variable name.
@ - list
When applied to a keyword in a message, it will match a list of keyword messages (i.e., any message send)
When applied with a statement character, it will match a list of statements
For example:
matches list of temps
| `@Temps |
matches list of statements
`@.Statements
matches any message node, literal node or block node
`@object
matches any message sent to
foo `@message: `@args
foo.
. - statement
For example:
matches a single statement
`.Statement
# - literal
For example:
matches any literal (
`#literal
#(), #foo, 1, etc.)
` (backquote) - recurse into
`@object foo
matches a foo message sent to any expression on the outer level.
However, the code "self foo foo" will be matched only once.
In contrast,
``@object foo
also matches foo sent to any object,
plus for each match found, it will look for more matches in the ``@object part.
Thus, this will match twice for the "self foo foo" example.
at:put: being sent to the Smalltalk-global,
with a variables value as argument,
use
Smalltalk at:`key put:`val
the above does not match for literal values or expression values as argument(s).
Smalltalk at:`@key put:`@val
to even look into the argument and look for sends there too,
use:
Smalltalk at:``@key put:``@val
To search for any message send:
``@rec `@msg: ``@args
To search for exception handlers:
``@rec on: ``@arg1 do: ``@arg2
and:
``@rec handle: ``@arg1 do: ``@arg2
or, for a particular class:
StreamError handle: ``@arg1 do: ``@arg2
Copyright © Claus Gittinger Development & Consulting, all rights reserved