| 1 |
(* |
| 2 |
* This file is part of Coccinelle, licensed under the terms of the GPL v2. |
| 3 |
* See copyright.txt in the Coccinelle source code for more information. |
| 4 |
* The Coccinelle source code can be obtained at http://coccinelle.lip6.fr |
| 5 |
*) |
| 6 |
|
| 7 |
(* Given some Ast0 component x, generates a position at an appropriate place |
| 8 |
* and returns |
| 9 |
* - Some (x,snp), where x has an inserted metaposition and snp is the updated |
| 10 |
snapshot. |
| 11 |
* - None, if no position could be generated (this is the case in e.g. dots |
| 12 |
* (...) because they don't really have a well-defined position). |
| 13 |
* |
| 14 |
* "appropriate place" means usually after an id if possible. |
| 15 |
* The added position is always in an Ast0.PLUS context (using the fact |
| 16 |
* that a metaposition in the original script is NEVER in plus context). |
| 17 |
* |
| 18 |
* Note that it might return Some <component> even if no position was inserted |
| 19 |
* if the component is optional (ie. on a line preceded with ? in SmPL) |
| 20 |
*) |
| 21 |
|
| 22 |
(* ------------------------------------------------------------------------- *) |
| 23 |
(* POSITION GENERATION FUNCTIONS *) |
| 24 |
|
| 25 |
val ident_pos : |
| 26 |
Ast0_cocci.ident -> |
| 27 |
Snapshot.t -> |
| 28 |
Ast0_cocci.ident * Snapshot.t |
| 29 |
|
| 30 |
val expression_pos : |
| 31 |
Ast0_cocci.expression -> |
| 32 |
Snapshot.t -> |
| 33 |
(Ast0_cocci.expression * Snapshot.t) option |
| 34 |
|
| 35 |
val declaration_pos : |
| 36 |
Ast0_cocci.declaration -> |
| 37 |
Snapshot.t -> |
| 38 |
(Ast0_cocci.declaration * Snapshot.t) option |
| 39 |
|
| 40 |
val field_pos : |
| 41 |
Ast0_cocci.field -> |
| 42 |
Snapshot.t -> |
| 43 |
(Ast0_cocci.field * Snapshot.t) option |
| 44 |
|
| 45 |
val statement_pos : |
| 46 |
Ast0_cocci.statement -> |
| 47 |
Snapshot.t -> |
| 48 |
(Ast0_cocci.statement * Snapshot.t) option |