← Back to README · Syntax · Using the matcher · Refactorings
pattern := FamixJavaModel % {
#'allTypes>entities' <=> FamixJavaInterface % {
#'superInheritances>superclass>name' <=> 'Remote'.
#'isStub' <~=> true.
} as: 'foundInterface'.
}.
pattern match: aFamixJavaModel.pattern := FASTJavaMethodEntity % {
#'children*' <=> FASTJavaMethodInvocation % {
#'receiver>name' <=> #'config'.
#name <=> #get.
#'arguments>primitiveValue' <=> aKey.
} as: #configInvocation
}.
pattern match: aFASTJavaMethodEntity.childrenPath := #'children*'.
receiverNamePath := #'receiver>name'.
argsVal := #'arguments>primitiveValue'.
subPattern := FASTJavaMethodInvocation % {
receiverNamePath <=> #'config'.
#name <=> #get.
argsVal <=> aKey.
} as: #configInvocation.
pattern := FASTJavaMethodEntity % {
childrenPath <=> subPattern.
}.
pattern match: aFASTJavaMethodEntity.Finds every ifTrue:ifFalse: sent in the methods of the MoTion package:
pattern := RPackage % {
#name <=> #MoTion.
#'definedClasses>methodDict' <=> CompiledMethod % {
#'ast>allChildren' <=> RBMessageNode % {
#'selector>value' <=> #ifTrue:ifFalse:
} as: #Node
} as: #Method.
} as: #Package.
pattern collectBindings: { #Node. #Method. #Package } for: #MoTion asPackage.pattern := XMLNodeList % {
#'_' <=> XMLElement % {
#'name' <=> #'div'.
} as: 'XMLElement'.
}.
pattern match: anXMLNodeList.More examples can be found in the MoTion-Tests package, and refactoring examples in Refactorings with MoTion.