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
58 MINUS
of pos
* anything list list
59 | CONTEXT
of pos
* anything befaft
62 Real
of int (* charpos *) | Virt
of int * int (* charpos + offset *)
63 and pos
= NoPos
| DontCarePos
| FixPos
of (fixpos
* fixpos
)
67 | AddingBetweenDots
of statement
* int (*index of let var*)
68 | DroppingBetweenDots
of statement
* int (*index of let var*)
70 and inherited
= Type_cocci.inherited
71 and keep_binding
= Type_cocci.keep_binding
72 and multi
= bool (*true if a nest is one or more, false if it is zero or more*)
75 meta_name list
(*free vars*) * (meta_name
* string option) list
(*fresh*) *
76 meta_name list
(*inherited vars*) * mcodekind
78 (* --------------------------------------------------------------------- *)
81 and arity
= UNIQUE
| OPT
| MULTI
| NONE
84 MetaIdDecl
of arity
* meta_name
(* name *)
85 | MetaFreshIdDecl
of meta_name
(* name *) * string option (* seed *)
86 | MetaTypeDecl
of arity
* meta_name
(* name *)
87 | MetaInitDecl
of arity
* meta_name
(* name *)
88 | MetaListlenDecl
of meta_name
(* name *)
89 | MetaParamDecl
of arity
* meta_name
(* name *)
90 | MetaParamListDecl
of arity
* meta_name
(*name*) * meta_name
option (*len*)
92 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
93 | MetaErrDecl
of arity
* meta_name
(* name *)
95 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
97 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
98 | MetaLocalIdExpDecl
of
99 arity
* meta_name
(* name *) * Type_cocci.typeC list
option
100 | MetaExpListDecl
of arity
* meta_name
(*name*) * meta_name
option (*len*)
101 | MetaStmDecl
of arity
* meta_name
(* name *)
102 | MetaStmListDecl
of arity
* meta_name
(* name *)
103 | MetaFuncDecl
of arity
* meta_name
(* name *)
104 | MetaLocalFuncDecl
of arity
* meta_name
(* name *)
105 | MetaPosDecl
of arity
* meta_name
(* name *)
106 | MetaDeclarerDecl
of arity
* meta_name
(* name *)
107 | MetaIteratorDecl
of arity
* meta_name
(* name *)
109 (* --------------------------------------------------------------------- *)
110 (* --------------------------------------------------------------------- *)
118 and 'a dots
= 'a base_dots wrap
120 (* --------------------------------------------------------------------- *)
126 | MetaId
of meta_name mcode
* ident list
* keep_binding
* inherited
127 | MetaFunc
of meta_name mcode
* ident list
* keep_binding
* inherited
128 | MetaLocalFunc
of meta_name mcode
* ident list
* keep_binding
* inherited
131 | UniqueIdent
of ident
133 and ident
= base_ident wrap
135 (* --------------------------------------------------------------------- *)
138 and base_expression
=
140 | Constant
of constant mcode
141 | FunCall
of expression
* string mcode
(* ( *) *
142 expression dots
* string mcode
(* ) *)
143 | Assignment
of expression
* assignOp mcode
* expression
*
144 bool (* true if it can match an initialization *)
145 | CondExpr
of expression
* string mcode
(* ? *) * expression
option *
146 string mcode
(* : *) * expression
147 | Postfix
of expression
* fixOp mcode
148 | Infix
of expression
* fixOp mcode
149 | Unary
of expression
* unaryOp mcode
150 | Binary
of expression
* binaryOp mcode
* expression
151 | Nested
of expression
* binaryOp mcode
* expression
152 | ArrayAccess
of expression
* string mcode
(* [ *) * expression
*
154 | RecordAccess
of expression
* string mcode
(* . *) * ident
155 | RecordPtAccess
of expression
* string mcode
(* -> *) * ident
156 | Cast
of string mcode
(* ( *) * fullType
* string mcode
(* ) *) *
158 | SizeOfExpr
of string mcode
(* sizeof *) * expression
159 | SizeOfType
of string mcode
(* sizeof *) * string mcode
(* ( *) *
160 fullType
* string mcode
(* ) *)
161 | TypeExp
of fullType
(*type name used as an expression, only in
164 | Paren
of string mcode
(* ( *) * expression
*
167 | MetaErr
of meta_name mcode
* expression list
* keep_binding
*
169 | MetaExpr
of meta_name mcode
* expression list
* keep_binding
*
170 Type_cocci.typeC list
option * form
* inherited
171 | MetaExprList
of meta_name mcode
* listlen
option * keep_binding
*
172 inherited
(* only in arg lists *)
174 | EComma
of string mcode
(* only in arg lists *)
176 | DisjExpr
of expression list
177 | NestExpr
of expression dots
* expression
option * multi
179 (* can appear in arg lists, and also inside Nest, as in:
180 if(< ... X ... Y ...>)
181 In the following, the expression option is the WHEN *)
182 | Edots
of string mcode
(* ... *) * expression
option
183 | Ecircles
of string mcode
(* ooo *) * expression
option
184 | Estars
of string mcode
(* *** *) * expression
option
186 | OptExp
of expression
187 | UniqueExp
of expression
189 (* ANY = int E; ID = idexpression int X; CONST = constant int X; *)
190 and form
= ANY
| ID
| LocalID
| CONST
(* form for MetaExp *)
192 and expression
= base_expression wrap
194 and listlen
= meta_name mcode
* keep_binding
* inherited
196 and unaryOp
= GetRef
| DeRef
| UnPlus
| UnMinus
| Tilde
| Not
197 and assignOp
= SimpleAssign
| OpAssign
of arithOp
198 and fixOp
= Dec
| Inc
200 and binaryOp
= Arith
of arithOp
| Logical
of logicalOp
202 Plus
| Minus
| Mul
| Div
| Mod
| DecLeft
| DecRight
| And
| Or
| Xor
203 and logicalOp
= Inf
| Sup
| InfEq
| SupEq
| Eq
| NotEq
| AndLog
| OrLog
211 (* --------------------------------------------------------------------- *)
215 Type
of const_vol mcode
option * typeC
216 | DisjType
of fullType list
(* only after iso *)
217 | OptType
of fullType
218 | UniqueType
of fullType
221 BaseType
of baseType
* string mcode list
(* Yoann style *)
222 | SignedT
of sign mcode
* typeC
option
223 | Pointer
of fullType
* string mcode
(* * *)
224 | FunctionPointer
of fullType
*
225 string mcode
(* ( *)*string mcode
(* * *)*string mcode
(* ) *)*
226 string mcode
(* ( *)*parameter_list
*string mcode
(* ) *)
228 (* used for the automatic managment of prototypes *)
229 | FunctionType
of bool (* true if all minus for dropping return type *) *
231 string mcode
(* ( *) * parameter_list
*
234 | Array
of fullType
* string mcode
(* [ *) *
235 expression
option * string mcode
(* ] *)
236 | EnumName
of string mcode
(*enum*) * ident
(* name *)
237 | StructUnionName
of structUnion mcode
* ident
option (* name *)
238 | StructUnionDef
of fullType
(* either StructUnionName or metavar *) *
239 string mcode
(* { *) * declaration dots
* string mcode
(* } *)
240 | TypeName
of string mcode
(* pad: should be 'of ident' ? *)
242 | MetaType
of meta_name mcode
* keep_binding
* inherited
244 and fullType
= base_fullType wrap
245 and typeC
= base_typeC wrap
247 and baseType
= VoidType
| CharType
| ShortType
| IntType
| DoubleType
248 | FloatType
| LongType
| LongLongType
250 and structUnion
= Struct
| Union
252 and sign
= Signed
| Unsigned
254 and const_vol
= Const
| Volatile
256 (* --------------------------------------------------------------------- *)
257 (* Variable declaration *)
258 (* Even if the Cocci program specifies a list of declarations, they are
259 split out into multiple declarations of a single variable each. *)
261 and base_declaration
=
262 Init
of storage mcode
option * fullType
* ident
* string mcode
(*=*) *
263 initialiser
* string mcode
(*;*)
264 | UnInit
of storage mcode
option * fullType
* ident
* string mcode
(* ; *)
265 | TyDecl
of fullType
* string mcode
(* ; *)
266 | MacroDecl
of ident
(* name *) * string mcode
(* ( *) *
267 expression dots
* string mcode
(* ) *) * string mcode
(* ; *)
268 | Typedef
of string mcode
(*typedef*) * fullType
*
269 typeC
(* either TypeName or metavar *) * string mcode
(*;*)
270 | DisjDecl
of declaration list
271 (* Ddots is for a structure declaration *)
272 | Ddots
of string mcode
(* ... *) * declaration
option (* whencode *)
274 | MetaDecl
of meta_name mcode
* keep_binding
* inherited
276 | OptDecl
of declaration
277 | UniqueDecl
of declaration
279 and declaration
= base_declaration wrap
281 (* --------------------------------------------------------------------- *)
284 and base_initialiser
=
285 MetaInit
of meta_name mcode
* keep_binding
* inherited
286 | InitExpr
of expression
287 | InitList
of string mcode
(*{*) * initialiser list
* string mcode
(*}*) *
288 initialiser list
(* whencode: elements that shouldn't appear in init *)
290 designator list
(* name *) * string mcode
(*=*) *
291 initialiser
(* gccext: *)
292 | InitGccName
of ident
(* name *) * string mcode
(*:*) *
294 | IComma
of string mcode
(* , *)
296 | OptIni
of initialiser
297 | UniqueIni
of initialiser
300 DesignatorField
of string mcode
(* . *) * ident
301 | DesignatorIndex
of string mcode
(* [ *) * expression
* string mcode
(* ] *)
303 string mcode
(* [ *) * expression
* string mcode
(* ... *) *
304 expression
* string mcode
(* ] *)
306 and initialiser
= base_initialiser wrap
308 (* --------------------------------------------------------------------- *)
311 and base_parameterTypeDef
=
312 VoidParam
of fullType
313 | Param
of fullType
* ident
option
315 | MetaParam
of meta_name mcode
* keep_binding
* inherited
316 | MetaParamList
of meta_name mcode
* listlen
option * keep_binding
*
319 | PComma
of string mcode
321 | Pdots
of string mcode
(* ... *)
322 | Pcircles
of string mcode
(* ooo *)
324 | OptParam
of parameterTypeDef
325 | UniqueParam
of parameterTypeDef
327 and parameterTypeDef
= base_parameterTypeDef wrap
329 and parameter_list
= parameterTypeDef dots
331 (* --------------------------------------------------------------------- *)
332 (* #define Parameters *)
334 and base_define_param
=
336 | DPComma
of string mcode
337 | DPdots
of string mcode
(* ... *)
338 | DPcircles
of string mcode
(* ooo *)
339 | OptDParam
of define_param
340 | UniqueDParam
of define_param
342 and define_param
= base_define_param wrap
344 and base_define_parameters
=
345 NoParams
(* not parameter list, not an empty one *)
346 | DParams
of string mcode
(*( *) * define_param dots
* string mcode
(* )*)
348 and define_parameters
= base_define_parameters wrap
350 (* --------------------------------------------------------------------- *)
353 (* PER = keep bindings separate, ALL = collect them *)
354 and meta_collect
= PER
| ALL
357 MetaPos
of meta_name mcode
* meta_name list
*
358 meta_collect
* keep_binding
* inherited
361 (* --------------------------------------------------------------------- *)
362 (* Function declaration *)
364 and storage
= Static
| Auto
| Register
| Extern
366 (* --------------------------------------------------------------------- *)
370 FunHeader
of mcodekind
(* before the function header *) *
371 bool (* true if all minus, for dropping static, etc *) *
372 fninfo list
* ident
(* name *) *
373 string mcode
(* ( *) * parameter_list
*
375 | Decl
of mcodekind
(* before the decl *) *
376 bool (* true if all minus *) * declaration
378 | SeqStart
of string mcode
(* { *)
379 | SeqEnd
of string mcode
(* } *)
381 | ExprStatement
of expression
* string mcode
(*;*)
382 | IfHeader
of string mcode
(* if *) * string mcode
(* ( *) *
383 expression
* string mcode
(* ) *)
384 | Else
of string mcode
(* else *)
385 | WhileHeader
of string mcode
(* while *) * string mcode
(* ( *) *
386 expression
* string mcode
(* ) *)
387 | DoHeader
of string mcode
(* do *)
388 | WhileTail
of string mcode
(* while *) * string mcode
(* ( *) *
389 expression
* string mcode
(* ) *) *
391 | ForHeader
of string mcode
(* for *) * string mcode
(* ( *) *
392 expression
option * string mcode
(*;*) *
393 expression
option * string mcode
(*;*) *
394 expression
option * string mcode
(* ) *)
395 | IteratorHeader
of ident
(* name *) * string mcode
(* ( *) *
396 expression dots
* string mcode
(* ) *)
397 | SwitchHeader
of string mcode
(* switch *) * string mcode
(* ( *) *
398 expression
* string mcode
(* ) *)
399 | Break
of string mcode
(* break *) * string mcode
(* ; *)
400 | Continue
of string mcode
(* continue *) * string mcode
(* ; *)
401 | Label
of ident
* string mcode
(* : *)
402 | Goto
of string mcode
(* goto *) * ident
* string mcode
(* ; *)
403 | Return
of string mcode
(* return *) * string mcode
(* ; *)
404 | ReturnExpr
of string mcode
(* return *) * expression
*
407 | MetaRuleElem
of meta_name mcode
* keep_binding
* inherited
408 | MetaStmt
of meta_name mcode
* keep_binding
* metaStmtInfo
*
410 | MetaStmtList
of meta_name mcode
* keep_binding
* inherited
412 | Exp
of expression
(* matches a subterm *)
413 | TopExp
of expression
(* for macros body, exp at top level,
415 | Ty
of fullType
(* only at SP top level, matches a subterm *)
416 | TopInit
of initialiser
(* only at top level *)
417 | Include
of string mcode
(*#include*) * inc_file mcode
(*file *)
418 | DefineHeader
of string mcode
(* #define *) * ident
(* name *) *
419 define_parameters
(*params*)
420 | Case
of string mcode
(* case *) * expression
* string mcode
(*:*)
421 | Default
of string mcode
(* default *) * string mcode
(*:*)
422 | DisjRuleElem
of rule_elem list
425 FStorage
of storage mcode
427 | FInline
of string mcode
428 | FAttr
of string mcode
431 NotSequencible
| SequencibleAfterDots
of dots_whencode list
| Sequencible
433 and rule_elem
= base_rule_elem wrap
436 Seq
of rule_elem
(* { *) * statement dots
*
437 statement dots
* rule_elem
(* } *)
438 | IfThen
of rule_elem
(* header *) * statement
* end_info
(* endif *)
439 | IfThenElse
of rule_elem
(* header *) * statement
*
440 rule_elem
(* else *) * statement
* end_info
(* endif *)
441 | While
of rule_elem
(* header *) * statement
* end_info
(*endwhile*)
442 | Do
of rule_elem
(* do *) * statement
* rule_elem
(* tail *)
443 | For
of rule_elem
(* header *) * statement
* end_info
(*endfor*)
444 | Iterator
of rule_elem
(* header *) * statement
* end_info
(*enditer*)
445 | Switch
of rule_elem
(* header *) * rule_elem
(* { *) *
446 case_line list
* rule_elem
(* } *)
447 | Atomic
of rule_elem
448 | Disj
of statement dots list
449 | Nest
of statement dots
*
450 (statement dots
,statement
) whencode list
* multi
*
451 dots_whencode list
* dots_whencode list
452 | FunDecl
of rule_elem
(* header *) * rule_elem
(* { *) *
453 statement dots
* statement dots
* rule_elem
(* } *)
454 | Define
of rule_elem
(* header *) * statement dots
455 | Dots
of string mcode
(* ... *) *
456 (statement dots
,statement
) whencode list
*
457 dots_whencode list
* dots_whencode list
458 | Circles
of string mcode
(* ooo *) *
459 (statement dots
,statement
) whencode list
*
460 dots_whencode list
* dots_whencode list
461 | Stars
of string mcode
(* *** *) *
462 (statement dots
,statement
) whencode list
*
463 dots_whencode list
* dots_whencode list
464 | OptStm
of statement
465 | UniqueStm
of statement
467 and ('a
,'b
) whencode
=
470 | WhenModifier
of when_modifier
471 | WhenNotTrue
of rule_elem
(* useful for fvs *)
472 | WhenNotFalse
of rule_elem
475 (* The following removes the shortest path constraint. It can be used
476 with other when modifiers *)
478 (* The following removes the special consideration of error paths. It
479 can be used with other when modifiers *)
484 (* only used with asttoctl *)
486 WParen
of rule_elem
* meta_name
(*pren_var*)
488 | Other_dots
of statement dots
490 and statement
= base_statement wrap
493 CaseLine
of rule_elem
(* case/default header *) * statement dots
494 | OptCase
of case_line
496 and case_line
= base_case_line wrap
499 Local
of inc_elem list
500 | NonLocal
of inc_elem list
508 | CODE
of statement dots
509 | FILEINFO
of string mcode
(* old file *) * string mcode
(* new file *)
510 | ERRORWORDS
of expression list
512 and top_level
= base_top_level wrap
515 CocciRulename
of string option * dependency
*
516 string list
* string list
* exists
* bool
517 | GeneratedRulename
of string option * dependency
*
518 string list
* string list
* exists
* bool
519 | ScriptRulename
of string * dependency
520 | InitialScriptRulename
of string
521 | FinalScriptRulename
of string
523 and ruletype
= Normal
| Generated
526 CocciRule
of string (* name *) *
527 (dependency
* string list
(* dropped isos *) * exists
) * top_level list
528 * bool list
* ruletype
529 | ScriptRule
of string * dependency
* (string * meta_name
) list
* string
530 | InitialScriptRule
of string (*language*) * string (*code*)
531 | FinalScriptRule
of string (*language*) * string (*code*)
534 Dep
of string (* rule applies for the current binding *)
535 | AntiDep
of string (* rule doesn't apply for the current binding *)
536 | EverDep
of string (* rule applies for some binding *)
537 | NeverDep
of string (* rule never applies for any binding *)
538 | AndDep
of dependency
* dependency
539 | OrDep
of dependency
* dependency
542 and rule_with_metavars
= metavar list
* rule
545 FullTypeTag
of fullType
546 | BaseTypeTag
of baseType
547 | StructUnionTag
of structUnion
550 | ExpressionTag
of expression
551 | ConstantTag
of constant
552 | UnaryOpTag
of unaryOp
553 | AssignOpTag
of assignOp
555 | BinaryOpTag
of binaryOp
556 | ArithOpTag
of arithOp
557 | LogicalOpTag
of logicalOp
558 | DeclarationTag
of declaration
559 | InitTag
of initialiser
560 | StorageTag
of storage
561 | IncFileTag
of inc_file
562 | Rule_elemTag
of rule_elem
563 | StatementTag
of statement
564 | CaseLineTag
of case_line
565 | ConstVolTag
of const_vol
566 | Token
of string * info
option
567 | Pragma
of string list
569 | ExprDotsTag
of expression dots
570 | ParamDotsTag
of parameterTypeDef dots
571 | StmtDotsTag
of statement dots
572 | DeclDotsTag
of declaration dots
574 | ParamTag
of parameterTypeDef
575 | SgrepStartTag
of string
576 | SgrepEndTag
of string
578 (* --------------------------------------------------------------------- *)
580 and exists
= Exists
| Forall
| ReverseForall
| Undetermined
582 (* --------------------------------------------------------------------- *)
584 let mkToken x
= Token
(x
,None
)
586 (* --------------------------------------------------------------------- *)
588 let rewrap model x
= {model
with node
= x
}
589 let rewrap_mcode (_
,a
,b
,c
) x
= (x
,a
,b
,c
)
590 let unwrap x
= x
.node
591 let unwrap_mcode (x
,_
,_
,_
) = x
592 let get_mcodekind (_
,_
,x
,_
) = x
593 let get_line x
= x
.node_line
594 let get_mcode_line (_
,l
,_
,_
) = l
.line
595 let get_fvs x
= x
.free_vars
596 let set_fvs fvs x
= {x
with free_vars
= fvs
}
597 let get_mfvs x
= x
.minus_free_vars
598 let set_mfvs mfvs x
= {x
with minus_free_vars
= mfvs
}
599 let get_fresh x
= x
.fresh_vars
600 let get_inherited x
= x
.inherited
601 let get_saved x
= x
.saved_witness
602 let get_dots_bef_aft x
= x
.bef_aft
603 let set_dots_bef_aft d x
= {x
with bef_aft
= d
}
604 let get_pos x
= x
.pos_info
605 let set_pos x pos
= {x
with pos_info
= pos
}
606 let get_test_exp x
= x
.true_if_test_exp
607 let set_test_exp x
= {x
with true_if_test_exp
= true}
608 let get_isos x
= x
.iso_info
609 let set_isos x isos
= {x
with iso_info
= isos
}
610 let get_pos_var (_
,_
,_
,p
) = p
611 let set_pos_var vr
(a
,b
,c
,_
) = (a
,b
,c
,vr
)
612 let drop_pos (a
,b
,c
,_
) = (a
,b
,c
,NoMetaPos
)
614 let get_wcfvs (whencode
: ('a wrap
, 'b wrap
) whencode list
) =
618 WhenNot
(a
) -> get_fvs a
619 | WhenAlways
(a
) -> get_fvs a
620 | WhenModifier
(_
) -> []
621 | WhenNotTrue
(e
) -> get_fvs e
622 | WhenNotFalse
(e
) -> get_fvs e
)
625 (* --------------------------------------------------------------------- *)
627 let get_meta_name = function
628 MetaIdDecl
(ar
,nm
) -> nm
629 | MetaFreshIdDecl
(nm
,seed
) -> nm
630 | MetaTypeDecl
(ar
,nm
) -> nm
631 | MetaInitDecl
(ar
,nm
) -> nm
632 | MetaListlenDecl
(nm
) -> nm
633 | MetaParamDecl
(ar
,nm
) -> nm
634 | MetaParamListDecl
(ar
,nm
,nm1
) -> nm
635 | MetaConstDecl
(ar
,nm
,ty
) -> nm
636 | MetaErrDecl
(ar
,nm
) -> nm
637 | MetaExpDecl
(ar
,nm
,ty
) -> nm
638 | MetaIdExpDecl
(ar
,nm
,ty
) -> nm
639 | MetaLocalIdExpDecl
(ar
,nm
,ty
) -> nm
640 | MetaExpListDecl
(ar
,nm
,nm1
) -> nm
641 | MetaStmDecl
(ar
,nm
) -> nm
642 | MetaStmListDecl
(ar
,nm
) -> nm
643 | MetaFuncDecl
(ar
,nm
) -> nm
644 | MetaLocalFuncDecl
(ar
,nm
) -> nm
645 | MetaPosDecl
(ar
,nm
) -> nm
646 | MetaDeclarerDecl
(ar
,nm
) -> nm
647 | MetaIteratorDecl
(ar
,nm
) -> nm
649 (* --------------------------------------------------------------------- *)
652 FullTypeTag _
-> "FullTypeTag"
653 | BaseTypeTag _
-> "BaseTypeTag"
654 | StructUnionTag _
-> "StructUnionTag"
655 | SignTag _
-> "SignTag"
656 | IdentTag _
-> "IdentTag"
657 | ExpressionTag _
-> "ExpressionTag"
658 | ConstantTag _
-> "ConstantTag"
659 | UnaryOpTag _
-> "UnaryOpTag"
660 | AssignOpTag _
-> "AssignOpTag"
661 | FixOpTag _
-> "FixOpTag"
662 | BinaryOpTag _
-> "BinaryOpTag"
663 | ArithOpTag _
-> "ArithOpTag"
664 | LogicalOpTag _
-> "LogicalOpTag"
665 | DeclarationTag _
-> "DeclarationTag"
666 | InitTag _
-> "InitTag"
667 | StorageTag _
-> "StorageTag"
668 | IncFileTag _
-> "IncFileTag"
669 | Rule_elemTag _
-> "Rule_elemTag"
670 | StatementTag _
-> "StatementTag"
671 | CaseLineTag _
-> "CaseLineTag"
672 | ConstVolTag _
-> "ConstVolTag"
674 | Pragma _
-> "Pragma"
676 | ExprDotsTag _
-> "ExprDotsTag"
677 | ParamDotsTag _
-> "ParamDotsTag"
678 | StmtDotsTag _
-> "StmtDotsTag"
679 | DeclDotsTag _
-> "DeclDotsTag"
680 | TypeCTag _
-> "TypeCTag"
681 | ParamTag _
-> "ParamTag"
682 | SgrepStartTag _
-> "SgrepStartTag"
683 | SgrepEndTag _
-> "SgrepEndTag"
685 (* --------------------------------------------------------------------- *)
687 let no_info = { line
= 0; column
= 0; strbef
= []; straft
= [] }
693 minus_free_vars
= [];
699 true_if_test_exp
= false;
702 let make_meta_rule_elem s d
(fvs
,fresh
,inh
) =
704 (MetaRuleElem
((("",s
),no_info,d
,NoMetaPos
),Type_cocci.Unitary
,false)))
705 with free_vars
= fvs
; fresh_vars
= fresh
; inherited
= inh
}
707 let make_meta_decl s d
(fvs
,fresh
,inh
) =
709 (MetaDecl
((("",s
),no_info,d
,NoMetaPos
),Type_cocci.Unitary
,false))) with
710 free_vars
= fvs
; fresh_vars
= fresh
; inherited
= inh
}
712 let make_mcode x
= (x
,no_info,CONTEXT
(NoPos
,NOTHING
),NoMetaPos
)
714 (* --------------------------------------------------------------------- *)
716 let equal_pos x y
= x
= y
718 (* --------------------------------------------------------------------- *)