Release coccinelle-0.1.6
[bpt/coccinelle.git] / docs / grammar / cocci_syntax.tex
index ed2b3fd..8dafbd9 100644 (file)
@@ -22,7 +22,7 @@
 %
 \ifhevea % For HTML generation
 \lstdefinelanguage{Cocci}{
-morekeywords={idexpression,expression,statement,identifier,
+morekeywords={idexpression,expression,statement,identifier,type,
 parameter,list,when,strict,any,forall,local,position,typedef},
 keywordstyle=\color{OliveGreen}\bfseries,
 sensitive=false,
@@ -38,7 +38,7 @@ moredelim=[il][\color{Plum}]{@M}}
 
 \else % For DVI/PS/PDF generation
 \lstdefinelanguage{Cocci}{
-morekeywords={idexpression,expression,statement,identifier,
+morekeywords={idexpression,expression,statement,identifier,type,
 parameter,list,when,strict,any,forall,local,position,typedef},
 keywordstyle=\color{OliveGreen}\bfseries,
 sensitive=false,
@@ -474,6 +474,47 @@ some constraints on the use of these annotations:
   occur on a line with any marking.
 \end{itemize}
 
+Each element of a disjunction must be a proper term like an
+expression, a statement, an identifier or a declaration. Thus, the
+rule on the left below is not a syntaxically correct SmPL rule. One may
+use the rule on the right instead.
+
+\begin{center}
+  \begin{tabular}{l@{\hspace{5cm}}r}
+\begin{lstlisting}[language=Cocci]
+@@
+type T;
+T b;
+@@
+
+(
+ writeb(...,
+|
+ readb(
+)
+@--(T)
+ b)
+\end{lstlisting}
+    &
+\begin{lstlisting}[language=Cocci]
+@@
+type T;
+T b;
+@@
+
+(
+read
+|
+write
+)
+ (...,
+@-- (T)
+  b)
+\end{lstlisting}
+    \\
+  \end{tabular}
+\end{center}
+
 \section{Types}
 \label{types}
 
@@ -798,6 +839,7 @@ in a concise way.
 \end{grammar}
 
 \include{examples}
+\include{tips}
 \end{document}
 
 %%% Local Variables: