Root/
| 1 | FN=DNP { ignore } |
| 2 | |
| 3 | FN=X(*) { $=$1 } |
| 4 | |
| 5 | /* iteration demo */ |
| 6 | FOO=abcde |
| 7 | BAR=x /* BAR= wouldn't be syntactically correct. We need a non-empty value */ |
| 8 | FOO=(*)(?) { |
| 9 | BAR=$BAR$2 |
| 10 | FOO=$1 |
| 11 | continue |
| 12 | } |
| 13 | BAR=x(*) { $=$1 } /* remove the "x" */ |
| 14 | |
| 15 | REF=R[0-9]* { |
| 16 | T=R |
| 17 | VAL=(#R) { R=$1 } |
| 18 | TOL <= 5% |
| 19 | FN=*% { TOL<=$$ } |
| 20 | break REF |
| 21 | // end break continue ignore |
| 22 | } |
| 23 | |
| 24 | /* |
| 25 | pattern: |
| 26 | () | like in RE |
| 27 | * ? like in glob |
| 28 | (#U) expect a numeric value of unit U (use substring to get canonical value) |
| 29 | |
| 30 | subst: $1 ... $field |
| 31 | |
| 32 | substring: |
| 33 | $1, $2, ... |
| 34 | variable: |
| 35 | $foo, ... |
| 36 | with curly braces: |
| 37 | ${foo}, ... |
| 38 | input variable (in pattern): |
| 39 | $$ |
| 40 | |
| 41 | the input variable ($) can also be used as LHS for matches, assignments, and |
| 42 | as break/continue target. |
| 43 | |
| 44 | Caveat: |
| 45 | |
| 46 | Wrong: FN=* { X=$FN } there is no variable called FN |
| 47 | Right: FN=* { X=$$ } yields the Fn field selected by FN |
| 48 | |
| 49 | Wrong: VAL=(#R) { R=$VAL } yields literal value |
| 50 | Wrong: VAL=(#R) { R=$$ } yields literal value |
| 51 | Right: VAL=(#R) { R=$1 } yield canonicalized value |
| 52 | */ |
| 53 |
Branches:
master
