Prev | Current Page 1150 | Next

Bryan Costales, Claus Assmann, George Jansen, Gregory Shapiro

"sendmail, 4th Edition"

zzz and
an LHS of:
$+.$+
The first $+ matches only a single token (xxx) but the second $+ matches three (yyy, a
dot, and zzz). This is because the first $+ matches the minimum number of tokens
that it can while still allowing the whole LHS to match the workspace. Shortly, when
we discuss the RHS, we??™ll show why this is important.
18.6.2 Backup and Retry
Multiple token-matching operators, such as $*, always try to matchth e fewest number
of tokens that they can. Such a simple-minded approach could lead to problems
in matching (or not matching) classes in the LHS. For example, consider the following
five tokens in the workspace:
A . B . C
given the following LHS rule:
R $+ . $=X $*
Because the $+ tries to match the minimum number of tokens, it first matches only
the A in the workspace. The $=X then tries to match the B to the class X. If this match
fails, sendmail backs up and tries again.
The third time through, the $+ matches the A.B, and the $=X tries to matchth e C in
the workspace. If C is not in the class X, the entire LHS fails.
The ability of the sendmail program to back up and retry LHS matches eliminates
much of the ambiguity from rule design. The multitoken matching operators try to
match the minimum but match more if necessary for the whole LHS to match.
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc.


Pages:
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162
doktorat lampy ogrodowe określić zakłady bukmacherskie Wczasy nad morzem