Manpulate ast tree like sed
.
Using sed
-like grammer to replace puts
argument.
$ cargo run -- 's/(call_expression
function: (identifier) @the-function
arguments: (argument_list (_) @tbr)
(#eq? @the-function "puts"))/"Just Monika"/' ./example/source_code.c
- Implement more argument to compatible to
sed
- Implement more sed script's function
-
s
command:&
and\1 \2 ...
,g
option -
i
/a
command: insert/append content -
d
command: delete content -
p
command: print content
-
- Better document