Skip to contentSkip to conversation

Checking a parse error for detailed SmPL rule properties

cocci Markus Elfring 2 participants 9 messages Jan 24, 2024

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying the following tiny script variant for the semantic patch language out also together with the software combination “Coccinelle 1.1.1-00630-gdeb429df”.

virtual report, org

@or depends on org || report disable sizeof_type_expr@ position p;
@@
my_action@p(...)

Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci or-test2-20240124.cocci …
rule name: parse error:
File "or-test2-20240124.cocci", line 3, column 1, charpos = 22
around = 'or',
whole content = @or depends on org || report disable sizeof_type_expr@

Now I wonder how this software behaviour would fit to the documentation.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/5fdb1a247d3374ac30a3e565b2cc5167aeefc4e5/docs/manual/cocci_syntax.tex#L87

May SmPL rule identifiers be chosen freely?

Regards,
Markus

#1 lore raw
Quoted 22 lines · Markus Elfring

Hello,

I am trying the following tiny script variant for the semantic patch language out also together with the software combination “Coccinelle 1.1.1-00630-gdeb429df”.

virtual report, org

@or depends on org || report disable sizeof_type_expr@ position p;
@@
my_action@p(...)

Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci or-test2-20240124.cocci …
rule name: parse error:
File "or-test2-20240124.cocci", line 3, column 1, charpos = 22
around = 'or',
whole content = @or depends on org || report disable sizeof_type_expr@

Quoted 4 lines

Now I wonder how this software behaviour would fit to the documentation.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/5fdb1a247d3374ac30a3e565b2cc5167aeefc4e5/docs/manual/cocci_syntax.tex#L87

May SmPL rule identifiers be chosen freely?

It seems that they should not be keywords.

julia

#2 lore raw
Quoted 3 lines
Quoted 1 line

May SmPL rule identifiers be chosen freely?

It seems that they should not be keywords.

Should such SmPL identifiers be independent from an applied programming language like OCaml?

Regards,
Markus

#3 lore raw
Quoted 6 lines · Markus Elfring
Quoted 3 lines
Quoted 1 line

May SmPL rule identifiers be chosen freely?

It seems that they should not be keywords.

Should such SmPL identifiers be independent from an applied programming language like OCaml?

It has nothing to do with OCaml. or is an alternative form of || in C.

https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B

julia

#4 lore raw
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

May SmPL rule identifiers be chosen freely?

It seems that they should not be keywords.

Should such SmPL identifiers be independent from an applied programming language like OCaml?

It has nothing to do with OCaml. or is an alternative form of || in C.

Why would such a technical aspect influence the identifier selection within the name space of a rule for the semantic patch language?

Regards,
Markus

#5 lore raw
Quoted 11 lines · Markus Elfring
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

May SmPL rule identifiers be chosen freely?

It seems that they should not be keywords.

Should such SmPL identifiers be independent from an applied programming language like OCaml?

It has nothing to do with OCaml. or is an alternative form of || in C.

Why would such a technical aspect influence the identifier selection within the name space of a rule for the semantic patch language?

Because or is now a keyword, and we don't allow keywords as rule names. You can't have if or while as a rule name either.

Perhaps it could be fixed, but that is the explanation.

julia

#6 lore raw
Quoted 7 lines
Quoted 2 lines

Why would such a technical aspect influence the identifier selection within the name space of a rule for the semantic patch language?

Because or is now a keyword, and we don't allow keywords as rule names. You can't have if or while as a rule name either.

Perhaps it could be fixed, but that is the explanation.

With which commit was the observed restriction introduced?

Regards,
Markus

#7 lore raw
Quoted 9 lines · Markus Elfring
Quoted 7 lines
Quoted 2 lines

Why would such a technical aspect influence the identifier selection within the name space of a rule for the semantic patch language?

Because or is now a keyword, and we don't allow keywords as rule names. You can't have if or while as a rule name either.

Perhaps it could be fixed, but that is the explanation.

With which commit was the observed restriction introduced?

Probably e9facdc383d75bc2910762d166810ea6f858e8e5

julia

Quoted 4 lines

Regards,
Markus