Marcel van Lohuizen | ea40e66 | 2018-12-11 18:07:49 +0100 | [diff] [blame] | 1 | package trim |
| 2 | |
| 3 | foo <Name>: { |
| 4 | _value: string |
| 5 | |
| 6 | a: 4 |
| 7 | b: string |
| 8 | d: 8 |
| 9 | e: "foo" |
| 10 | f: ">> \( _value) <<" |
| 11 | n: 5 |
| 12 | |
| 13 | list: ["foo", 8.0] |
| 14 | |
| 15 | struct: {a: 3.0} |
| 16 | |
| 17 | sList: [{a: 8, b: string}, {a: 9, b: "foo" | string}] |
| 18 | rList: [{a: "a"}] |
| 19 | rcList: [{a: "a", c: b}] |
| 20 | |
| 21 | t <Name>: { |
| 22 | x: 0..5 |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | foo bar: { |
| 27 | _value: "here" |
| 28 | b: "foo" |
| 29 | c: 45 |
| 30 | |
| 31 | // The template does not require that this field be an integer (it may be |
| 32 | // a float), and thus this field specified additional information and |
| 33 | // cannot be removed. |
| 34 | n: int |
| 35 | |
| 36 | sList: [{b: "foo"}, {}] |
| 37 | } |
| 38 | |
| 39 | foo baz: {} |
| 40 | |
| 41 | foo multipath: { |
| 42 | t <Name>: { |
| 43 | // Combined with the other template, we know the value must be 5 and |
| 44 | // thus the entry below can be eliminated. |
| 45 | x: 5..8 |
| 46 | } |
| 47 | |
| 48 | t u: { |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // TODO: top-level fields are currently not removed. |
| 53 | group: { |
Marcel van Lohuizen | 76b92b5 | 2018-12-16 10:47:03 +0100 | [diff] [blame^] | 54 | comp "\(k)": v for k, v in foo |
Marcel van Lohuizen | ea40e66 | 2018-12-11 18:07:49 +0100 | [diff] [blame] | 55 | |
| 56 | comp bar: { |
| 57 | aa: 8 // new value |
| 58 | } |
| 59 | } |