2012-05-22 05:17:33 +03:00
|
|
|
FN=DNP { ignore }
|
|
|
|
|
2012-05-22 19:01:39 +03:00
|
|
|
FN=X(*) { $=$1 }
|
|
|
|
|
2012-05-22 21:29:27 +03:00
|
|
|
/* iteration demo */
|
|
|
|
FOO=abcde
|
|
|
|
BAR=x /* BAR= wouldn't be syntactically correct. We need a non-empty value */
|
|
|
|
FOO=(*)(?) {
|
|
|
|
BAR=$BAR$2
|
|
|
|
FOO=$1
|
|
|
|
again FOO
|
|
|
|
}
|
|
|
|
BAR=x(*) { $=$1 } /* remove the "x" */
|
|
|
|
|
2012-05-20 17:18:18 +03:00
|
|
|
REF=R[0-9]* {
|
|
|
|
T=R
|
2012-05-21 03:55:54 +03:00
|
|
|
VAL=(#R) { R=$1 }
|
2012-05-21 05:16:51 +03:00
|
|
|
TOL <= 5%
|
|
|
|
FN=*% { TOL<=$$ }
|
2012-05-20 17:18:18 +03:00
|
|
|
break REF
|
2012-05-22 05:17:33 +03:00
|
|
|
// end break again ignore
|
2012-05-20 17:18:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-05-21 03:55:54 +03:00
|
|
|
pattern:
|
|
|
|
() | like in RE
|
|
|
|
* ? like in glob
|
|
|
|
(#U) expect a numeric value of unit U (use substring to get canonical value)
|
|
|
|
|
2012-05-20 17:18:18 +03:00
|
|
|
subst: $1 ... $field
|
|
|
|
|
|
|
|
substring:
|
|
|
|
$1, $2, ...
|
|
|
|
variable:
|
|
|
|
$foo, ...
|
|
|
|
with curly braces:
|
|
|
|
${foo}, ...
|
2012-05-22 19:01:39 +03:00
|
|
|
input variable (in pattern):
|
2012-05-20 17:18:18 +03:00
|
|
|
$$
|
2012-05-22 19:01:39 +03:00
|
|
|
the input variable ($) can also be used as LHS for matches and assignments
|
2012-05-21 03:55:54 +03:00
|
|
|
|
|
|
|
Caveat:
|
|
|
|
|
|
|
|
Wrong: FN=* { X=$FN } there is no variable called FN
|
|
|
|
Right: FN=* { X=$$ } yields the Fn field selected by FN
|
|
|
|
|
|
|
|
Wrong: VAL=(#R) { R=$VAL } yields literal value
|
|
|
|
Wrong: VAL=(#R) { R=$$ } yields literal value
|
|
|
|
Right: VAL=(#R) { R=$1 } yield canonicalized value
|
2012-05-20 17:18:18 +03:00
|
|
|
*/
|