|
32 | 32 | * 7. The `input` column specifies how data enters the element selected by the
|
33 | 33 | * first 6 columns, and the `output` column specifies how data leaves the
|
34 | 34 | * element selected by the first 6 columns. An `input` can be either "",
|
35 |
| - * "Argument", "Argument[n]", "ReturnValue": |
| 35 | + * "Argument[n]", "Argument[n1..n2]", "ReturnValue": |
36 | 36 | * - "": Selects a write to the selected element in case this is a field.
|
37 |
| - * - "Argument": Selects any argument in a call to the selected element. |
38 |
| - * - "Argument[n]": Similar to "Argument" but restricted to a specific numbered |
39 |
| - * argument (zero-indexed, and `-1` specifies the qualifier). |
| 37 | + * - "Argument[n]": Selects an argument in a call to the selected element. |
| 38 | + * The arguments are zero-indexed, and `-1` specifies the qualifier. |
| 39 | + * - "Argument[n1..n2]": Similar to "Argument[n]" but select any argument in |
| 40 | + * the given range. The range is inclusive at both ends. |
40 | 41 | * - "ReturnValue": Selects a value being returned by the selected element.
|
41 | 42 | * This requires that the selected element is a method with a body.
|
42 | 43 | *
|
43 |
| - * An `output` can be either "", "Argument", "Argument[n]", "Parameter", |
44 |
| - * "Parameter[n]", or "ReturnValue": |
| 44 | + * An `output` can be either "", "Argument[n]", "Argument[n1..n2]", "Parameter", |
| 45 | + * "Parameter[n]", "Parameter[n1..n2]", or "ReturnValue": |
45 | 46 | * - "": Selects a read of a selected field, or a selected parameter.
|
46 |
| - * - "Argument": Selects the post-update value of an argument in a call to the |
| 47 | + * - "Argument[n]": Selects the post-update value of an argument in a call to the |
47 | 48 | * selected element. That is, the value of the argument after the call returns.
|
48 |
| - * - "Argument[n]": Similar to "Argument" but restricted to a specific numbered |
49 |
| - * argument (zero-indexed, and `-1` specifies the qualifier). |
| 49 | + * The arguments are zero-indexed, and `-1` specifies the qualifier. |
| 50 | + * - "Argument[n1..n2]": Similar to "Argument[n]" but select any argument in |
| 51 | + * the given range. The range is inclusive at both ends. |
50 | 52 | * - "Parameter": Selects the value of a parameter of the selected element.
|
51 | 53 | * "Parameter" is also allowed in case the selected element is already a
|
52 | 54 | * parameter itself.
|
53 | 55 | * - "Parameter[n]": Similar to "Parameter" but restricted to a specific
|
54 | 56 | * numbered parameter (zero-indexed, and `-1` specifies the value of `this`).
|
| 57 | + * - "Parameter[n1..n2]": Similar to "Parameter[n]" but selects any parameter |
| 58 | + * in the given range. The range is inclusive at both ends. |
55 | 59 | * - "ReturnValue": Selects the return value of a call to the selected element.
|
56 | 60 | * 8. The `kind` column is a tag that can be referenced from QL to determine to
|
57 | 61 | * which classes the interpreted elements should be added. For example, for
|
@@ -554,11 +558,29 @@ private string getLast(string s) {
|
554 | 558 | }
|
555 | 559 |
|
556 | 560 | private predicate parseParam(string c, int n) {
|
557 |
| - specSplit(_, c, _) and c.regexpCapture("Parameter\\[([-0-9]+)\\]", 1).toInt() = n |
| 561 | + specSplit(_, c, _) and |
| 562 | + ( |
| 563 | + c.regexpCapture("Parameter\\[([-0-9]+)\\]", 1).toInt() = n |
| 564 | + or |
| 565 | + exists(int n1, int n2 | |
| 566 | + c.regexpCapture("Parameter\\[([-0-9]+)\\.\\.([0-9]+)\\]", 1).toInt() = n1 and |
| 567 | + c.regexpCapture("Parameter\\[([-0-9]+)\\.\\.([0-9]+)\\]", 2).toInt() = n2 and |
| 568 | + n = [n1 .. n2] |
| 569 | + ) |
| 570 | + ) |
558 | 571 | }
|
559 | 572 |
|
560 | 573 | private predicate parseArg(string c, int n) {
|
561 |
| - specSplit(_, c, _) and c.regexpCapture("Argument\\[([-0-9]+)\\]", 1).toInt() = n |
| 574 | + specSplit(_, c, _) and |
| 575 | + ( |
| 576 | + c.regexpCapture("Argument\\[([-0-9]+)\\]", 1).toInt() = n |
| 577 | + or |
| 578 | + exists(int n1, int n2 | |
| 579 | + c.regexpCapture("Argument\\[([-0-9]+)\\.\\.([0-9]+)\\]", 1).toInt() = n1 and |
| 580 | + c.regexpCapture("Argument\\[([-0-9]+)\\.\\.([0-9]+)\\]", 2).toInt() = n2 and |
| 581 | + n = [n1 .. n2] |
| 582 | + ) |
| 583 | + ) |
562 | 584 | }
|
563 | 585 |
|
564 | 586 | private predicate inputNeedsReference(string c) {
|
|
0 commit comments