On Tue, 16 Jul 2019, Will Lester wrote: > Hello, > I want to write a script to solve problems of such pattern. > func_a () { >     x = .*alloc(); > } > func_b () { >     foo(..., x, ...); > } > That is, a variable x is allocated by func_a and used by func_b in a file. > I wrote a script like this: > fn_a (...) { > ... > - X = fn1(...); > ... > } > ... > fn_b (...) { > ... > - fn2 (..., X, ...); > ... > } > But an error was reported between two functions, "..." cannot be used there. > Therefore, what is the correct solution to this problem? Just make two separate rules. You can put a name for a rule between the initial @@ and then you can refer to the name in the second rule to obtain the value of a metavariable from the first one. For example: @r@ identifier x; @@ x = fn1(...) @@ identifier r.x; @@ fn2(...,x,...) In your example, fn1 should end with alloc. If you want to declare a metavariable like that you can use a regular expression: identifier alloc =~ "alloc$"; I guess this should match names that end with alloc. julia