~npalix/coccinelle/upstream

« back to all changes in this revision

Viewing changes to python/yes_pycocci.ml

  • Committer: Julia Lawall
  • Date: 2020-02-12 20:20:49 UTC
  • mfrom: (4831.1.13)
  • Revision ID: git-v1:bad1779ec17bb87a7ab35780713752c09092abe2
MergeĀ gitlab.inria.fr:coccinelle/coccinelle

Show diffs side-by-side

added added

removed removed

Lines of Context:
466
466
    Py.Bool.to_bool (get_variable "result")
467
467
  end
468
468
 
 
469
let run_fresh_id args pos body =
 
470
  catch_python_error begin fun () ->
 
471
    build_classes [];
 
472
    let make_arg (name, value) =
 
473
      (snd name, name, value, Ast_cocci.NoMVInit) in
 
474
    let mv = List.map make_arg args in
 
475
    construct_variables mv args;
 
476
    run pos (Printf.sprintf "
 
477
from coccinelle import *
 
478
from coccilib.iteration import Iteration
 
479
 
 
480
coccinelle.result = (%s)" body);
 
481
    Py.String.to_string (get_variable "result")
 
482
  end
 
483
 
469
484
let flush_stdout_and_stderr () =
470
485
  if py_isinitialized () then
471
486
    let _ = pyrun_simplestring "\