| 1 |
(* |
| 2 |
* This file is part of Coccinelle, lincensed 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 |
(* Get user input from config file. |
| 8 |
* |
| 9 |
* - The configs are centered around the syntax: |
| 10 |
* <attribute> = <value> |
| 11 |
* using newlines as delimiters. |
| 12 |
* - For attributes with multiple values, the values are delimitered by pipes | |
| 13 |
* - Rules follow the syntax: |
| 14 |
* <rulename> = |
| 15 |
* org: "here is a message. found %s!" % e |
| 16 |
* report: "this is an org message." |
| 17 |
* where the messages follow the Python format string syntax. If only one of |
| 18 |
* org or report is specified, the same message is used for both. |
| 19 |
* - <rulename> can be the literal rule name, or, if none: |
| 20 |
* <line number that rule is declared>:<new rulename> |
| 21 |
* - Each attribute has a one-letter shorthand, usually the first letter. |
| 22 |
* - Comments follow C syntax, ie. // for one-line and /**/ for multi-line. |
| 23 |
* |
| 24 |
* See the lexer file for specifics. |
| 25 |
*) |
| 26 |
|
| 27 |
(* ------------------------------------------------------------------------- *) |
| 28 |
(* PARSER FUNCTIONS *) |
| 29 |
|
| 30 |
(* read local config with information specific for the coccinelle script |
| 31 |
* currently being generated. |
| 32 |
* rule_names are a list of the names of */+/- rules in the coccinelle script. |
| 33 |
*) |
| 34 |
val parse_local : |
| 35 |
rule_names:string list -> |
| 36 |
config_name:string -> |
| 37 |
User_input.t |
| 38 |
|
| 39 |
(* no user input, default is: |
| 40 |
* description = No description. |
| 41 |
* confidence = Moderate |
| 42 |
*) |
| 43 |
val parse_default : User_input.t |
| 44 |
|
| 45 |
(* read global config for general information in any rule generation. |
| 46 |
* TODO: implement. |
| 47 |
*) |
| 48 |
val parse_global : |
| 49 |
config_name:string -> |
| 50 |
string option * (* Author name *) |
| 51 |
string option * (* License *) |
| 52 |
string * (* Default generated rule name *) |
| 53 |
string * (* Default generated position name *) |
| 54 |
string * (* Default error message for org and report *) |
| 55 |
int (* Character limit (width) for generated script *) |