Using inherited input data for SmPL script rules?
Hello,
I tried another script variant out for the semantic patch language also together with the software combination “Coccinelle 1.1.1-00739-g68c580f1”.
@first_search@
identifier id;
@@
my_work(id);
@second_search@
identifier first_search.id;
@@
my_log(id, ...);
@script:python selection@
x << second_search.id;
@@
if x == "apples":
cocci.include_match(False)
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci test-inherited_input_for_script_rule.cocci …
scriptmeta: semantic error: bad rule second_search or bad variable id
File "test-inherited_input_for_script_rule.cocci", line 12, column 21, charpos = 161
around = ';',
whole content = x << second_search.id;
Can the application of input data become supported for SmPL script rules even if such data would be inherited by longer SmPL rule chains?
Regards,
Markus
Quoted 23 lines · Markus Elfring
Hello,
I tried another script variant out for the semantic patch language also together with the software combination “Coccinelle 1.1.1-00739-g68c580f1”.
@first_search@
identifier id;
@@
my_work(id);@second_search@
identifier first_search.id;
@@
my_log(id, ...);@script:python selection@
x << second_search.id;
@@
if x == "apples":
cocci.include_match(False)
Quoted 6 lines
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci
test-inherited_input_for_script_rule.cocci…
scriptmeta: semantic error: bad rulesecond_searchor bad variable id
File "test-inherited_input_for_script_rule.cocci", line 12, column 21, charpos = 161
around = ';',
whole content = x << second_search.id;
You should have inherited it from where it was defined, ie first_search.
julia
Quoted 11 lines
Can the application of input data become supported for SmPL script rules even if such data would be inherited by longer SmPL rule chains?
Regards,
Markus
Quoted 8 lines
Quoted 6 lines
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci
test-inherited_input_for_script_rule.cocci…
scriptmeta: semantic error: bad rulesecond_searchor bad variable id
File "test-inherited_input_for_script_rule.cocci", line 12, column 21, charpos = 161
around = ';',
whole content = x << second_search.id;You should have inherited it from where it was defined, ie
first_search.
…
Quoted 2 lines
Quoted 2 lines
Can the application of input data become supported for SmPL script rules even if such data would be inherited by longer SmPL rule chains?
I am looking for extended data processing support.
The second rule could also specify additional SmPL constraints, couldn't it?
May SmPL script rules depend then on search results from a previous rule which references also inherited metavariables?
Regards,
Markus
Quoted 8 lines · Markus Elfring
Quoted 8 lines
Quoted 6 lines
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci
test-inherited_input_for_script_rule.cocci…
scriptmeta: semantic error: bad rulesecond_searchor bad variable id
File "test-inherited_input_for_script_rule.cocci", line 12, column 21, charpos = 161
around = ';',
whole content = x << second_search.id;You should have inherited it from where it was defined, ie
first_search.
Quoted 8 lines
…
Quoted 2 lines
Quoted 2 lines
Can the application of input data become supported for SmPL script rules even if such data would be inherited by longer SmPL rule chains?
I am looking for extended data processing support.
The second rule could also specify additional SmPL constraints, couldn't it?
I don't know.
Quoted 2 lines
May SmPL script rules depend then on search results from a previous rule which references also inherited metavariables?
No.
If you want to do that, just make another metavariable. You can write i1@i2 to make two metavariables match at the same place.
julia
Quoted 4 lines
Quoted 2 lines
May SmPL script rules depend then on search results from a previous rule which references also inherited metavariables?
No.
I hope that such a software limitation can be adjusted under other circumstances.
Regards,
Markus