Child pages
  • Pattern

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

1. The following pattern matches against any InstanceMethodDeclaration without parameters and a return type:
Image Modified



Captured variables:

...

2. The following pattern matches against a ClassifierType with the actual classifier specified inside an antiquotation expression and with any quantity of any type parameters:
Image Modified

Captured variables:

...

Patterns are typically used as conditions in match statements. Pattern variables can be referenced from inside of the match statement.
For example:
Image Modified
this piece of code examines a node n and checks whether it satisfies the first or the second condition. Then the statement in the corresponding (matching) block is executed. A pattern variable $name is used in a first block to print out the name of a node. In our case the node holds a variable declaration.

...