|
|||||
Precedence of pattern operations | |||||
Prerequisite Concepts |
Parentheses must be used to change the precedence of an operation. The following list shows the precedence of all pattern operations when there are no parentheses, starting with the highest precedence:
ul
cdata
, text
, etc)
=>
)
lookahead
and lookahead !
(lookahead not
)
|
(or
)
When a lower-precedence operation is embedded within a higher-precedence operation, the precedence of pattern operations requires parentheses, as follows:
letter => id ?
is not allowed, and must be entered as (letter => id)?
.
lookahead letter | digit ! digit
is not allowed, and must be entered as lookahead (letter | digit) ! digit
.
This code sample illustrates the precedence of pattern operations:
translate "%n" digit => key-digit lookahead text letter+ space ! ul "key" "word"? | sdata "[sect]" lookahead "." ! " " | digit+ => numberIt is interpreted as if it were entered:
translate (("%n" (digit => key-digit)) lookahead ((text (letter+)) space) ! ((ul "key") ("word"?))) | ((sdata "[sect]") lookahead "." ! " ") | ((digit+) => number)
Prerequisite Concepts Pattern matching |
---- |