Checking the parsing for a nested SmPL disjunction
Hello,
I have tried another small script variant out for the semantic patch language (according to the software combination “Coccinelle 1.0.8-00131-g675b9670”).
@display@
type t1, t2;
expression action;
identifier resource, y;
statement is, es;
@@
t1* resource;
<+... when any
(t2 y = <+...
( sizeof(*(resource))
|
* *(resource)
) ...+>
|
*action(..., resource, ...)
)
...+>
elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci show_problematic_disjunction-20200626.cocci …
minus: parse error:
File "show_problematic_disjunction-20200626.cocci", line 14, column 0, charpos = 196 around = '|',
whole content = |
May I expect that such SmPL disjunctions should also work?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 5 lines · Markus Elfring
Hello,
I have tried another small script variant out for the semantic patch language (according to the software combination “Coccinelle 1.0.8-00131-g675b9670”).
Quoted 13 lines
@display@
type t1, t2;
expression action;
identifier resource, y;
statement is, es;
@@
t1* resource;
<+... when any
(t2 y = <+...
( sizeof(*(resource))
|
* *(resource)
) ...+>
You are missing a ; here.
julia
Quoted 14 lines
|
*action(..., resource, ...)
)
...+>elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci
show_problematic_disjunction-20200626.cocci…
minus: parse error:
File "show_problematic_disjunction-20200626.cocci", line 14, column 0, charpos = 196 around = '|',
whole content = |
Quoted 9 lines
May I expect that such SmPL disjunctions should also work?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 8 lines
Quoted 6 lines
<+... when any
(t2 y = <+...
( sizeof(*(resource))
|
* *(resource)
) ...+>You are missing a ; here.
I assumed that I may omit the semicolon in such a SmPL code. Can the specification of a SmPL nest construct ever be sufficient here?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 11 lines · Markus Elfring
Quoted 8 lines
Quoted 6 lines
<+... when any
(t2 y = <+...
( sizeof(*(resource))
|
* *(resource)
) ...+>You are missing a ; here.
I assumed that I may omit the semicolon in such a SmPL code. Can the specification of a SmPL nest construct ever be sufficient here?
No. <+... ...+> matches a subtree of an AST. For a variable initialization, there is no subtree of the AST that includes both the right side of an = and the ;.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 6 lines
Quoted 2 lines
I assumed that I may omit the semicolon in such a SmPL code. Can the specification of a SmPL nest construct ever be sufficient here?
No. <+... ...+> matches a subtree of an AST. For a variable initialization, there is no subtree of the AST that includes both the right side of an = and the ;.
Can the abstract syntax tree be adjusted accordingly?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 8 lines · Markus Elfring
Quoted 6 lines
Quoted 2 lines
I assumed that I may omit the semicolon in such a SmPL code. Can the specification of a SmPL nest construct ever be sufficient here?
No. <+... ...+> matches a subtree of an AST. For a variable initialization, there is no subtree of the AST that includes both the right side of an = and the ;.
Can the abstract syntax tree be adjusted accordingly?
No.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I assumed that I may omit the semicolon in such a SmPL code. Can the specification of a SmPL nest construct ever be sufficient here?
No. <+... ...+> matches a subtree of an AST. For a variable initialization, there is no subtree of the AST that includes both the right side of an = and the ;.
Can the abstract syntax tree be adjusted accordingly?
No.
Can such a rejection mean that software development efforts look undesirable (while adjustments for the data model would eventually be possible)?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 7 lines · Markus Elfring
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
I assumed that I may omit the semicolon in such a SmPL code. Can the specification of a SmPL nest construct ever be sufficient here?
No. <+... ...+> matches a subtree of an AST. For a variable initialization, there is no subtree of the AST that includes both the right side of an = and the ;.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Can the abstract syntax tree be adjusted accordingly?
No.
Can such a rejection mean that software development efforts look undesirable (while adjustments for the data model would eventually be possible)?
No, it means that it makes no sense and it is not going to happen.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci