File: python_documentation.md

package info (click to toggle)
coccinelle 1.0.8.deb-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 26,148 kB
  • sloc: ml: 136,392; ansic: 23,594; sh: 2,189; makefile: 2,157; perl: 1,576; lisp: 840; python: 823; awk: 70; csh: 12
file content (66 lines) | stat: -rw-r--r-- 1,699 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Fields and methods exposed via cocci object

## cocci.cocci_file

File name of the cocci file currently processed.

## cocci.exit()

Sets "exited" flag, that will stop the transformation of the current
file at the end of the execution of the Python script.

Example: tests/exitp.cocci

## cocci.has_env_binding(rule, name)

Returns `true` if the meta-variable `name` is bound in the rule
`rule`.

## cocci.add_pending_instance(files, virtual_rules, virtual_identifiers,
       extend_virtual_ids)

Internal function for the method iteration.register().

## cocci.make_ident(id)

Converts the string `id` to a C identifier.
(Equivalent to Coccilib.make_ident in OCaml.)

Example: tests/python_mdecl.cocci

## cocci.make_stmt(phrase)

Parses the string `phrase` as a C statement and returns the statement.

Example: tests/python_mdecl.cocci

## cocci.make_stmt_with_env(env, phrase)

Parses the string `env` as a C declaration and parses the string `phrase`
as a C statement in this environment and returns the statement.

Example: tests/python_mdecl.cocci

## cocci.make_type(type)

Parses the string `type` as a C type and returns the type.

## cocci.make_listlen(len)

Converts the integer `len` to a list length.

## cocci.make_position(fl, fn, startl, startc, endl, endc)

Returns a position with filename `fl` (a string), element `fn` (a string),
starting at line `startl`, column `startc` (integers), and
ending at line `endl`, column `endc` (integers).
(Equivalent to Coccilib.make_position in OCaml.)

Example: tests/python_mdeclp.cocci

## cocci.files()

Returns the list of current file names (as strings).
(Equivalent to Coccilib.files in OCaml.)

Example: tests/scope_id_1_python.cocci