2 * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
3 * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
4 * This file is part of Coccinelle.
6 * Coccinelle is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, according to version 2 of the License.
10 * Coccinelle is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
18 * The authors reserve the right to distribute this or future versions of
19 * Coccinelle under other licenses.
23 (* --------------------------------------------------------------------- *)
26 type info
= { line
: int; column
: int;
27 strbef
: (string * int (* line *) * int (* col *)) list
;
28 straft
: (string * int (* line *) * int (* col *)) list
}
30 type meta_name
= string * string
31 (* need to be careful about rewrapping, to avoid duplicating pos info
32 currently, the pos info is always None until asttoctl2. *)
36 free_vars
: meta_name list
; (*free vars*)
37 minus_free_vars
: meta_name list
; (*minus free vars*)
38 fresh_vars
: (meta_name
* string (*seed*) option) list
; (*fresh vars*)
39 inherited
: meta_name list
; (*inherited vars*)
40 saved_witness
: meta_name list
; (*witness vars*)
41 bef_aft
: dots_bef_aft
;
42 (* the following is for or expressions *)
43 pos_info
: meta_name mcode
option; (* pos info, try not to duplicate *)
44 true_if_test_exp
: bool;(* true if "test_exp from iso", only for exprs *)
45 (* isos relevant to the term; ultimately only used for rule_elems *)
46 iso_info
: (string*anything
) list
}
49 BEFORE
of 'a list list
50 | AFTER
of 'a list list
51 | BEFOREAFTER
of 'a list list
* 'a list list
54 and 'a mcode
= 'a
* info
* mcodekind
* meta_pos
(* pos variable *)
55 (* pos is an offset indicating where in the C code the mcodekind has an
57 (* int list is the match instances, which are only meaningful in annotated
59 (* int is the adjacency index, which is incremented on context dots *)
61 MINUS
of pos
* int list
* int * anything list list
62 | CONTEXT
of pos
* anything befaft
65 Real
of int (* charpos *) | Virt
of int * int (* charpos + offset *)
66 and pos
= NoPos
| DontCarePos
| FixPos
of (fixpos
* fixpos
)
70 | AddingBetweenDots
of statement
* int (*index of let var*)
71 | DroppingBetweenDots
of statement
* int (*index of let var*)
73 and inherited
= Type_cocci.inherited
74 and keep_binding
= Type_cocci.keep_binding
75 and multi
= bool (*true if a nest is one or more, false if it is zero or more*)
78 meta_name list
(*free vars*) * (meta_name
* string option) list
(*fresh*) *
79 meta_name list
(*inherited vars*) * mcodekind
81 (* --------------------------------------------------------------------- *)
84 and arity
= UNIQUE
| OPT
| MULTI
| NONE
87 MetaIdDecl
of arity
* meta_name
(* name *)
88 | MetaFreshIdDecl
of meta_name
(* name *) * string option (* seed *)
89 | MetaTypeDecl
of arity
* meta_name
(* name *)
90 | MetaInitDecl
of arity
* meta_name
(* name *)
91 | MetaListlenDecl
of meta_name
(* name *)
92 | MetaParamDecl
of arity
* meta_name
(* name *)
93 | MetaParamListDecl
of arity
* meta_name
(*name*) * meta_name
option (*len*)
95 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
96 | MetaErrDecl
of arity
* meta_name
(* name *)
98 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
100 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
101 | MetaLocalIdExpDecl
of
102 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
103 | MetaExpListDecl
of arity
* meta_name
(*name*) * meta_name
option (*len*)
104 | MetaStmDecl
of arity
* meta_name
(* name *)
105 | MetaStmListDecl
of arity
* meta_name
(* name *)
106 | MetaFuncDecl
of arity
* meta_name
(* name *)
107 | MetaLocalFuncDecl
of arity
* meta_name
(* name *)
108 | MetaPosDecl
of arity
* meta_name
(* name *)
109 | MetaDeclarerDecl
of arity
* meta_name
(* name *)
110 | MetaIteratorDecl
of arity
* meta_name
(* name *)
112 (* --------------------------------------------------------------------- *)
113 (* --------------------------------------------------------------------- *)
121 and 'a dots
= 'a base_dots wrap
123 (* --------------------------------------------------------------------- *)
129 | MetaId
of meta_name mcode
* ident list
* keep_binding
* inherited
130 | MetaFunc
of meta_name mcode
* ident list
* keep_binding
* inherited
131 | MetaLocalFunc
of meta_name mcode
* ident list
* keep_binding
* inherited
134 | UniqueIdent
of ident
136 and ident
= base_ident wrap
138 (* --------------------------------------------------------------------- *)
141 and base_expression
=
143 | Constant
of constant mcode
144 | FunCall
of expression
* string mcode
(* ( *) *
145 expression dots
* string mcode
(* ) *)
146 | Assignment
of expression
* assignOp mcode
* expression
*
147 bool (* true if it can match an initialization *)
148 | CondExpr
of expression
* string mcode
(* ? *) * expression
option *
149 string mcode
(* : *) * expression
150 | Postfix
of expression
* fixOp mcode
151 | Infix
of expression
* fixOp mcode
152 | Unary
of expression
* unaryOp mcode
153 | Binary
of expression
* binaryOp mcode
* expression
154 | Nested
of expression
* binaryOp mcode
* expression
155 | ArrayAccess
of expression
* string mcode
(* [ *) * expression
*
157 | RecordAccess
of expression
* string mcode
(* . *) * ident
158 | RecordPtAccess
of expression
* string mcode
(* -> *) * ident
159 | Cast
of string mcode
(* ( *) * fullType
* string mcode
(* ) *) *
161 | SizeOfExpr
of string mcode
(* sizeof *) * expression
162 | SizeOfType
of string mcode
(* sizeof *) * string mcode
(* ( *) *
163 fullType
* string mcode
(* ) *)
164 | TypeExp
of fullType
(*type name used as an expression, only in
167 | Paren
of string mcode
(* ( *) * expression
*
170 | MetaErr
of meta_name mcode
* expression list
* keep_binding
*
172 | MetaExpr
of meta_name mcode
* expression list
* keep_binding
*
173 Type_cocci.typeC list
option * form
* inherited
174 | MetaExprList
of meta_name mcode
* listlen
option * keep_binding
*
175 inherited
(* only in arg lists *)
177 | EComma
of string mcode
(* only in arg lists *)
179 | DisjExpr
of expression list
180 | NestExpr
of expression dots
* expression
option * multi
182 (* can appear in arg lists, and also inside Nest, as in:
183 if(< ... X ... Y ...>)
184 In the following, the expression option is the WHEN *)
185 | Edots
of string mcode
(* ... *) * expression
option
186 | Ecircles
of string mcode
(* ooo *) * expression
option
187 | Estars
of string mcode
(* *** *) * expression
option
189 | OptExp
of expression
190 | UniqueExp
of expression
192 (* ANY = int E; ID = idexpression int X; CONST = constant int X; *)
193 and form
= ANY
| ID
| LocalID
| CONST
(* form for MetaExp *)
195 and expression
= base_expression wrap
197 and listlen
= meta_name mcode
* keep_binding
* inherited
199 and unaryOp
= GetRef
| DeRef
| UnPlus
| UnMinus
| Tilde
| Not
200 and assignOp
= SimpleAssign
| OpAssign
of arithOp
201 and fixOp
= Dec
| Inc
203 and binaryOp
= Arith
of arithOp
| Logical
of logicalOp
205 Plus
| Minus
| Mul
| Div
| Mod
| DecLeft
| DecRight
| And
| Or
| Xor
206 and logicalOp
= Inf
| Sup
| InfEq
| SupEq
| Eq
| NotEq
| AndLog
| OrLog
214 (* --------------------------------------------------------------------- *)
218 Type
of const_vol mcode
option * typeC
219 | DisjType
of fullType list
(* only after iso *)
220 | OptType
of fullType
221 | UniqueType
of fullType
224 BaseType
of baseType
* string mcode list
(* Yoann style *)
225 | SignedT
of sign mcode
* typeC
option
226 | Pointer
of fullType
* string mcode
(* * *)
227 | FunctionPointer
of fullType
*
228 string mcode
(* ( *)*string mcode
(* * *)*string mcode
(* ) *)*
229 string mcode
(* ( *)*parameter_list
*string mcode
(* ) *)
231 (* used for the automatic managment of prototypes *)
232 | FunctionType
of bool (* true if all minus for dropping return type *) *
234 string mcode
(* ( *) * parameter_list
*
237 | Array
of fullType
* string mcode
(* [ *) *
238 expression
option * string mcode
(* ] *)
239 | EnumName
of string mcode
(*enum*) * ident
(* name *)
240 | StructUnionName
of structUnion mcode
* ident
option (* name *)
241 | StructUnionDef
of fullType
(* either StructUnionName or metavar *) *
242 string mcode
(* { *) * declaration dots
* string mcode
(* } *)
243 | TypeName
of string mcode
(* pad: should be 'of ident' ? *)
245 | MetaType
of meta_name mcode
* keep_binding
* inherited
247 and fullType
= base_fullType wrap
248 and typeC
= base_typeC wrap
250 and baseType
= VoidType
| CharType
| ShortType
| IntType
| DoubleType
251 | FloatType
| LongType
| LongLongType
253 and structUnion
= Struct
| Union
255 and sign
= Signed
| Unsigned
257 and const_vol
= Const
| Volatile
259 (* --------------------------------------------------------------------- *)
260 (* Variable declaration *)
261 (* Even if the Cocci program specifies a list of declarations, they are
262 split out into multiple declarations of a single variable each. *)
264 and base_declaration
=
265 Init
of storage mcode
option * fullType
* ident
* string mcode
(*=*) *
266 initialiser
* string mcode
(*;*)
267 | UnInit
of storage mcode
option * fullType
* ident
* string mcode
(* ; *)
268 | TyDecl
of fullType
* string mcode
(* ; *)
269 | MacroDecl
of ident
(* name *) * string mcode
(* ( *) *
270 expression dots
* string mcode
(* ) *) * string mcode
(* ; *)
271 | Typedef
of string mcode
(*typedef*) * fullType
*
272 typeC
(* either TypeName or metavar *) * string mcode
(*;*)
273 | DisjDecl
of declaration list
274 (* Ddots is for a structure declaration *)
275 | Ddots
of string mcode
(* ... *) * declaration
option (* whencode *)
277 | MetaDecl
of meta_name mcode
* keep_binding
* inherited
279 | OptDecl
of declaration
280 | UniqueDecl
of declaration
282 and declaration
= base_declaration wrap
284 (* --------------------------------------------------------------------- *)
287 and base_initialiser
=
288 MetaInit
of meta_name mcode
* keep_binding
* inherited
289 | InitExpr
of expression
290 | InitList
of string mcode
(*{*) * initialiser list
* string mcode
(*}*) *
291 initialiser list
(* whencode: elements that shouldn't appear in init *)
293 designator list
(* name *) * string mcode
(*=*) *
294 initialiser
(* gccext: *)
295 | InitGccName
of ident
(* name *) * string mcode
(*:*) *
297 | IComma
of string mcode
(* , *)
299 | OptIni
of initialiser
300 | UniqueIni
of initialiser
303 DesignatorField
of string mcode
(* . *) * ident
304 | DesignatorIndex
of string mcode
(* [ *) * expression
* string mcode
(* ] *)
306 string mcode
(* [ *) * expression
* string mcode
(* ... *) *
307 expression
* string mcode
(* ] *)
309 and initialiser
= base_initialiser wrap
311 (* --------------------------------------------------------------------- *)
314 and base_parameterTypeDef
=
315 VoidParam
of fullType
316 | Param
of fullType
* ident
option
318 | MetaParam
of meta_name mcode
* keep_binding
* inherited
319 | MetaParamList
of meta_name mcode
* listlen
option * keep_binding
*
322 | PComma
of string mcode
324 | Pdots
of string mcode
(* ... *)
325 | Pcircles
of string mcode
(* ooo *)
327 | OptParam
of parameterTypeDef
328 | UniqueParam
of parameterTypeDef
330 and parameterTypeDef
= base_parameterTypeDef wrap
332 and parameter_list
= parameterTypeDef dots
334 (* --------------------------------------------------------------------- *)
335 (* #define Parameters *)
337 and base_define_param
=
339 | DPComma
of string mcode
340 | DPdots
of string mcode
(* ... *)
341 | DPcircles
of string mcode
(* ooo *)
342 | OptDParam
of define_param
343 | UniqueDParam
of define_param
345 and define_param
= base_define_param wrap
347 and base_define_parameters
=
348 NoParams
(* not parameter list, not an empty one *)
349 | DParams
of string mcode
(*( *) * define_param dots
* string mcode
(* )*)
351 and define_parameters
= base_define_parameters wrap
353 (* --------------------------------------------------------------------- *)
356 (* PER = keep bindings separate, ALL = collect them *)
357 and meta_collect
= PER
| ALL
360 MetaPos
of meta_name mcode
* meta_name list
*
361 meta_collect
* keep_binding
* inherited
364 (* --------------------------------------------------------------------- *)
365 (* Function declaration *)
367 and storage
= Static
| Auto
| Register
| Extern
369 (* --------------------------------------------------------------------- *)
373 FunHeader
of mcodekind
(* before the function header *) *
374 bool (* true if all minus, for dropping static, etc *) *
375 fninfo list
* ident
(* name *) *
376 string mcode
(* ( *) * parameter_list
*
378 | Decl
of mcodekind
(* before the decl *) *
379 bool (* true if all minus *) * declaration
381 | SeqStart
of string mcode
(* { *)
382 | SeqEnd
of string mcode
(* } *)
384 | ExprStatement
of expression
* string mcode
(*;*)
385 | IfHeader
of string mcode
(* if *) * string mcode
(* ( *) *
386 expression
* string mcode
(* ) *)
387 | Else
of string mcode
(* else *)
388 | WhileHeader
of string mcode
(* while *) * string mcode
(* ( *) *
389 expression
* string mcode
(* ) *)
390 | DoHeader
of string mcode
(* do *)
391 | WhileTail
of string mcode
(* while *) * string mcode
(* ( *) *
392 expression
* string mcode
(* ) *) *
394 | ForHeader
of string mcode
(* for *) * string mcode
(* ( *) *
395 expression
option * string mcode
(*;*) *
396 expression
option * string mcode
(*;*) *
397 expression
option * string mcode
(* ) *)
398 | IteratorHeader
of ident
(* name *) * string mcode
(* ( *) *
399 expression dots
* string mcode
(* ) *)
400 | SwitchHeader
of string mcode
(* switch *) * string mcode
(* ( *) *
401 expression
* string mcode
(* ) *)
402 | Break
of string mcode
(* break *) * string mcode
(* ; *)
403 | Continue
of string mcode
(* continue *) * string mcode
(* ; *)
404 | Label
of ident
* string mcode
(* : *)
405 | Goto
of string mcode
(* goto *) * ident
* string mcode
(* ; *)
406 | Return
of string mcode
(* return *) * string mcode
(* ; *)
407 | ReturnExpr
of string mcode
(* return *) * expression
*
410 | MetaRuleElem
of meta_name mcode
* keep_binding
* inherited
411 | MetaStmt
of meta_name mcode
* keep_binding
* metaStmtInfo
*
413 | MetaStmtList
of meta_name mcode
* keep_binding
* inherited
415 | Exp
of expression
(* matches a subterm *)
416 | TopExp
of expression
(* for macros body, exp at top level,
418 | Ty
of fullType
(* only at SP top level, matches a subterm *)
419 | TopInit
of initialiser
(* only at top level *)
420 | Include
of string mcode
(*#include*) * inc_file mcode
(*file *)
421 | DefineHeader
of string mcode
(* #define *) * ident
(* name *) *
422 define_parameters
(*params*)
423 | Case
of string mcode
(* case *) * expression
* string mcode
(*:*)
424 | Default
of string mcode
(* default *) * string mcode
(*:*)
425 | DisjRuleElem
of rule_elem list
428 FStorage
of storage mcode
430 | FInline
of string mcode
431 | FAttr
of string mcode
434 NotSequencible
| SequencibleAfterDots
of dots_whencode list
| Sequencible
436 and rule_elem
= base_rule_elem wrap
439 Seq
of rule_elem
(* { *) *
440 statement dots
* rule_elem
(* } *)
441 | IfThen
of rule_elem
(* header *) * statement
* end_info
(* endif *)
442 | IfThenElse
of rule_elem
(* header *) * statement
*
443 rule_elem
(* else *) * statement
* end_info
(* endif *)
444 | While
of rule_elem
(* header *) * statement
* end_info
(*endwhile*)
445 | Do
of rule_elem
(* do *) * statement
* rule_elem
(* tail *)
446 | For
of rule_elem
(* header *) * statement
* end_info
(*endfor*)
447 | Iterator
of rule_elem
(* header *) * statement
* end_info
(*enditer*)
448 | Switch
of rule_elem
(* header *) * rule_elem
(* { *) *
449 case_line list
* rule_elem
(* } *)
450 | Atomic
of rule_elem
451 | Disj
of statement dots list
452 | Nest
of statement dots
*
453 (statement dots
,statement
) whencode list
* multi
*
454 dots_whencode list
* dots_whencode list
455 | FunDecl
of rule_elem
(* header *) * rule_elem
(* { *) *
456 statement dots
* rule_elem
(* } *)
457 | Define
of rule_elem
(* header *) * statement dots
458 | Dots
of string mcode
(* ... *) *
459 (statement dots
,statement
) whencode list
*
460 dots_whencode list
* dots_whencode list
461 | Circles
of string mcode
(* ooo *) *
462 (statement dots
,statement
) whencode list
*
463 dots_whencode list
* dots_whencode list
464 | Stars
of string mcode
(* *** *) *
465 (statement dots
,statement
) whencode list
*
466 dots_whencode list
* dots_whencode list
467 | OptStm
of statement
468 | UniqueStm
of statement
470 and ('a
,'b
) whencode
=
473 | WhenModifier
of when_modifier
474 | WhenNotTrue
of rule_elem
(* useful for fvs *)
475 | WhenNotFalse
of rule_elem
478 (* The following removes the shortest path constraint. It can be used
479 with other when modifiers *)
481 (* The following removes the special consideration of error paths. It
482 can be used with other when modifiers *)
487 (* only used with asttoctl *)
489 WParen
of rule_elem
* meta_name
(*pren_var*)
491 | Other_dots
of statement dots
493 and statement
= base_statement wrap
496 CaseLine
of rule_elem
(* case/default header *) * statement dots
497 | OptCase
of case_line
499 and case_line
= base_case_line wrap
502 Local
of inc_elem list
503 | NonLocal
of inc_elem list
511 | CODE
of statement dots
512 | FILEINFO
of string mcode
(* old file *) * string mcode
(* new file *)
513 | ERRORWORDS
of expression list
515 and top_level
= base_top_level wrap
518 CocciRulename
of string option * dependency
*
519 string list
* string list
* exists
* bool
520 | GeneratedRulename
of string option * dependency
*
521 string list
* string list
* exists
* bool
522 | ScriptRulename
of string * dependency
523 | InitialScriptRulename
of string
524 | FinalScriptRulename
of string
526 and ruletype
= Normal
| Generated
529 CocciRule
of string (* name *) *
530 (dependency
* string list
(* dropped isos *) * exists
) * top_level list
531 * bool list
* ruletype
532 | ScriptRule
of string * dependency
* (string * meta_name
) list
* string
533 | InitialScriptRule
of string (*language*) * string (*code*)
534 | FinalScriptRule
of string (*language*) * string (*code*)
537 Dep
of string (* rule applies for the current binding *)
538 | AntiDep
of string (* rule doesn't apply for the current binding *)
539 | EverDep
of string (* rule applies for some binding *)
540 | NeverDep
of string (* rule never applies for any binding *)
541 | AndDep
of dependency
* dependency
542 | OrDep
of dependency
* dependency
545 and rule_with_metavars
= metavar list
* rule
548 FullTypeTag
of fullType
549 | BaseTypeTag
of baseType
550 | StructUnionTag
of structUnion
553 | ExpressionTag
of expression
554 | ConstantTag
of constant
555 | UnaryOpTag
of unaryOp
556 | AssignOpTag
of assignOp
558 | BinaryOpTag
of binaryOp
559 | ArithOpTag
of arithOp
560 | LogicalOpTag
of logicalOp
561 | DeclarationTag
of declaration
562 | InitTag
of initialiser
563 | StorageTag
of storage
564 | IncFileTag
of inc_file
565 | Rule_elemTag
of rule_elem
566 | StatementTag
of statement
567 | CaseLineTag
of case_line
568 | ConstVolTag
of const_vol
569 | Token
of string * info
option
570 | Pragma
of string list
572 | ExprDotsTag
of expression dots
573 | ParamDotsTag
of parameterTypeDef dots
574 | StmtDotsTag
of statement dots
575 | DeclDotsTag
of declaration dots
577 | ParamTag
of parameterTypeDef
578 | SgrepStartTag
of string
579 | SgrepEndTag
of string
581 (* --------------------------------------------------------------------- *)
583 and exists
= Exists
| Forall
| ReverseForall
| Undetermined
585 (* --------------------------------------------------------------------- *)
587 let mkToken x
= Token
(x
,None
)
589 (* --------------------------------------------------------------------- *)
591 let rewrap model x
= {model
with node
= x
}
592 let rewrap_mcode (_
,a
,b
,c
) x
= (x
,a
,b
,c
)
593 let unwrap x
= x
.node
594 let unwrap_mcode (x
,_
,_
,_
) = x
595 let get_mcodekind (_
,_
,x
,_
) = x
596 let get_line x
= x
.node_line
597 let get_mcode_line (_
,l
,_
,_
) = l
.line
598 let get_mcode_col (_
,l
,_
,_
) = l
.column
599 let get_fvs x
= x
.free_vars
600 let set_fvs fvs x
= {x
with free_vars
= fvs
}
601 let get_mfvs x
= x
.minus_free_vars
602 let set_mfvs mfvs x
= {x
with minus_free_vars
= mfvs
}
603 let get_fresh x
= x
.fresh_vars
604 let get_inherited x
= x
.inherited
605 let get_saved x
= x
.saved_witness
606 let get_dots_bef_aft x
= x
.bef_aft
607 let set_dots_bef_aft d x
= {x
with bef_aft
= d
}
608 let get_pos x
= x
.pos_info
609 let set_pos x pos
= {x
with pos_info
= pos
}
610 let get_test_exp x
= x
.true_if_test_exp
611 let set_test_exp x
= {x
with true_if_test_exp
= true}
612 let get_isos x
= x
.iso_info
613 let set_isos x isos
= {x
with iso_info
= isos
}
614 let get_pos_var (_
,_
,_
,p
) = p
615 let set_pos_var vr
(a
,b
,c
,_
) = (a
,b
,c
,vr
)
616 let drop_pos (a
,b
,c
,_
) = (a
,b
,c
,NoMetaPos
)
618 let get_wcfvs (whencode
: ('a wrap
, 'b wrap
) whencode list
) =
622 WhenNot
(a
) -> get_fvs a
623 | WhenAlways
(a
) -> get_fvs a
624 | WhenModifier
(_
) -> []
625 | WhenNotTrue
(e
) -> get_fvs e
626 | WhenNotFalse
(e
) -> get_fvs e
)
629 (* --------------------------------------------------------------------- *)
631 let get_meta_name = function
632 MetaIdDecl
(ar
,nm
) -> nm
633 | MetaFreshIdDecl
(nm
,seed
) -> nm
634 | MetaTypeDecl
(ar
,nm
) -> nm
635 | MetaInitDecl
(ar
,nm
) -> nm
636 | MetaListlenDecl
(nm
) -> nm
637 | MetaParamDecl
(ar
,nm
) -> nm
638 | MetaParamListDecl
(ar
,nm
,nm1
) -> nm
639 | MetaConstDecl
(ar
,nm
,ty
) -> nm
640 | MetaErrDecl
(ar
,nm
) -> nm
641 | MetaExpDecl
(ar
,nm
,ty
) -> nm
642 | MetaIdExpDecl
(ar
,nm
,ty
) -> nm
643 | MetaLocalIdExpDecl
(ar
,nm
,ty
) -> nm
644 | MetaExpListDecl
(ar
,nm
,nm1
) -> nm
645 | MetaStmDecl
(ar
,nm
) -> nm
646 | MetaStmListDecl
(ar
,nm
) -> nm
647 | MetaFuncDecl
(ar
,nm
) -> nm
648 | MetaLocalFuncDecl
(ar
,nm
) -> nm
649 | MetaPosDecl
(ar
,nm
) -> nm
650 | MetaDeclarerDecl
(ar
,nm
) -> nm
651 | MetaIteratorDecl
(ar
,nm
) -> nm
653 (* --------------------------------------------------------------------- *)
656 FullTypeTag _
-> "FullTypeTag"
657 | BaseTypeTag _
-> "BaseTypeTag"
658 | StructUnionTag _
-> "StructUnionTag"
659 | SignTag _
-> "SignTag"
660 | IdentTag _
-> "IdentTag"
661 | ExpressionTag _
-> "ExpressionTag"
662 | ConstantTag _
-> "ConstantTag"
663 | UnaryOpTag _
-> "UnaryOpTag"
664 | AssignOpTag _
-> "AssignOpTag"
665 | FixOpTag _
-> "FixOpTag"
666 | BinaryOpTag _
-> "BinaryOpTag"
667 | ArithOpTag _
-> "ArithOpTag"
668 | LogicalOpTag _
-> "LogicalOpTag"
669 | DeclarationTag _
-> "DeclarationTag"
670 | InitTag _
-> "InitTag"
671 | StorageTag _
-> "StorageTag"
672 | IncFileTag _
-> "IncFileTag"
673 | Rule_elemTag _
-> "Rule_elemTag"
674 | StatementTag _
-> "StatementTag"
675 | CaseLineTag _
-> "CaseLineTag"
676 | ConstVolTag _
-> "ConstVolTag"
678 | Pragma _
-> "Pragma"
680 | ExprDotsTag _
-> "ExprDotsTag"
681 | ParamDotsTag _
-> "ParamDotsTag"
682 | StmtDotsTag _
-> "StmtDotsTag"
683 | DeclDotsTag _
-> "DeclDotsTag"
684 | TypeCTag _
-> "TypeCTag"
685 | ParamTag _
-> "ParamTag"
686 | SgrepStartTag _
-> "SgrepStartTag"
687 | SgrepEndTag _
-> "SgrepEndTag"
689 (* --------------------------------------------------------------------- *)
691 let no_info = { line
= 0; column
= -1; strbef
= []; straft
= [] }
697 minus_free_vars
= [];
703 true_if_test_exp
= false;
706 let make_meta_rule_elem s d
(fvs
,fresh
,inh
) =
708 (MetaRuleElem
((("",s
),no_info,d
,NoMetaPos
),Type_cocci.Unitary
,false)))
709 with free_vars
= fvs
; fresh_vars
= fresh
; inherited
= inh
}
711 let make_meta_decl s d
(fvs
,fresh
,inh
) =
713 (MetaDecl
((("",s
),no_info,d
,NoMetaPos
),Type_cocci.Unitary
,false))) with
714 free_vars
= fvs
; fresh_vars
= fresh
; inherited
= inh
}
716 let make_mcode x
= (x
,no_info,CONTEXT
(NoPos
,NOTHING
),NoMetaPos
)
718 (* --------------------------------------------------------------------- *)
720 let equal_pos x y
= x
= y
722 (* --------------------------------------------------------------------- *)