Python scripts

The characters that appear within a Python script, e.g.,

script:python @ expr_1 << if_eq_1.E_1;
                 expr_2 << if_eq_1.E_2;
              @@
print expr_1, " @ ", expr_2

are not converted to tokens of any kind, they are simply scanned as characters. This means that a @ character appearing within a Python script is treated as a SmPL section organization character, even although it appears within what would otherwise be considered to be a string.

Because characters within a script:python are not converted to tokens it is possible for a well formed Python script to cause Coccinelle to generate syntax errors.

Another problem in the interaction between SmPL and python is in the comment character. SmPL comments begin with two forward slashes, as in C++, while Python comments begin with #. A comment that comes after a Python rule and before a SmPL rule must thus begin with #. This problem most often occurs when one inserts a Python rule before a SmPL rule that is preceded by a comment.

 
coccinelle_syntax_errors.txt · Last modified: 2009/05/31 22:19 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki