1 (* generated by ocamltarzan with: camlp4o -o /tmp/yyy.ml -I pa/ pa_type_conv.cmo pa_sexp_conv.cmo pr_o.cmo /tmp/xxx.ml *)
5 let sexp_of_program x =
10 module Common
= Sexp_common
11 module Ast_cocci
= struct
12 let mcodekind_of_sexp x
= failwith
"todo"
13 let sexp_of_mcodekind x
= failwith
"todo"
14 let fixpos_of_sexp x
= failwith
"todo"
15 let sexp_of_fixpos x
= failwith
"todo"
17 module Token_c
= struct
18 let comment_like_token_of_sexp x
= failwith
"todo"
19 let sexp_of_comment_like_token x
= failwith
"todo"
21 (* cf also the failwith and comment I have added in this file
22 (C-s failwith et C-s ( * )
23 mainly to break the mutually recursive, for the cocci_tag and
24 metavars_binding stuff. I also moved some function up
25 outside the big 'rec .. and .. and .. and', especially the wrap_of_sexp
26 by transforming some 'and xxx' in 'let xxx'.
29 let show_info = ref false
30 let show_qualifier = ref false
31 let show_expr_info = ref true
39 | Sexp.List
([ v1
; v2
]) ->
40 let v1 = Conv.int_of_sexp
v1 and v2
= Conv.int_of_sexp v2
in (v1, v2
)
41 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
43 let posl_of_sexp sexp
=
44 try posl_of_sexp__ sexp
46 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
48 let sexp_of_posl (v1, v2
) =
49 let v1 = Conv.sexp_of_int
v1
50 and v2
= Conv.sexp_of_int v2
51 in Sexp.List
[ v1; v2
]
53 let virtual_position_of_sexp__ =
54 let _loc = "Xxx.virtual_position"
57 | Sexp.List
([ v1; v2
]) ->
58 let v1 = Common.parse_info_of_sexp
v1
59 and v2
= Conv.int_of_sexp v2
61 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
63 let virtual_position_of_sexp sexp
=
64 try virtual_position_of_sexp__ sexp
66 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
68 let sexp_of_virtual_position (v1, v2
) =
69 let v1 = Common.sexp_of_parse_info
v1
70 and v2
= Conv.sexp_of_int v2
71 in Sexp.List
[ v1; v2
]
73 let parse_info_of_sexp__ =
74 let _loc = "Xxx.parse_info"
78 (Sexp.Atom
(("originTok" | "OriginTok" as tag
)) :: sexp_args
)
81 | [ v1 ] -> let v1 = Common.parse_info_of_sexp
v1 in OriginTok
v1
82 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
83 | (Sexp.List
(Sexp.Atom
(("fakeTok" | "FakeTok" as tag
)) :: sexp_args
) as
87 let v1 = Conv.string_of_sexp
v1
88 and v2
= virtual_position_of_sexp v2
90 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
92 (Sexp.Atom
(("expandedTok" | "ExpandedTok" as tag
)) :: sexp_args
)
96 let v1 = Common.parse_info_of_sexp
v1
97 and v2
= virtual_position_of_sexp v2
98 in ExpandedTok
((v1, v2
))
99 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
101 (Sexp.Atom
(("abstractLineTok" | "AbstractLineTok" as tag
)) ::
104 (match sexp_args
with
106 let v1 = Common.parse_info_of_sexp
v1 in AbstractLineTok
v1
107 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
108 | (Sexp.Atom
("originTok" | "OriginTok") as sexp
) ->
109 Conv_error.stag_takes_args
_loc sexp
110 | (Sexp.Atom
("fakeTok" | "FakeTok") as sexp
) ->
111 Conv_error.stag_takes_args
_loc sexp
112 | (Sexp.Atom
("expandedTok" | "ExpandedTok") as sexp
) ->
113 Conv_error.stag_takes_args
_loc sexp
114 | (Sexp.Atom
("abstractLineTok" | "AbstractLineTok") as sexp
) ->
115 Conv_error.stag_takes_args
_loc sexp
116 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
117 Conv_error.nested_list_invalid_sum
_loc sexp
118 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
119 | sexp
-> Conv_error.unexpected_stag
_loc sexp
121 let parse_info_of_sexp sexp
= parse_info_of_sexp__ sexp
123 let sexp_of_parse_info =
126 let v1 = Common.sexp_of_parse_info v1
127 in Sexp.List
[ Sexp.Atom
"OriginTok"; v1 ]
128 | FakeTok
((v1, v2
)) ->
129 let v1 = Conv.sexp_of_string
v1
130 and v2
= sexp_of_virtual_position v2
131 in Sexp.List
[ Sexp.Atom
"FakeTok"; v1; v2
]
132 | ExpandedTok
((v1, v2
)) ->
133 let v1 = Common.sexp_of_parse_info v1
134 and v2
= sexp_of_virtual_position v2
135 in Sexp.List
[ Sexp.Atom
"ExpandedTok"; v1; v2
]
136 | AbstractLineTok
v1 ->
137 let v1 = Common.sexp_of_parse_info v1
138 in Sexp.List
[ Sexp.Atom
"AbstractLineTok"; v1 ]
140 let rec info_of_sexp__ =
141 let _loc = "Xxx.info"
144 | (Sexp.List field_sexps
as sexp
) ->
145 let pinfo_field = ref None
and cocci_tag_field
= ref None
146 and comments_tag_field
= ref None
and duplicates
= ref []
147 and extra
= ref [] in
150 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
151 ((match field_name
with
153 (match !pinfo_field with
155 let fvalue = parse_info_of_sexp field_sexp
156 in pinfo_field := Some
fvalue
157 | Some _
-> duplicates
:= field_name
:: !duplicates
)
159 (match !cocci_tag_field
with
165 | Sexp.List
([ v1; v2
]) ->
166 let v1 = Ast_cocci.mcodekind_of_sexp v1
168 (*metavars_binding_of_sexp v2*)
172 Conv_error.tuple_of_size_n_expected
175 in cocci_tag_field
:= Some
fvalue
176 | Some _
-> duplicates
:= field_name
:: !duplicates
)
178 (match !comments_tag_field
with
181 Conv.ref_of_sexp comments_around_of_sexp
183 in comments_tag_field
:= Some
fvalue
184 | Some _
-> duplicates
:= field_name
:: !duplicates
)
186 if !Conv.record_check_extra_fields
187 then extra
:= field_name
:: !extra
190 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
195 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
198 then Conv_error.record_extra_fields
_loc !extra sexp
200 (match ((!pinfo_field), (!cocci_tag_field
),
201 (!comments_tag_field
))
203 | (Some pinfo_value
, Some cocci_tag_value
,
204 Some comments_tag_value
) ->
207 cocci_tag
= cocci_tag_value
;
208 comments_tag
= comments_tag_value
;
211 Conv_error.record_undefined_elements
_loc sexp
212 [ ((!pinfo_field = None
), "pinfo");
213 ((!cocci_tag_field
= None
), "cocci_tag");
214 ((!comments_tag_field
= None
), "comments_tag") ]))
215 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
216 and info_of_sexp sexp
= info_of_sexp__ sexp
218 let _loc = "Xxx.il" in fun sexp
-> Conv.list_of_sexp info_of_sexp sexp
219 and il_of_sexp sexp
=
220 try il_of_sexp__ sexp
222 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
224 let _loc = "Xxx.wrap"
228 | Sexp.List
([ v1; v2
]) ->
229 let v1 = _of_a
v1 and v2
= il_of_sexp v2
in (v1, v2
)
230 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
231 and wrap_of_sexp _of_a sexp
=
232 try wrap_of_sexp__ _of_a sexp
234 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
235 and wrap2_of_sexp__
=
236 let _loc = "Xxx.wrap2"
240 | Sexp.List
([ v1; v2
]) ->
241 let v1 = _of_a
v1 and v2
= il_of_sexp v2
in (v1, v2
)
242 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
243 and wrap2_of_sexp _of_a sexp
=
244 try wrap2_of_sexp__ _of_a sexp
246 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
249 and comments_around_of_sexp__
=
250 let _loc = "Xxx.comments_around"
253 | (Sexp.List field_sexps
as sexp
) ->
254 let mbefore_field = ref None
and mafter_field
= ref None
255 and mbefore2_field
= ref None
and mafter2_field
= ref None
256 and duplicates
= ref [] and extra
= ref [] in
259 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
260 ((match field_name
with
262 (match !mbefore_field with
265 Conv.list_of_sexp
Token_c.
266 comment_like_token_of_sexp field_sexp
267 in mbefore_field := Some
fvalue
268 | Some _
-> duplicates
:= field_name
:: !duplicates
)
270 (match !mafter_field
with
273 Conv.list_of_sexp
Token_c.
274 comment_like_token_of_sexp field_sexp
275 in mafter_field
:= Some
fvalue
276 | Some _
-> duplicates
:= field_name
:: !duplicates
)
278 (match !mbefore2_field
with
282 comment_and_relative_pos_of_sexp field_sexp
283 in mbefore2_field
:= Some
fvalue
284 | Some _
-> duplicates
:= field_name
:: !duplicates
)
286 (match !mafter2_field
with
290 comment_and_relative_pos_of_sexp field_sexp
291 in mafter2_field
:= Some
fvalue
292 | Some _
-> duplicates
:= field_name
:: !duplicates
)
294 if !Conv.record_check_extra_fields
295 then extra
:= field_name
:: !extra
298 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
303 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
306 then Conv_error.record_extra_fields
_loc !extra sexp
308 (match ((!mbefore_field), (!mafter_field
), (!mbefore2_field
),
311 | (Some mbefore_value
, Some mafter_value
,
312 Some mbefore2_value
, Some mafter2_value
) ->
314 mbefore
= mbefore_value
;
315 mafter
= mafter_value
;
316 mbefore2
= mbefore2_value
;
317 mafter2
= mafter2_value
;
320 Conv_error.record_undefined_elements
_loc sexp
321 [ ((!mbefore_field = None
), "mbefore");
322 ((!mafter_field
= None
), "mafter");
323 ((!mbefore2_field
= None
), "mbefore2");
324 ((!mafter2_field
= None
), "mafter2") ]))
325 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
326 and comments_around_of_sexp sexp
= comments_around_of_sexp__ sexp
327 and comment_and_relative_pos_of_sexp__
=
328 let _loc = "Xxx.comment_and_relative_pos"
331 | (Sexp.List field_sexps
as sexp
) ->
332 let minfo_field = ref None
and mpos_field
= ref None
333 and duplicates
= ref [] and extra
= ref [] in
336 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
337 ((match field_name
with
339 (match !minfo_field with
341 let fvalue = Common.parse_info_of_sexp field_sexp
342 in minfo_field := Some
fvalue
343 | Some _
-> duplicates
:= field_name
:: !duplicates
)
345 (match !mpos_field
with
347 let fvalue = Conv.int_of_sexp field_sexp
348 in mpos_field
:= Some
fvalue
349 | Some _
-> duplicates
:= field_name
:: !duplicates
)
351 if !Conv.record_check_extra_fields
352 then extra
:= field_name
:: !extra
355 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
360 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
363 then Conv_error.record_extra_fields
_loc !extra sexp
365 (match ((!minfo_field), (!mpos_field
)) with
366 | (Some minfo_value
, Some mpos_value
) ->
367 { minfo
= minfo_value
; mpos
= mpos_value
; }
369 Conv_error.record_undefined_elements
_loc sexp
370 [ ((!minfo_field = None
), "minfo");
371 ((!mpos_field
= None
), "mpos") ]))
372 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
373 and comment_and_relative_pos_of_sexp sexp
=
374 comment_and_relative_pos_of_sexp__ sexp
375 and comment_of_sexp__
=
376 let _loc = "Xxx.comment" in fun sexp
-> Common.parse_info_of_sexp sexp
377 and comment_of_sexp sexp
=
378 try comment_of_sexp__ sexp
380 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
383 in fun sexp
-> Conv.ref_of_sexp
(Conv.list_of_sexp comment_of_sexp
) sexp
384 and com_of_sexp sexp
=
385 try com_of_sexp__ sexp
387 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
395 (* break let rec ... and with the previous info *)
396 let rec name_of_sexp__ =
397 let _loc = "Xxx.name"
401 (Sexp.Atom
(("regularName" | "RegularName" as tag
)) :: sexp_args
)
403 (match sexp_args
with
405 let v1 = wrap_of_sexp
Conv.string_of_sexp
v1 in RegularName
v1
406 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
408 (Sexp.Atom
(("cppConcatenatedName" | "CppConcatenatedName" as tag
)) ::
411 (match sexp_args
with
415 (wrap2_of_sexp
(wrap_of_sexp
Conv.string_of_sexp
)) v1
416 in CppConcatenatedName
v1
417 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
419 (Sexp.Atom
(("cppVariadicName" | "CppVariadicName" as tag
)) ::
422 (match sexp_args
with
424 let v1 = wrap_of_sexp
Conv.string_of_sexp
v1
425 in CppVariadicName
v1
426 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
428 (Sexp.Atom
(("cppIdentBuilder" | "CppIdentBuilder" as tag
)) ::
431 (match sexp_args
with
433 let v1 = wrap_of_sexp
Conv.string_of_sexp
v1
436 (wrap2_of_sexp
(wrap_of_sexp
Conv.string_of_sexp
)) v2
437 in CppIdentBuilder
((v1, v2
))
438 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
439 | (Sexp.Atom
("regularName" | "RegularName") as sexp
) ->
440 Conv_error.stag_takes_args
_loc sexp
441 | (Sexp.Atom
("cppConcatenatedName" | "CppConcatenatedName") as sexp
) ->
442 Conv_error.stag_takes_args
_loc sexp
443 | (Sexp.Atom
("cppVariadicName" | "CppVariadicName") as sexp
) ->
444 Conv_error.stag_takes_args
_loc sexp
445 | (Sexp.Atom
("cppIdentBuilder" | "CppIdentBuilder") as sexp
) ->
446 Conv_error.stag_takes_args
_loc sexp
447 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
448 Conv_error.nested_list_invalid_sum
_loc sexp
449 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
450 | sexp
-> Conv_error.unexpected_stag
_loc sexp
451 and name_of_sexp sexp
= name_of_sexp__ sexp
452 and fullType_of_sexp__
=
453 let _loc = "Xxx.fullType"
456 | Sexp.List
([ v1; v2
]) ->
457 let v1 = typeQualifier_of_sexp
v1
458 and v2
= typeC_of_sexp v2
460 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
461 and fullType_of_sexp sexp
=
462 try fullType_of_sexp__ sexp
464 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
465 and typeC_of_sexp__
=
466 let _loc = "Xxx.typeC" in fun sexp
-> wrap_of_sexp typeCbis_of_sexp sexp
467 and typeC_of_sexp sexp
=
468 try typeC_of_sexp__ sexp
470 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
471 and typeCbis_of_sexp__
=
472 let _loc = "Xxx.typeCbis"
475 | (Sexp.List
(Sexp.Atom
(("baseType" | "BaseType" as tag
)) :: sexp_args
)
477 (match sexp_args
with
478 | [ v1 ] -> let v1 = baseType_of_sexp
v1 in BaseType
v1
479 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
480 | (Sexp.List
(Sexp.Atom
(("pointer" | "Pointer" as tag
)) :: sexp_args
) as
482 (match sexp_args
with
483 | [ v1 ] -> let v1 = fullType_of_sexp
v1 in Pointer
v1
484 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
485 | (Sexp.List
(Sexp.Atom
(("array" | "Array" as tag
)) :: sexp_args
) as
487 (match sexp_args
with
489 let v1 = Conv.option_of_sexp constExpression_of_sexp
v1
490 and v2
= fullType_of_sexp v2
492 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
494 (Sexp.Atom
(("functionType" | "FunctionType" as tag
)) :: sexp_args
)
496 (match sexp_args
with
497 | [ v1 ] -> let v1 = functionType_of_sexp
v1 in FunctionType
v1
498 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
499 | (Sexp.List
(Sexp.Atom
(("enum" | "Enum" as tag
)) :: sexp_args
) as sexp
)
501 (match sexp_args
with
503 let v1 = Conv.option_of_sexp
Conv.string_of_sexp
v1
504 and v2
= enumType_of_sexp v2
506 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
508 (Sexp.Atom
(("structUnion" | "StructUnion" as tag
)) :: sexp_args
)
510 (match sexp_args
with
512 let v1 = structUnion_of_sexp
v1
513 and v2
= Conv.option_of_sexp
Conv.string_of_sexp v2
514 and v3
= structType_of_sexp v3
515 in StructUnion
((v1, v2
, v3
))
516 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
517 | (Sexp.List
(Sexp.Atom
(("enumName" | "EnumName" as tag
)) :: sexp_args
)
519 (match sexp_args
with
520 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in EnumName
v1
521 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
523 (Sexp.Atom
(("structUnionName" | "StructUnionName" as tag
)) ::
526 (match sexp_args
with
528 let v1 = structUnion_of_sexp
v1
529 and v2
= Conv.string_of_sexp v2
530 in StructUnionName
((v1, v2
))
531 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
532 | (Sexp.List
(Sexp.Atom
(("typeName" | "TypeName" as tag
)) :: sexp_args
)
534 (match sexp_args
with
536 let v1 = name_of_sexp
v1
537 and v2
= Conv.option_of_sexp fullType_of_sexp v2
538 in TypeName
((v1, v2
))
539 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
541 (Sexp.Atom
(("parenType" | "ParenType" as tag
)) :: sexp_args
)
543 (match sexp_args
with
544 | [ v1 ] -> let v1 = fullType_of_sexp
v1 in ParenType
v1
545 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
547 (Sexp.Atom
(("typeOfExpr" | "TypeOfExpr" as tag
)) :: sexp_args
)
549 (match sexp_args
with
550 | [ v1 ] -> let v1 = expression_of_sexp
v1 in TypeOfExpr
v1
551 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
553 (Sexp.Atom
(("typeOfType" | "TypeOfType" as tag
)) :: sexp_args
)
555 (match sexp_args
with
556 | [ v1 ] -> let v1 = fullType_of_sexp
v1 in TypeOfType
v1
557 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
558 | (Sexp.Atom
("baseType" | "BaseType") as sexp
) ->
559 Conv_error.stag_takes_args
_loc sexp
560 | (Sexp.Atom
("pointer" | "Pointer") as sexp
) ->
561 Conv_error.stag_takes_args
_loc sexp
562 | (Sexp.Atom
("array" | "Array") as sexp
) ->
563 Conv_error.stag_takes_args
_loc sexp
564 | (Sexp.Atom
("functionType" | "FunctionType") as sexp
) ->
565 Conv_error.stag_takes_args
_loc sexp
566 | (Sexp.Atom
("enum" | "Enum") as sexp
) ->
567 Conv_error.stag_takes_args
_loc sexp
568 | (Sexp.Atom
("structUnion" | "StructUnion") as sexp
) ->
569 Conv_error.stag_takes_args
_loc sexp
570 | (Sexp.Atom
("enumName" | "EnumName") as sexp
) ->
571 Conv_error.stag_takes_args
_loc sexp
572 | (Sexp.Atom
("structUnionName" | "StructUnionName") as sexp
) ->
573 Conv_error.stag_takes_args
_loc sexp
574 | (Sexp.Atom
("typeName" | "TypeName") as sexp
) ->
575 Conv_error.stag_takes_args
_loc sexp
576 | (Sexp.Atom
("parenType" | "ParenType") as sexp
) ->
577 Conv_error.stag_takes_args
_loc sexp
578 | (Sexp.Atom
("typeOfExpr" | "TypeOfExpr") as sexp
) ->
579 Conv_error.stag_takes_args
_loc sexp
580 | (Sexp.Atom
("typeOfType" | "TypeOfType") as sexp
) ->
581 Conv_error.stag_takes_args
_loc sexp
582 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
583 Conv_error.nested_list_invalid_sum
_loc sexp
584 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
585 | sexp
-> Conv_error.unexpected_stag
_loc sexp
586 and typeCbis_of_sexp sexp
= typeCbis_of_sexp__ sexp
587 and baseType_of_sexp__
=
588 let _loc = "Xxx.baseType"
591 | Sexp.Atom
("void" | "Void") -> Void
592 | (Sexp.List
(Sexp.Atom
(("intType" | "IntType" as tag
)) :: sexp_args
) as
594 (match sexp_args
with
595 | [ v1 ] -> let v1 = intType_of_sexp
v1 in IntType
v1
596 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
598 (Sexp.Atom
(("floatType" | "FloatType" as tag
)) :: sexp_args
)
600 (match sexp_args
with
601 | [ v1 ] -> let v1 = floatType_of_sexp
v1 in FloatType
v1
602 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
603 | (Sexp.List
(Sexp.Atom
("void" | "Void") :: _
) as sexp
) ->
604 Conv_error.stag_no_args
_loc sexp
605 | (Sexp.Atom
("intType" | "IntType") as sexp
) ->
606 Conv_error.stag_takes_args
_loc sexp
607 | (Sexp.Atom
("floatType" | "FloatType") as sexp
) ->
608 Conv_error.stag_takes_args
_loc sexp
609 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
610 Conv_error.nested_list_invalid_sum
_loc sexp
611 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
612 | sexp
-> Conv_error.unexpected_stag
_loc sexp
613 and baseType_of_sexp sexp
= baseType_of_sexp__ sexp
614 and intType_of_sexp__
=
615 let _loc = "Xxx.intType"
618 | Sexp.Atom
("cChar" | "CChar") -> CChar
619 | (Sexp.List
(Sexp.Atom
(("si" | "Si" as tag
)) :: sexp_args
) as sexp
) ->
620 (match sexp_args
with
621 | [ v1 ] -> let v1 = signed_of_sexp
v1 in Si
v1
622 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
623 | (Sexp.List
(Sexp.Atom
("cChar" | "CChar") :: _
) as sexp
) ->
624 Conv_error.stag_no_args
_loc sexp
625 | (Sexp.Atom
("si" | "Si") as sexp
) ->
626 Conv_error.stag_takes_args
_loc sexp
627 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
628 Conv_error.nested_list_invalid_sum
_loc sexp
629 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
630 | sexp
-> Conv_error.unexpected_stag
_loc sexp
631 and intType_of_sexp sexp
= intType_of_sexp__ sexp
632 and signed_of_sexp__
=
633 let _loc = "Xxx.signed"
636 | Sexp.List
([ v1; v2
]) ->
637 let v1 = sign_of_sexp
v1 and v2
= base_of_sexp v2
in (v1, v2
)
638 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
639 and signed_of_sexp sexp
=
640 try signed_of_sexp__ sexp
642 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
644 let _loc = "Xxx.base"
647 | Sexp.Atom
("cChar2" | "CChar2") -> CChar2
648 | Sexp.Atom
("cShort" | "CShort") -> CShort
649 | Sexp.Atom
("cInt" | "CInt") -> CInt
650 | Sexp.Atom
("cLong" | "CLong") -> CLong
651 | Sexp.Atom
("cLongLong" | "CLongLong") -> CLongLong
652 | (Sexp.List
(Sexp.Atom
("cChar2" | "CChar2") :: _
) as sexp
) ->
653 Conv_error.stag_no_args
_loc sexp
654 | (Sexp.List
(Sexp.Atom
("cShort" | "CShort") :: _
) as sexp
) ->
655 Conv_error.stag_no_args
_loc sexp
656 | (Sexp.List
(Sexp.Atom
("cInt" | "CInt") :: _
) as sexp
) ->
657 Conv_error.stag_no_args
_loc sexp
658 | (Sexp.List
(Sexp.Atom
("cLong" | "CLong") :: _
) as sexp
) ->
659 Conv_error.stag_no_args
_loc sexp
660 | (Sexp.List
(Sexp.Atom
("cLongLong" | "CLongLong") :: _
) as sexp
) ->
661 Conv_error.stag_no_args
_loc sexp
662 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
663 Conv_error.nested_list_invalid_sum
_loc sexp
664 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
665 | sexp
-> Conv_error.unexpected_stag
_loc sexp
666 and base_of_sexp sexp
= base_of_sexp__ sexp
668 let _loc = "Xxx.sign"
671 | Sexp.Atom
("signed" | "Signed") -> Signed
672 | Sexp.Atom
("unSigned" | "UnSigned") -> UnSigned
673 | (Sexp.List
(Sexp.Atom
("signed" | "Signed") :: _
) as sexp
) ->
674 Conv_error.stag_no_args
_loc sexp
675 | (Sexp.List
(Sexp.Atom
("unSigned" | "UnSigned") :: _
) as sexp
) ->
676 Conv_error.stag_no_args
_loc sexp
677 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
678 Conv_error.nested_list_invalid_sum
_loc sexp
679 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
680 | sexp
-> Conv_error.unexpected_stag
_loc sexp
681 and sign_of_sexp sexp
= sign_of_sexp__ sexp
682 and floatType_of_sexp__
=
683 let _loc = "Xxx.floatType"
686 | Sexp.Atom
("cFloat" | "CFloat") -> CFloat
687 | Sexp.Atom
("cDouble" | "CDouble") -> CDouble
688 | Sexp.Atom
("cLongDouble" | "CLongDouble") -> CLongDouble
689 | (Sexp.List
(Sexp.Atom
("cFloat" | "CFloat") :: _
) as sexp
) ->
690 Conv_error.stag_no_args
_loc sexp
691 | (Sexp.List
(Sexp.Atom
("cDouble" | "CDouble") :: _
) as sexp
) ->
692 Conv_error.stag_no_args
_loc sexp
693 | (Sexp.List
(Sexp.Atom
("cLongDouble" | "CLongDouble") :: _
) as sexp
) ->
694 Conv_error.stag_no_args
_loc sexp
695 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
696 Conv_error.nested_list_invalid_sum
_loc sexp
697 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
698 | sexp
-> Conv_error.unexpected_stag
_loc sexp
699 and floatType_of_sexp sexp
= floatType_of_sexp__ sexp
700 and structUnion_of_sexp__
=
701 let _loc = "Xxx.structUnion"
704 | Sexp.Atom
("struct" | "Struct") -> Struct
705 | Sexp.Atom
("union" | "Union") -> Union
706 | (Sexp.List
(Sexp.Atom
("struct" | "Struct") :: _
) as sexp
) ->
707 Conv_error.stag_no_args
_loc sexp
708 | (Sexp.List
(Sexp.Atom
("union" | "Union") :: _
) as sexp
) ->
709 Conv_error.stag_no_args
_loc sexp
710 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
711 Conv_error.nested_list_invalid_sum
_loc sexp
712 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
713 | sexp
-> Conv_error.unexpected_stag
_loc sexp
714 and structUnion_of_sexp sexp
= structUnion_of_sexp__ sexp
715 and structType_of_sexp__
=
716 let _loc = "Xxx.structType"
717 in fun sexp
-> Conv.list_of_sexp field_of_sexp sexp
718 and structType_of_sexp sexp
=
719 try structType_of_sexp__ sexp
721 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
722 and field_of_sexp__
=
723 let _loc = "Xxx.field"
727 (Sexp.Atom
(("declarationField" | "DeclarationField" as tag
)) ::
730 (match sexp_args
with
732 let v1 = field_declaration_of_sexp
v1 in DeclarationField
v1
733 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
735 (Sexp.Atom
(("emptyField" | "EmptyField" as tag
)) :: sexp_args
)
737 (match sexp_args
with
738 | [ v1 ] -> let v1 = info_of_sexp
v1 in EmptyField
v1
739 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
741 (Sexp.Atom
(("macroDeclField" | "MacroDeclField" as tag
)) ::
744 (match sexp_args
with
749 | Sexp.List
([ v1; v2
]) ->
750 let v1 = Conv.string_of_sexp
v1
752 Conv.list_of_sexp
(wrap2_of_sexp argument_of_sexp
) v2
754 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
757 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
759 (Sexp.Atom
(("cppDirectiveStruct" | "CppDirectiveStruct" as tag
)) ::
762 (match sexp_args
with
764 let v1 = cpp_directive_of_sexp
v1 in CppDirectiveStruct
v1
765 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
767 (Sexp.Atom
(("ifdefStruct" | "IfdefStruct" as tag
)) :: sexp_args
)
769 (match sexp_args
with
770 | [ v1 ] -> let v1 = ifdef_directive_of_sexp
v1 in IfdefStruct
v1
771 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
772 | (Sexp.Atom
("declarationField" | "DeclarationField") as sexp
) ->
773 Conv_error.stag_takes_args
_loc sexp
774 | (Sexp.Atom
("emptyField" | "EmptyField") as sexp
) ->
775 Conv_error.stag_takes_args
_loc sexp
776 | (Sexp.Atom
("macroDeclField" | "MacroDeclField") as sexp
) ->
777 Conv_error.stag_takes_args
_loc sexp
778 | (Sexp.Atom
("cppDirectiveStruct" | "CppDirectiveStruct") as sexp
) ->
779 Conv_error.stag_takes_args
_loc sexp
780 | (Sexp.Atom
("ifdefStruct" | "IfdefStruct") as sexp
) ->
781 Conv_error.stag_takes_args
_loc sexp
782 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
783 Conv_error.nested_list_invalid_sum
_loc sexp
784 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
785 | sexp
-> Conv_error.unexpected_stag
_loc sexp
786 and field_of_sexp sexp
= field_of_sexp__ sexp
787 and field_declaration_of_sexp__
=
788 let _loc = "Xxx.field_declaration"
792 (Sexp.Atom
(("fieldDeclList" | "FieldDeclList" as tag
)) :: sexp_args
)
794 (match sexp_args
with
798 (Conv.list_of_sexp
(wrap2_of_sexp fieldkind_of_sexp
)) v1
800 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
801 | (Sexp.Atom
("fieldDeclList" | "FieldDeclList") as sexp
) ->
802 Conv_error.stag_takes_args
_loc sexp
803 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
804 Conv_error.nested_list_invalid_sum
_loc sexp
805 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
806 | sexp
-> Conv_error.unexpected_stag
_loc sexp
807 and field_declaration_of_sexp sexp
= field_declaration_of_sexp__ sexp
808 and fieldkind_of_sexp__
=
809 let _loc = "Xxx.fieldkind"
812 | (Sexp.List
(Sexp.Atom
(("simple" | "Simple" as tag
)) :: sexp_args
) as
814 (match sexp_args
with
816 let v1 = Conv.option_of_sexp name_of_sexp
v1
817 and v2
= fullType_of_sexp v2
819 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
820 | (Sexp.List
(Sexp.Atom
(("bitField" | "BitField" as tag
)) :: sexp_args
)
822 (match sexp_args
with
823 | [ v1; v2
; v3
; v4
] ->
824 let v1 = Conv.option_of_sexp name_of_sexp
v1
825 and v2
= fullType_of_sexp v2
826 and v3
= info_of_sexp v3
827 and v4
= constExpression_of_sexp v4
828 in BitField
((v1, v2
, v3
, v4
))
829 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
830 | (Sexp.Atom
("simple" | "Simple") as sexp
) ->
831 Conv_error.stag_takes_args
_loc sexp
832 | (Sexp.Atom
("bitField" | "BitField") as sexp
) ->
833 Conv_error.stag_takes_args
_loc sexp
834 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
835 Conv_error.nested_list_invalid_sum
_loc sexp
836 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
837 | sexp
-> Conv_error.unexpected_stag
_loc sexp
838 and fieldkind_of_sexp sexp
= fieldkind_of_sexp__ sexp
840 and enumType_of_sexp__
=
841 let _loc = "Xxx.enumType"
847 | Sexp.List
([ v1; v2
]) ->
848 let v1 = name_of_sexp
v1
852 | Sexp.List
([ v1; v2
]) ->
853 let v1 = info_of_sexp
v1
854 and v2
= constExpression_of_sexp v2
857 Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
860 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
))
862 and enumType_of_sexp sexp
=
863 try enumType_of_sexp__ sexp
865 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
866 and functionType_of_sexp__
=
867 let _loc = "Xxx.functionType"
870 | Sexp.List
([ v1; v2
]) ->
871 let v1 = fullType_of_sexp
v1
874 | Sexp.List
([ v1; v2
]) ->
876 Conv.list_of_sexp
(wrap2_of_sexp parameterType_of_sexp
) v1
877 and v2
= wrap_of_sexp
Conv.bool_of_sexp v2
879 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
881 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
882 and functionType_of_sexp sexp
=
883 try functionType_of_sexp__ sexp
885 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
886 and parameterType_of_sexp__
=
887 let _loc = "Xxx.parameterType"
890 | (Sexp.List field_sexps
as sexp
) ->
891 let p_namei_field = ref None
and p_register_field
= ref None
892 and p_type_field
= ref None
and duplicates
= ref []
893 and extra
= ref [] in
896 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
897 ((match field_name
with
899 (match !p_namei_field with
902 Conv.option_of_sexp name_of_sexp field_sexp
903 in p_namei_field := Some
fvalue
904 | Some _
-> duplicates
:= field_name
:: !duplicates
)
906 (match !p_register_field
with
909 wrap_of_sexp
Conv.bool_of_sexp field_sexp
910 in p_register_field
:= Some
fvalue
911 | Some _
-> duplicates
:= field_name
:: !duplicates
)
913 (match !p_type_field
with
915 let fvalue = fullType_of_sexp field_sexp
916 in p_type_field
:= Some
fvalue
917 | Some _
-> duplicates
:= field_name
:: !duplicates
)
919 if !Conv.record_check_extra_fields
920 then extra
:= field_name
:: !extra
923 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
928 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
931 then Conv_error.record_extra_fields
_loc !extra sexp
933 (match ((!p_namei_field), (!p_register_field
),
936 | (Some p_namei_value
, Some p_register_value
,
937 Some p_type_value
) ->
939 p_namei
= p_namei_value
;
940 p_register
= p_register_value
;
941 p_type
= p_type_value
;
944 Conv_error.record_undefined_elements
_loc sexp
945 [ ((!p_namei_field = None
), "p_namei");
946 ((!p_register_field
= None
), "p_register");
947 ((!p_type_field
= None
), "p_type") ]))
948 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
949 and parameterType_of_sexp sexp
= parameterType_of_sexp__ sexp
950 and typeQualifier_of_sexp__
=
951 let _loc = "Xxx.typeQualifier"
952 in fun sexp
-> wrap_of_sexp typeQualifierbis_of_sexp sexp
953 and typeQualifier_of_sexp sexp
=
954 try typeQualifier_of_sexp__ sexp
956 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
957 and typeQualifierbis_of_sexp__
=
958 let _loc = "Xxx.typeQualifierbis"
961 | (Sexp.List field_sexps
as sexp
) ->
962 let const_field = ref None
and volatile_field
= ref None
963 and duplicates
= ref [] and extra
= ref [] in
966 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
967 ((match field_name
with
969 (match !const_field with
971 let fvalue = Conv.bool_of_sexp field_sexp
972 in const_field := Some
fvalue
973 | Some _
-> duplicates
:= field_name
:: !duplicates
)
975 (match !volatile_field
with
977 let fvalue = Conv.bool_of_sexp field_sexp
978 in volatile_field
:= Some
fvalue
979 | Some _
-> duplicates
:= field_name
:: !duplicates
)
981 if !Conv.record_check_extra_fields
982 then extra
:= field_name
:: !extra
985 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
990 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
993 then Conv_error.record_extra_fields
_loc !extra sexp
995 (match ((!const_field), (!volatile_field
)) with
996 | (Some const_value
, Some volatile_value
) ->
997 { const
= const_value
; volatile
= volatile_value
; }
999 Conv_error.record_undefined_elements
_loc sexp
1000 [ ((!const_field = None
), "const");
1001 ((!volatile_field
= None
), "volatile") ]))
1002 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
1003 and typeQualifierbis_of_sexp sexp
= typeQualifierbis_of_sexp__ sexp
1004 and attribute_of_sexp__
=
1005 let _loc = "Xxx.attribute"
1006 in fun sexp
-> wrap_of_sexp attributebis_of_sexp sexp
1007 and attribute_of_sexp sexp
=
1008 try attribute_of_sexp__ sexp
1010 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1011 and attributebis_of_sexp__
=
1012 let _loc = "Xxx.attributebis"
1016 (Sexp.Atom
(("attribute" | "Attribute" as tag
)) :: sexp_args
)
1018 (match sexp_args
with
1019 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in Attribute
v1
1020 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1021 | (Sexp.Atom
("attribute" | "Attribute") as sexp
) ->
1022 Conv_error.stag_takes_args
_loc sexp
1023 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1024 Conv_error.nested_list_invalid_sum
_loc sexp
1025 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1026 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1027 and attributebis_of_sexp sexp
= attributebis_of_sexp__ sexp
1028 and expression_of_sexp__
=
1029 let _loc = "Xxx.expression"
1034 | Sexp.List
([ v1; v2
]) ->
1035 let v1 = expressionbis_of_sexp
v1
1036 and v2
= Conv.ref_of_sexp exp_info_of_sexp v2
1038 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
1040 and expression_of_sexp sexp
=
1041 try expression_of_sexp__ sexp
1043 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1044 and exp_info_of_sexp__
=
1045 let _loc = "Xxx.exp_info"
1048 | Sexp.List
([ v1; v2
]) ->
1049 let v1 = Conv.option_of_sexp exp_type_of_sexp
v1
1050 and v2
= test_of_sexp v2
1052 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
1053 and exp_info_of_sexp sexp
=
1054 try exp_info_of_sexp__ sexp
1056 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1057 and exp_type_of_sexp__
=
1058 let _loc = "Xxx.exp_type"
1061 | Sexp.List
([ v1; v2
]) ->
1062 let v1 = fullType_of_sexp
v1 and v2
= local_of_sexp v2
in (v1, v2
)
1063 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
1064 and exp_type_of_sexp sexp
=
1065 try exp_type_of_sexp__ sexp
1067 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1068 and local_of_sexp__
=
1069 let _loc = "Xxx.local"
1072 | (Sexp.List
(Sexp.Atom
(("localVar" | "LocalVar" as tag
)) :: sexp_args
)
1074 (match sexp_args
with
1075 | [ v1 ] -> let v1 = parse_info_of_sexp v1 in LocalVar
v1
1076 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1077 | Sexp.Atom
("notLocalVar" | "NotLocalVar") -> NotLocalVar
1078 | (Sexp.Atom
("localVar" | "LocalVar") as sexp
) ->
1079 Conv_error.stag_takes_args
_loc sexp
1080 | (Sexp.List
(Sexp.Atom
("notLocalVar" | "NotLocalVar") :: _
) as sexp
) ->
1081 Conv_error.stag_no_args
_loc sexp
1082 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1083 Conv_error.nested_list_invalid_sum
_loc sexp
1084 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1085 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1086 and local_of_sexp sexp
= local_of_sexp__ sexp
1087 and test_of_sexp__
=
1088 let _loc = "Xxx.test"
1091 | Sexp.Atom
("test" | "Test") -> Test
1092 | Sexp.Atom
("notTest" | "NotTest") -> NotTest
1093 | (Sexp.List
(Sexp.Atom
("test" | "Test") :: _
) as sexp
) ->
1094 Conv_error.stag_no_args
_loc sexp
1095 | (Sexp.List
(Sexp.Atom
("notTest" | "NotTest") :: _
) as sexp
) ->
1096 Conv_error.stag_no_args
_loc sexp
1097 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1098 Conv_error.nested_list_invalid_sum
_loc sexp
1099 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1100 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1101 and test_of_sexp sexp
= test_of_sexp__ sexp
1102 and expressionbis_of_sexp__
=
1103 let _loc = "Xxx.expressionbis"
1106 | (Sexp.List
(Sexp.Atom
(("ident" | "Ident" as tag
)) :: sexp_args
) as
1108 (match sexp_args
with
1109 | [ v1 ] -> let v1 = name_of_sexp
v1 in Ident
v1
1110 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1111 | (Sexp.List
(Sexp.Atom
(("constant" | "Constant" as tag
)) :: sexp_args
)
1113 (match sexp_args
with
1114 | [ v1 ] -> let v1 = constant_of_sexp
v1 in Constant
v1
1115 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1116 | (Sexp.List
(Sexp.Atom
(("funCall" | "FunCall" as tag
)) :: sexp_args
) as
1118 (match sexp_args
with
1120 let v1 = expression_of_sexp
v1
1121 and v2
= Conv.list_of_sexp
(wrap2_of_sexp argument_of_sexp
) v2
1122 in FunCall
((v1, v2
))
1123 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1124 | (Sexp.List
(Sexp.Atom
(("condExpr" | "CondExpr" as tag
)) :: sexp_args
)
1126 (match sexp_args
with
1128 let v1 = expression_of_sexp
v1
1129 and v2
= Conv.option_of_sexp expression_of_sexp v2
1130 and v3
= expression_of_sexp v3
1131 in CondExpr
((v1, v2
, v3
))
1132 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1133 | (Sexp.List
(Sexp.Atom
(("sequence" | "Sequence" as tag
)) :: sexp_args
)
1135 (match sexp_args
with
1137 let v1 = expression_of_sexp
v1
1138 and v2
= expression_of_sexp v2
1139 in Sequence
((v1, v2
))
1140 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1142 (Sexp.Atom
(("assignment" | "Assignment" as tag
)) :: sexp_args
)
1144 (match sexp_args
with
1146 let v1 = expression_of_sexp
v1
1147 and v2
= assignOp_of_sexp v2
1148 and v3
= expression_of_sexp v3
1149 in Assignment
((v1, v2
, v3
))
1150 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1151 | (Sexp.List
(Sexp.Atom
(("postfix" | "Postfix" as tag
)) :: sexp_args
) as
1153 (match sexp_args
with
1155 let v1 = expression_of_sexp
v1
1156 and v2
= fixOp_of_sexp v2
1157 in Postfix
((v1, v2
))
1158 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1159 | (Sexp.List
(Sexp.Atom
(("infix" | "Infix" as tag
)) :: sexp_args
) as
1161 (match sexp_args
with
1163 let v1 = expression_of_sexp
v1
1164 and v2
= fixOp_of_sexp v2
1166 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1167 | (Sexp.List
(Sexp.Atom
(("unary" | "Unary" as tag
)) :: sexp_args
) as
1169 (match sexp_args
with
1171 let v1 = expression_of_sexp
v1
1172 and v2
= unaryOp_of_sexp v2
1174 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1175 | (Sexp.List
(Sexp.Atom
(("binary" | "Binary" as tag
)) :: sexp_args
) as
1177 (match sexp_args
with
1179 let v1 = expression_of_sexp
v1
1180 and v2
= binaryOp_of_sexp v2
1181 and v3
= expression_of_sexp v3
1182 in Binary
((v1, v2
, v3
))
1183 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1185 (Sexp.Atom
(("arrayAccess" | "ArrayAccess" as tag
)) :: sexp_args
)
1187 (match sexp_args
with
1189 let v1 = expression_of_sexp
v1
1190 and v2
= expression_of_sexp v2
1191 in ArrayAccess
((v1, v2
))
1192 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1194 (Sexp.Atom
(("recordAccess" | "RecordAccess" as tag
)) :: sexp_args
)
1196 (match sexp_args
with
1198 let v1 = expression_of_sexp
v1
1199 and v2
= name_of_sexp v2
1200 in RecordAccess
((v1, v2
))
1201 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1203 (Sexp.Atom
(("recordPtAccess" | "RecordPtAccess" as tag
)) ::
1206 (match sexp_args
with
1208 let v1 = expression_of_sexp
v1
1209 and v2
= name_of_sexp v2
1210 in RecordPtAccess
((v1, v2
))
1211 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1213 (Sexp.Atom
(("sizeOfExpr" | "SizeOfExpr" as tag
)) :: sexp_args
)
1215 (match sexp_args
with
1216 | [ v1 ] -> let v1 = expression_of_sexp
v1 in SizeOfExpr
v1
1217 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1219 (Sexp.Atom
(("sizeOfType" | "SizeOfType" as tag
)) :: sexp_args
)
1221 (match sexp_args
with
1222 | [ v1 ] -> let v1 = fullType_of_sexp
v1 in SizeOfType
v1
1223 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1224 | (Sexp.List
(Sexp.Atom
(("cast" | "Cast" as tag
)) :: sexp_args
) as sexp
)
1226 (match sexp_args
with
1228 let v1 = fullType_of_sexp
v1
1229 and v2
= expression_of_sexp v2
1231 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1233 (Sexp.Atom
(("statementExpr" | "StatementExpr" as tag
)) :: sexp_args
)
1235 (match sexp_args
with
1237 let v1 = wrap_of_sexp compound_of_sexp
v1 in StatementExpr
v1
1238 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1240 (Sexp.Atom
(("constructor" | "Constructor" as tag
)) :: sexp_args
)
1242 (match sexp_args
with
1244 let v1 = fullType_of_sexp
v1
1246 Conv.list_of_sexp
(wrap2_of_sexp initialiser_of_sexp
) v2
1247 in Constructor
((v1, v2
))
1248 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1250 (Sexp.Atom
(("parenExpr" | "ParenExpr" as tag
)) :: sexp_args
)
1252 (match sexp_args
with
1253 | [ v1 ] -> let v1 = expression_of_sexp
v1 in ParenExpr
v1
1254 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1255 | (Sexp.Atom
("ident" | "Ident") as sexp
) ->
1256 Conv_error.stag_takes_args
_loc sexp
1257 | (Sexp.Atom
("constant" | "Constant") as sexp
) ->
1258 Conv_error.stag_takes_args
_loc sexp
1259 | (Sexp.Atom
("funCall" | "FunCall") as sexp
) ->
1260 Conv_error.stag_takes_args
_loc sexp
1261 | (Sexp.Atom
("condExpr" | "CondExpr") as sexp
) ->
1262 Conv_error.stag_takes_args
_loc sexp
1263 | (Sexp.Atom
("sequence" | "Sequence") as sexp
) ->
1264 Conv_error.stag_takes_args
_loc sexp
1265 | (Sexp.Atom
("assignment" | "Assignment") as sexp
) ->
1266 Conv_error.stag_takes_args
_loc sexp
1267 | (Sexp.Atom
("postfix" | "Postfix") as sexp
) ->
1268 Conv_error.stag_takes_args
_loc sexp
1269 | (Sexp.Atom
("infix" | "Infix") as sexp
) ->
1270 Conv_error.stag_takes_args
_loc sexp
1271 | (Sexp.Atom
("unary" | "Unary") as sexp
) ->
1272 Conv_error.stag_takes_args
_loc sexp
1273 | (Sexp.Atom
("binary" | "Binary") as sexp
) ->
1274 Conv_error.stag_takes_args
_loc sexp
1275 | (Sexp.Atom
("arrayAccess" | "ArrayAccess") as sexp
) ->
1276 Conv_error.stag_takes_args
_loc sexp
1277 | (Sexp.Atom
("recordAccess" | "RecordAccess") as sexp
) ->
1278 Conv_error.stag_takes_args
_loc sexp
1279 | (Sexp.Atom
("recordPtAccess" | "RecordPtAccess") as sexp
) ->
1280 Conv_error.stag_takes_args
_loc sexp
1281 | (Sexp.Atom
("sizeOfExpr" | "SizeOfExpr") as sexp
) ->
1282 Conv_error.stag_takes_args
_loc sexp
1283 | (Sexp.Atom
("sizeOfType" | "SizeOfType") as sexp
) ->
1284 Conv_error.stag_takes_args
_loc sexp
1285 | (Sexp.Atom
("cast" | "Cast") as sexp
) ->
1286 Conv_error.stag_takes_args
_loc sexp
1287 | (Sexp.Atom
("statementExpr" | "StatementExpr") as sexp
) ->
1288 Conv_error.stag_takes_args
_loc sexp
1289 | (Sexp.Atom
("constructor" | "Constructor") as sexp
) ->
1290 Conv_error.stag_takes_args
_loc sexp
1291 | (Sexp.Atom
("parenExpr" | "ParenExpr") as sexp
) ->
1292 Conv_error.stag_takes_args
_loc sexp
1293 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1294 Conv_error.nested_list_invalid_sum
_loc sexp
1295 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1296 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1297 and expressionbis_of_sexp sexp
= expressionbis_of_sexp__ sexp
1298 and argument_of_sexp__
=
1299 let _loc = "Xxx.argument"
1301 fun sexp
-> Common.either_of_sexp expression_of_sexp weird_argument_of_sexp sexp
1302 and argument_of_sexp sexp
=
1303 try argument_of_sexp__ sexp
1305 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1306 and weird_argument_of_sexp__
=
1307 let _loc = "Xxx.weird_argument"
1310 | (Sexp.List
(Sexp.Atom
(("argType" | "ArgType" as tag
)) :: sexp_args
) as
1312 (match sexp_args
with
1313 | [ v1 ] -> let v1 = parameterType_of_sexp
v1 in ArgType
v1
1314 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1316 (Sexp.Atom
(("argAction" | "ArgAction" as tag
)) :: sexp_args
)
1318 (match sexp_args
with
1319 | [ v1 ] -> let v1 = action_macro_of_sexp
v1 in ArgAction
v1
1320 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1321 | (Sexp.Atom
("argType" | "ArgType") as sexp
) ->
1322 Conv_error.stag_takes_args
_loc sexp
1323 | (Sexp.Atom
("argAction" | "ArgAction") as sexp
) ->
1324 Conv_error.stag_takes_args
_loc sexp
1325 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1326 Conv_error.nested_list_invalid_sum
_loc sexp
1327 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1328 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1329 and weird_argument_of_sexp sexp
= weird_argument_of_sexp__ sexp
1330 and action_macro_of_sexp__
=
1331 let _loc = "Xxx.action_macro"
1334 | (Sexp.List
(Sexp.Atom
(("actMisc" | "ActMisc" as tag
)) :: sexp_args
) as
1336 (match sexp_args
with
1337 | [ v1 ] -> let v1 = il_of_sexp
v1 in ActMisc
v1
1338 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1339 | (Sexp.Atom
("actMisc" | "ActMisc") as sexp
) ->
1340 Conv_error.stag_takes_args
_loc sexp
1341 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1342 Conv_error.nested_list_invalid_sum
_loc sexp
1343 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1344 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1345 and action_macro_of_sexp sexp
= action_macro_of_sexp__ sexp
1346 and constant_of_sexp__
=
1347 let _loc = "Xxx.constant"
1350 | (Sexp.List
(Sexp.Atom
(("string" | "String" as tag
)) :: sexp_args
) as
1352 (match sexp_args
with
1356 | Sexp.List
([ v1; v2
]) ->
1357 let v1 = Conv.string_of_sexp
v1
1358 and v2
= isWchar_of_sexp v2
1360 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
1362 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1364 (Sexp.Atom
(("multiString" | "MultiString" as tag
)) :: sexp_args
)
1366 (match sexp_args
with
1368 let v1 = Conv.list_of_sexp
Conv.string_of_sexp
v1
1370 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1371 | (Sexp.List
(Sexp.Atom
(("char" | "Char" as tag
)) :: sexp_args
) as sexp
)
1373 (match sexp_args
with
1377 | Sexp.List
([ v1; v2
]) ->
1378 let v1 = Conv.string_of_sexp
v1
1379 and v2
= isWchar_of_sexp v2
1381 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
1383 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1384 | (Sexp.List
(Sexp.Atom
(("int" | "Int" as tag
)) :: sexp_args
) as sexp
)
1386 (match sexp_args
with
1387 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in Int
(v1, failwith
"Todo")
1388 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1389 | (Sexp.List
(Sexp.Atom
(("float" | "Float" as tag
)) :: sexp_args
) as
1391 (match sexp_args
with
1395 | Sexp.List
([ v1; v2
]) ->
1396 let v1 = Conv.string_of_sexp
v1
1397 and v2
= floatType_of_sexp v2
1399 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
1401 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1402 | (Sexp.Atom
("string" | "String") as sexp
) ->
1403 Conv_error.stag_takes_args
_loc sexp
1404 | (Sexp.Atom
("multiString" | "MultiString") as sexp
) ->
1405 Conv_error.stag_takes_args
_loc sexp
1406 | (Sexp.Atom
("char" | "Char") as sexp
) ->
1407 Conv_error.stag_takes_args
_loc sexp
1408 | (Sexp.Atom
("int" | "Int") as sexp
) ->
1409 Conv_error.stag_takes_args
_loc sexp
1410 | (Sexp.Atom
("float" | "Float") as sexp
) ->
1411 Conv_error.stag_takes_args
_loc sexp
1412 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1413 Conv_error.nested_list_invalid_sum
_loc sexp
1414 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1415 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1416 and constant_of_sexp sexp
= constant_of_sexp__ sexp
1417 and isWchar_of_sexp__
=
1418 let _loc = "Xxx.isWchar"
1421 | Sexp.Atom
("isWchar" | "IsWchar") -> IsWchar
1422 | Sexp.Atom
("isChar" | "IsChar") -> IsChar
1423 | (Sexp.List
(Sexp.Atom
("isWchar" | "IsWchar") :: _
) as sexp
) ->
1424 Conv_error.stag_no_args
_loc sexp
1425 | (Sexp.List
(Sexp.Atom
("isChar" | "IsChar") :: _
) as sexp
) ->
1426 Conv_error.stag_no_args
_loc sexp
1427 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1428 Conv_error.nested_list_invalid_sum
_loc sexp
1429 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1430 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1431 and isWchar_of_sexp sexp
= isWchar_of_sexp__ sexp
1432 and unaryOp_of_sexp__
=
1433 let _loc = "Xxx.unaryOp"
1436 | Sexp.Atom
("getRef" | "GetRef") -> GetRef
1437 | Sexp.Atom
("deRef" | "DeRef") -> DeRef
1438 | Sexp.Atom
("unPlus" | "UnPlus") -> UnPlus
1439 | Sexp.Atom
("unMinus" | "UnMinus") -> UnMinus
1440 | Sexp.Atom
("tilde" | "Tilde") -> Tilde
1441 | Sexp.Atom
("not" | "Not") -> Not
1442 | Sexp.Atom
("getRefLabel" | "GetRefLabel") -> GetRefLabel
1443 | (Sexp.List
(Sexp.Atom
("getRef" | "GetRef") :: _
) as sexp
) ->
1444 Conv_error.stag_no_args
_loc sexp
1445 | (Sexp.List
(Sexp.Atom
("deRef" | "DeRef") :: _
) as sexp
) ->
1446 Conv_error.stag_no_args
_loc sexp
1447 | (Sexp.List
(Sexp.Atom
("unPlus" | "UnPlus") :: _
) as sexp
) ->
1448 Conv_error.stag_no_args
_loc sexp
1449 | (Sexp.List
(Sexp.Atom
("unMinus" | "UnMinus") :: _
) as sexp
) ->
1450 Conv_error.stag_no_args
_loc sexp
1451 | (Sexp.List
(Sexp.Atom
("tilde" | "Tilde") :: _
) as sexp
) ->
1452 Conv_error.stag_no_args
_loc sexp
1453 | (Sexp.List
(Sexp.Atom
("not" | "Not") :: _
) as sexp
) ->
1454 Conv_error.stag_no_args
_loc sexp
1455 | (Sexp.List
(Sexp.Atom
("getRefLabel" | "GetRefLabel") :: _
) as sexp
) ->
1456 Conv_error.stag_no_args
_loc sexp
1457 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1458 Conv_error.nested_list_invalid_sum
_loc sexp
1459 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1460 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1461 and unaryOp_of_sexp sexp
= unaryOp_of_sexp__ sexp
1462 and assignOp_of_sexp__
=
1463 let _loc = "Xxx.assignOp"
1466 | Sexp.Atom
("simpleAssign" | "SimpleAssign") -> SimpleAssign
1467 | (Sexp.List
(Sexp.Atom
(("opAssign" | "OpAssign" as tag
)) :: sexp_args
)
1469 (match sexp_args
with
1470 | [ v1 ] -> let v1 = arithOp_of_sexp
v1 in OpAssign
v1
1471 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1472 | (Sexp.List
(Sexp.Atom
("simpleAssign" | "SimpleAssign") :: _
) as sexp
)
1473 -> Conv_error.stag_no_args
_loc sexp
1474 | (Sexp.Atom
("opAssign" | "OpAssign") as sexp
) ->
1475 Conv_error.stag_takes_args
_loc sexp
1476 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1477 Conv_error.nested_list_invalid_sum
_loc sexp
1478 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1479 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1480 and assignOp_of_sexp sexp
= assignOp_of_sexp__ sexp
1481 and fixOp_of_sexp__
=
1482 let _loc = "Xxx.fixOp"
1485 | Sexp.Atom
("dec" | "Dec") -> Dec
1486 | Sexp.Atom
("inc" | "Inc") -> Inc
1487 | (Sexp.List
(Sexp.Atom
("dec" | "Dec") :: _
) as sexp
) ->
1488 Conv_error.stag_no_args
_loc sexp
1489 | (Sexp.List
(Sexp.Atom
("inc" | "Inc") :: _
) as sexp
) ->
1490 Conv_error.stag_no_args
_loc sexp
1491 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1492 Conv_error.nested_list_invalid_sum
_loc sexp
1493 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1494 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1495 and fixOp_of_sexp sexp
= fixOp_of_sexp__ sexp
1496 and binaryOp_of_sexp__
=
1497 let _loc = "Xxx.binaryOp"
1500 | (Sexp.List
(Sexp.Atom
(("arith" | "Arith" as tag
)) :: sexp_args
) as
1502 (match sexp_args
with
1503 | [ v1 ] -> let v1 = arithOp_of_sexp
v1 in Arith
v1
1504 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1505 | (Sexp.List
(Sexp.Atom
(("logical" | "Logical" as tag
)) :: sexp_args
) as
1507 (match sexp_args
with
1508 | [ v1 ] -> let v1 = logicalOp_of_sexp
v1 in Logical
v1
1509 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1510 | (Sexp.Atom
("arith" | "Arith") as sexp
) ->
1511 Conv_error.stag_takes_args
_loc sexp
1512 | (Sexp.Atom
("logical" | "Logical") as sexp
) ->
1513 Conv_error.stag_takes_args
_loc sexp
1514 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1515 Conv_error.nested_list_invalid_sum
_loc sexp
1516 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1517 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1518 and binaryOp_of_sexp sexp
= binaryOp_of_sexp__ sexp
1519 and arithOp_of_sexp__
=
1520 let _loc = "Xxx.arithOp"
1523 | Sexp.Atom
("plus" | "Plus") -> Plus
1524 | Sexp.Atom
("minus" | "Minus") -> Minus
1525 | Sexp.Atom
("mul" | "Mul") -> Mul
1526 | Sexp.Atom
("div" | "Div") -> Div
1527 | Sexp.Atom
("mod" | "Mod") -> Mod
1528 | Sexp.Atom
("decLeft" | "DecLeft") -> DecLeft
1529 | Sexp.Atom
("decRight" | "DecRight") -> DecRight
1530 | Sexp.Atom
("and" | "And") -> And
1531 | Sexp.Atom
("or" | "Or") -> Or
1532 | Sexp.Atom
("xor" | "Xor") -> Xor
1533 | (Sexp.List
(Sexp.Atom
("plus" | "Plus") :: _
) as sexp
) ->
1534 Conv_error.stag_no_args
_loc sexp
1535 | (Sexp.List
(Sexp.Atom
("minus" | "Minus") :: _
) as sexp
) ->
1536 Conv_error.stag_no_args
_loc sexp
1537 | (Sexp.List
(Sexp.Atom
("mul" | "Mul") :: _
) as sexp
) ->
1538 Conv_error.stag_no_args
_loc sexp
1539 | (Sexp.List
(Sexp.Atom
("div" | "Div") :: _
) as sexp
) ->
1540 Conv_error.stag_no_args
_loc sexp
1541 | (Sexp.List
(Sexp.Atom
("mod" | "Mod") :: _
) as sexp
) ->
1542 Conv_error.stag_no_args
_loc sexp
1543 | (Sexp.List
(Sexp.Atom
("decLeft" | "DecLeft") :: _
) as sexp
) ->
1544 Conv_error.stag_no_args
_loc sexp
1545 | (Sexp.List
(Sexp.Atom
("decRight" | "DecRight") :: _
) as sexp
) ->
1546 Conv_error.stag_no_args
_loc sexp
1547 | (Sexp.List
(Sexp.Atom
("and" | "And") :: _
) as sexp
) ->
1548 Conv_error.stag_no_args
_loc sexp
1549 | (Sexp.List
(Sexp.Atom
("or" | "Or") :: _
) as sexp
) ->
1550 Conv_error.stag_no_args
_loc sexp
1551 | (Sexp.List
(Sexp.Atom
("xor" | "Xor") :: _
) as sexp
) ->
1552 Conv_error.stag_no_args
_loc sexp
1553 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1554 Conv_error.nested_list_invalid_sum
_loc sexp
1555 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1556 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1557 and arithOp_of_sexp sexp
= arithOp_of_sexp__ sexp
1558 and logicalOp_of_sexp__
=
1559 let _loc = "Xxx.logicalOp"
1562 | Sexp.Atom
("inf" | "Inf") -> Inf
1563 | Sexp.Atom
("sup" | "Sup") -> Sup
1564 | Sexp.Atom
("infEq" | "InfEq") -> InfEq
1565 | Sexp.Atom
("supEq" | "SupEq") -> SupEq
1566 | Sexp.Atom
("eq" | "Eq") -> Eq
1567 | Sexp.Atom
("notEq" | "NotEq") -> NotEq
1568 | Sexp.Atom
("andLog" | "AndLog") -> AndLog
1569 | Sexp.Atom
("orLog" | "OrLog") -> OrLog
1570 | (Sexp.List
(Sexp.Atom
("inf" | "Inf") :: _
) as sexp
) ->
1571 Conv_error.stag_no_args
_loc sexp
1572 | (Sexp.List
(Sexp.Atom
("sup" | "Sup") :: _
) as sexp
) ->
1573 Conv_error.stag_no_args
_loc sexp
1574 | (Sexp.List
(Sexp.Atom
("infEq" | "InfEq") :: _
) as sexp
) ->
1575 Conv_error.stag_no_args
_loc sexp
1576 | (Sexp.List
(Sexp.Atom
("supEq" | "SupEq") :: _
) as sexp
) ->
1577 Conv_error.stag_no_args
_loc sexp
1578 | (Sexp.List
(Sexp.Atom
("eq" | "Eq") :: _
) as sexp
) ->
1579 Conv_error.stag_no_args
_loc sexp
1580 | (Sexp.List
(Sexp.Atom
("notEq" | "NotEq") :: _
) as sexp
) ->
1581 Conv_error.stag_no_args
_loc sexp
1582 | (Sexp.List
(Sexp.Atom
("andLog" | "AndLog") :: _
) as sexp
) ->
1583 Conv_error.stag_no_args
_loc sexp
1584 | (Sexp.List
(Sexp.Atom
("orLog" | "OrLog") :: _
) as sexp
) ->
1585 Conv_error.stag_no_args
_loc sexp
1586 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1587 Conv_error.nested_list_invalid_sum
_loc sexp
1588 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1589 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1590 and logicalOp_of_sexp sexp
= logicalOp_of_sexp__ sexp
1591 and constExpression_of_sexp__
=
1592 let _loc = "Xxx.constExpression" in fun sexp
-> expression_of_sexp sexp
1593 and constExpression_of_sexp sexp
=
1594 try constExpression_of_sexp__ sexp
1596 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1597 and statement_of_sexp__
=
1598 let _loc = "Xxx.statement"
1599 in fun sexp
-> wrap_of_sexp statementbis_of_sexp sexp
1600 and statement_of_sexp sexp
=
1601 try statement_of_sexp__ sexp
1603 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1604 and statementbis_of_sexp__
=
1605 let _loc = "Xxx.statementbis"
1608 | (Sexp.List
(Sexp.Atom
(("labeled" | "Labeled" as tag
)) :: sexp_args
) as
1610 (match sexp_args
with
1611 | [ v1 ] -> let v1 = labeled_of_sexp
v1 in Labeled
v1
1612 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1613 | (Sexp.List
(Sexp.Atom
(("compound" | "Compound" as tag
)) :: sexp_args
)
1615 (match sexp_args
with
1616 | [ v1 ] -> let v1 = compound_of_sexp
v1 in Compound
v1
1617 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1619 (Sexp.Atom
(("exprStatement" | "ExprStatement" as tag
)) :: sexp_args
)
1621 (match sexp_args
with
1622 | [ v1 ] -> let v1 = exprStatement_of_sexp
v1 in ExprStatement
v1
1623 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1625 (Sexp.Atom
(("selection" | "Selection" as tag
)) :: sexp_args
)
1627 (match sexp_args
with
1628 | [ v1 ] -> let v1 = selection_of_sexp
v1 in Selection
v1
1629 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1631 (Sexp.Atom
(("iteration" | "Iteration" as tag
)) :: sexp_args
)
1633 (match sexp_args
with
1634 | [ v1 ] -> let v1 = iteration_of_sexp
v1 in Iteration
v1
1635 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1636 | (Sexp.List
(Sexp.Atom
(("jump" | "Jump" as tag
)) :: sexp_args
) as sexp
)
1638 (match sexp_args
with
1639 | [ v1 ] -> let v1 = jump_of_sexp
v1 in Jump
v1
1640 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1641 | (Sexp.List
(Sexp.Atom
(("decl" | "Decl" as tag
)) :: sexp_args
) as sexp
)
1643 (match sexp_args
with
1644 | [ v1 ] -> let v1 = declaration_of_sexp
v1 in Decl
v1
1645 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1646 | (Sexp.List
(Sexp.Atom
(("asm" | "Asm" as tag
)) :: sexp_args
) as sexp
)
1648 (match sexp_args
with
1649 | [ v1 ] -> let v1 = asmbody_of_sexp
v1 in Asm
v1
1650 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1652 (Sexp.Atom
(("nestedFunc" | "NestedFunc" as tag
)) :: sexp_args
)
1654 (match sexp_args
with
1655 | [ v1 ] -> let v1 = definition_of_sexp
v1 in NestedFunc
v1
1656 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1657 | Sexp.Atom
("macroStmt" | "MacroStmt") -> MacroStmt
1658 | (Sexp.Atom
("labeled" | "Labeled") as sexp
) ->
1659 Conv_error.stag_takes_args
_loc sexp
1660 | (Sexp.Atom
("compound" | "Compound") as sexp
) ->
1661 Conv_error.stag_takes_args
_loc sexp
1662 | (Sexp.Atom
("exprStatement" | "ExprStatement") as sexp
) ->
1663 Conv_error.stag_takes_args
_loc sexp
1664 | (Sexp.Atom
("selection" | "Selection") as sexp
) ->
1665 Conv_error.stag_takes_args
_loc sexp
1666 | (Sexp.Atom
("iteration" | "Iteration") as sexp
) ->
1667 Conv_error.stag_takes_args
_loc sexp
1668 | (Sexp.Atom
("jump" | "Jump") as sexp
) ->
1669 Conv_error.stag_takes_args
_loc sexp
1670 | (Sexp.Atom
("decl" | "Decl") as sexp
) ->
1671 Conv_error.stag_takes_args
_loc sexp
1672 | (Sexp.Atom
("asm" | "Asm") as sexp
) ->
1673 Conv_error.stag_takes_args
_loc sexp
1674 | (Sexp.Atom
("nestedFunc" | "NestedFunc") as sexp
) ->
1675 Conv_error.stag_takes_args
_loc sexp
1676 | (Sexp.List
(Sexp.Atom
("macroStmt" | "MacroStmt") :: _
) as sexp
) ->
1677 Conv_error.stag_no_args
_loc sexp
1678 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1679 Conv_error.nested_list_invalid_sum
_loc sexp
1680 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1681 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1682 and statementbis_of_sexp sexp
= statementbis_of_sexp__ sexp
1683 and labeled_of_sexp__
=
1684 let _loc = "Xxx.labeled"
1687 | (Sexp.List
(Sexp.Atom
(("label" | "Label" as tag
)) :: sexp_args
) as
1689 (match sexp_args
with
1691 let v1 = name_of_sexp
v1
1692 and v2
= statement_of_sexp v2
1694 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1695 | (Sexp.List
(Sexp.Atom
(("case" | "Case" as tag
)) :: sexp_args
) as sexp
)
1697 (match sexp_args
with
1699 let v1 = expression_of_sexp
v1
1700 and v2
= statement_of_sexp v2
1702 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1704 (Sexp.Atom
(("caseRange" | "CaseRange" as tag
)) :: sexp_args
)
1706 (match sexp_args
with
1708 let v1 = expression_of_sexp
v1
1709 and v2
= expression_of_sexp v2
1710 and v3
= statement_of_sexp v3
1711 in CaseRange
((v1, v2
, v3
))
1712 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1713 | (Sexp.List
(Sexp.Atom
(("default" | "Default" as tag
)) :: sexp_args
) as
1715 (match sexp_args
with
1716 | [ v1 ] -> let v1 = statement_of_sexp
v1 in Default
v1
1717 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1718 | (Sexp.Atom
("label" | "Label") as sexp
) ->
1719 Conv_error.stag_takes_args
_loc sexp
1720 | (Sexp.Atom
("case" | "Case") as sexp
) ->
1721 Conv_error.stag_takes_args
_loc sexp
1722 | (Sexp.Atom
("caseRange" | "CaseRange") as sexp
) ->
1723 Conv_error.stag_takes_args
_loc sexp
1724 | (Sexp.Atom
("default" | "Default") as sexp
) ->
1725 Conv_error.stag_takes_args
_loc sexp
1726 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1727 Conv_error.nested_list_invalid_sum
_loc sexp
1728 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1729 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1730 and labeled_of_sexp sexp
= labeled_of_sexp__ sexp
1731 and compound_of_sexp__
=
1732 let _loc = "Xxx.compound"
1733 in fun sexp
-> Conv.list_of_sexp statement_sequencable_of_sexp sexp
1734 and compound_of_sexp sexp
=
1735 try compound_of_sexp__ sexp
1737 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1738 and statement_sequencable_of_sexp__
=
1739 let _loc = "Xxx.statement_sequencable"
1742 | (Sexp.List
(Sexp.Atom
(("stmtElem" | "StmtElem" as tag
)) :: sexp_args
)
1744 (match sexp_args
with
1745 | [ v1 ] -> let v1 = statement_of_sexp
v1 in StmtElem
v1
1746 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1748 (Sexp.Atom
(("cppDirectiveStmt" | "CppDirectiveStmt" as tag
)) ::
1751 (match sexp_args
with
1752 | [ v1 ] -> let v1 = cpp_directive_of_sexp
v1 in CppDirectiveStmt
v1
1753 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1755 (Sexp.Atom
(("ifdefStmt" | "IfdefStmt" as tag
)) :: sexp_args
)
1757 (match sexp_args
with
1758 | [ v1 ] -> let v1 = ifdef_directive_of_sexp
v1 in IfdefStmt
v1
1759 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1761 (Sexp.Atom
(("ifdefStmt2" | "IfdefStmt2" as tag
)) :: sexp_args
)
1763 (match sexp_args
with
1765 let v1 = Conv.list_of_sexp ifdef_directive_of_sexp
v1
1768 (Conv.list_of_sexp statement_sequencable_of_sexp
) v2
1769 in IfdefStmt2
((v1, v2
))
1770 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1771 | (Sexp.Atom
("stmtElem" | "StmtElem") as sexp
) ->
1772 Conv_error.stag_takes_args
_loc sexp
1773 | (Sexp.Atom
("cppDirectiveStmt" | "CppDirectiveStmt") as sexp
) ->
1774 Conv_error.stag_takes_args
_loc sexp
1775 | (Sexp.Atom
("ifdefStmt" | "IfdefStmt") as sexp
) ->
1776 Conv_error.stag_takes_args
_loc sexp
1777 | (Sexp.Atom
("ifdefStmt2" | "IfdefStmt2") as sexp
) ->
1778 Conv_error.stag_takes_args
_loc sexp
1779 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1780 Conv_error.nested_list_invalid_sum
_loc sexp
1781 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1782 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1783 and statement_sequencable_of_sexp sexp
= statement_sequencable_of_sexp__ sexp
1784 and exprStatement_of_sexp__
=
1785 let _loc = "Xxx.exprStatement"
1786 in fun sexp
-> Conv.option_of_sexp expression_of_sexp sexp
1787 and exprStatement_of_sexp sexp
=
1788 try exprStatement_of_sexp__ sexp
1790 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1791 and selection_of_sexp__
=
1792 let _loc = "Xxx.selection"
1795 | (Sexp.List
(Sexp.Atom
(("if" | "If" as tag
)) :: sexp_args
) as sexp
) ->
1796 (match sexp_args
with
1798 let v1 = expression_of_sexp
v1
1799 and v2
= statement_of_sexp v2
1800 and v3
= statement_of_sexp v3
1801 in If
((v1, v2
, v3
))
1802 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1803 | (Sexp.List
(Sexp.Atom
(("switch" | "Switch" as tag
)) :: sexp_args
) as
1805 (match sexp_args
with
1807 let v1 = expression_of_sexp
v1
1808 and v2
= statement_of_sexp v2
1809 in Switch
((v1, v2
))
1810 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1811 | (Sexp.Atom
("if" | "If") as sexp
) ->
1812 Conv_error.stag_takes_args
_loc sexp
1813 | (Sexp.Atom
("switch" | "Switch") as sexp
) ->
1814 Conv_error.stag_takes_args
_loc sexp
1815 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1816 Conv_error.nested_list_invalid_sum
_loc sexp
1817 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1818 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1819 and selection_of_sexp sexp
= selection_of_sexp__ sexp
1820 and iteration_of_sexp__
=
1821 let _loc = "Xxx.iteration"
1824 | (Sexp.List
(Sexp.Atom
(("while" | "While" as tag
)) :: sexp_args
) as
1826 (match sexp_args
with
1828 let v1 = expression_of_sexp
v1
1829 and v2
= statement_of_sexp v2
1831 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1832 | (Sexp.List
(Sexp.Atom
(("doWhile" | "DoWhile" as tag
)) :: sexp_args
) as
1834 (match sexp_args
with
1836 let v1 = statement_of_sexp
v1
1837 and v2
= expression_of_sexp v2
1838 in DoWhile
((v1, v2
))
1839 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1840 | (Sexp.List
(Sexp.Atom
(("for" | "For" as tag
)) :: sexp_args
) as sexp
)
1842 (match sexp_args
with
1843 | [ v1; v2
; v3
; v4
] ->
1844 let v1 = wrap_of_sexp exprStatement_of_sexp
v1
1845 and v2
= wrap_of_sexp exprStatement_of_sexp v2
1846 and v3
= wrap_of_sexp exprStatement_of_sexp v3
1847 and v4
= statement_of_sexp v4
1848 in For
((v1, v2
, v3
, v4
))
1849 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1851 (Sexp.Atom
(("macroIteration" | "MacroIteration" as tag
)) ::
1854 (match sexp_args
with
1856 let v1 = Conv.string_of_sexp
v1
1857 and v2
= Conv.list_of_sexp
(wrap2_of_sexp argument_of_sexp
) v2
1858 and v3
= statement_of_sexp v3
1859 in MacroIteration
((v1, v2
, v3
))
1860 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1861 | (Sexp.Atom
("while" | "While") as sexp
) ->
1862 Conv_error.stag_takes_args
_loc sexp
1863 | (Sexp.Atom
("doWhile" | "DoWhile") as sexp
) ->
1864 Conv_error.stag_takes_args
_loc sexp
1865 | (Sexp.Atom
("for" | "For") as sexp
) ->
1866 Conv_error.stag_takes_args
_loc sexp
1867 | (Sexp.Atom
("macroIteration" | "MacroIteration") as sexp
) ->
1868 Conv_error.stag_takes_args
_loc sexp
1869 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1870 Conv_error.nested_list_invalid_sum
_loc sexp
1871 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1872 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1873 and iteration_of_sexp sexp
= iteration_of_sexp__ sexp
1874 and jump_of_sexp__
=
1875 let _loc = "Xxx.jump"
1878 | (Sexp.List
(Sexp.Atom
(("goto" | "Goto" as tag
)) :: sexp_args
) as sexp
)
1880 (match sexp_args
with
1881 | [ v1 ] -> let v1 = name_of_sexp
v1 in Goto
v1
1882 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1883 | Sexp.Atom
("continue" | "Continue") -> Continue
1884 | Sexp.Atom
("break" | "Break") -> Break
1885 | Sexp.Atom
("return" | "Return") -> Return
1887 (Sexp.Atom
(("returnExpr" | "ReturnExpr" as tag
)) :: sexp_args
)
1889 (match sexp_args
with
1890 | [ v1 ] -> let v1 = expression_of_sexp
v1 in ReturnExpr
v1
1891 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1893 (Sexp.Atom
(("gotoComputed" | "GotoComputed" as tag
)) :: sexp_args
)
1895 (match sexp_args
with
1896 | [ v1 ] -> let v1 = expression_of_sexp
v1 in GotoComputed
v1
1897 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1898 | (Sexp.Atom
("goto" | "Goto") as sexp
) ->
1899 Conv_error.stag_takes_args
_loc sexp
1900 | (Sexp.List
(Sexp.Atom
("continue" | "Continue") :: _
) as sexp
) ->
1901 Conv_error.stag_no_args
_loc sexp
1902 | (Sexp.List
(Sexp.Atom
("break" | "Break") :: _
) as sexp
) ->
1903 Conv_error.stag_no_args
_loc sexp
1904 | (Sexp.List
(Sexp.Atom
("return" | "Return") :: _
) as sexp
) ->
1905 Conv_error.stag_no_args
_loc sexp
1906 | (Sexp.Atom
("returnExpr" | "ReturnExpr") as sexp
) ->
1907 Conv_error.stag_takes_args
_loc sexp
1908 | (Sexp.Atom
("gotoComputed" | "GotoComputed") as sexp
) ->
1909 Conv_error.stag_takes_args
_loc sexp
1910 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1911 Conv_error.nested_list_invalid_sum
_loc sexp
1912 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1913 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1914 and jump_of_sexp sexp
= jump_of_sexp__ sexp
1915 and asmbody_of_sexp__
=
1916 let _loc = "Xxx.asmbody"
1919 | Sexp.List
([ v1; v2
]) ->
1920 let v1 = il_of_sexp
v1
1921 and v2
= Conv.list_of_sexp
(wrap_of_sexp colon_of_sexp
) v2
1923 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
1924 and asmbody_of_sexp sexp
=
1925 try asmbody_of_sexp__ sexp
1927 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1928 and colon_of_sexp__
=
1929 let _loc = "Xxx.colon"
1932 | (Sexp.List
(Sexp.Atom
(("colon" | "Colon" as tag
)) :: sexp_args
) as
1934 (match sexp_args
with
1937 Conv.list_of_sexp
(wrap2_of_sexp colon_option_of_sexp
) v1
1939 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1940 | (Sexp.Atom
("colon" | "Colon") as sexp
) ->
1941 Conv_error.stag_takes_args
_loc sexp
1942 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1943 Conv_error.nested_list_invalid_sum
_loc sexp
1944 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1945 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1946 and colon_of_sexp sexp
= colon_of_sexp__ sexp
1947 and colon_option_of_sexp__
=
1948 let _loc = "Xxx.colon_option"
1949 in fun sexp
-> wrap_of_sexp colon_option_bis_of_sexp sexp
1950 and colon_option_of_sexp sexp
=
1951 try colon_option_of_sexp__ sexp
1953 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
1954 and colon_option_bis_of_sexp__
=
1955 let _loc = "Xxx.colon_option_bis"
1958 | Sexp.Atom
("colonMisc" | "ColonMisc") -> ColonMisc
1960 (Sexp.Atom
(("colonExpr" | "ColonExpr" as tag
)) :: sexp_args
)
1962 (match sexp_args
with
1963 | [ v1 ] -> let v1 = expression_of_sexp
v1 in ColonExpr
v1
1964 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1965 | (Sexp.List
(Sexp.Atom
("colonMisc" | "ColonMisc") :: _
) as sexp
) ->
1966 Conv_error.stag_no_args
_loc sexp
1967 | (Sexp.Atom
("colonExpr" | "ColonExpr") as sexp
) ->
1968 Conv_error.stag_takes_args
_loc sexp
1969 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
1970 Conv_error.nested_list_invalid_sum
_loc sexp
1971 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
1972 | sexp
-> Conv_error.unexpected_stag
_loc sexp
1973 and colon_option_bis_of_sexp sexp
= colon_option_bis_of_sexp__ sexp
1974 and declaration_of_sexp__
=
1975 let _loc = "Xxx.declaration"
1978 | (Sexp.List
(Sexp.Atom
(("declList" | "DeclList" as tag
)) :: sexp_args
)
1980 (match sexp_args
with
1984 (Conv.list_of_sexp
(wrap2_of_sexp onedecl_of_sexp
)) v1
1986 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
1988 (Sexp.Atom
(("macroDecl" | "MacroDecl" as tag
)) :: sexp_args
)
1990 (match sexp_args
with
1995 | Sexp.List
([ v1; v2
]) ->
1996 let v1 = Conv.string_of_sexp
v1
1998 Conv.list_of_sexp
(wrap2_of_sexp argument_of_sexp
) v2
2000 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
2003 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2004 | (Sexp.Atom
("declList" | "DeclList") as sexp
) ->
2005 Conv_error.stag_takes_args
_loc sexp
2006 | (Sexp.Atom
("macroDecl" | "MacroDecl") as sexp
) ->
2007 Conv_error.stag_takes_args
_loc sexp
2008 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2009 Conv_error.nested_list_invalid_sum
_loc sexp
2010 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2011 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2012 and declaration_of_sexp sexp
= declaration_of_sexp__ sexp
2013 and onedecl_of_sexp__
=
2014 let _loc = "Xxx.onedecl"
2017 | (Sexp.List field_sexps
as sexp
) ->
2018 let v_namei_field = ref None
and v_type_field
= ref None
2019 and v_type_bis_field
= ref None
and v_storage_field
= ref None
2020 and v_local_field
= ref None
and v_attr_field
= ref None
2021 and duplicates
= ref [] and extra
= ref [] in
2024 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
2025 ((match field_name
with
2027 (match !v_namei_field with
2032 | Sexp.List
([ v1; v2
]) ->
2033 let v1 = name_of_sexp
v1
2037 | Sexp.List
([ v1; v2
]) ->
2038 let v1 = info_of_sexp
v1
2039 and v2
= initialiser_of_sexp v2
2043 tuple_of_size_n_expected
_loc 2
2048 Conv_error.tuple_of_size_n_expected
_loc 2
2051 in v_namei_field := Some
fvalue
2052 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2054 (match !v_type_field
with
2056 let fvalue = fullType_of_sexp field_sexp
2057 in v_type_field
:= Some
fvalue
2058 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2060 (match !v_type_bis_field
with
2064 (Conv.option_of_sexp fullType_of_sexp
)
2066 in v_type_bis_field
:= Some
fvalue
2067 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2069 (match !v_storage_field
with
2071 let fvalue = storage_of_sexp field_sexp
2072 in v_storage_field
:= Some
fvalue
2073 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2075 (match !v_local_field
with
2077 let fvalue = local_decl_of_sexp field_sexp
2078 in v_local_field
:= Some
fvalue
2079 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2081 (match !v_attr_field
with
2084 Conv.list_of_sexp attribute_of_sexp field_sexp
2085 in v_attr_field
:= Some
fvalue
2086 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2088 if !Conv.record_check_extra_fields
2089 then extra
:= field_name
:: !extra
2092 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
2096 if !duplicates
<> []
2097 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
2100 then Conv_error.record_extra_fields
_loc !extra sexp
2102 (match ((!v_namei_field), (!v_type_field
),
2103 (!v_type_bis_field
), (!v_storage_field
),
2104 (!v_local_field
), (!v_attr_field
))
2106 | (Some v_namei_value
, Some v_type_value
,
2107 Some v_type_bis_value
, Some v_storage_value
,
2108 Some v_local_value
, Some v_attr_value
) ->
2110 v_namei
= v_namei_value
;
2111 v_type
= v_type_value
;
2112 v_type_bis
= v_type_bis_value
;
2113 v_storage
= v_storage_value
;
2114 v_local
= v_local_value
;
2115 v_attr
= v_attr_value
;
2118 Conv_error.record_undefined_elements
_loc sexp
2119 [ ((!v_namei_field = None
), "v_namei");
2120 ((!v_type_field
= None
), "v_type");
2121 ((!v_type_bis_field
= None
), "v_type_bis");
2122 ((!v_storage_field
= None
), "v_storage");
2123 ((!v_local_field
= None
), "v_local");
2124 ((!v_attr_field
= None
), "v_attr") ]))
2125 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
2126 and onedecl_of_sexp sexp
= onedecl_of_sexp__ sexp
2127 and storage_of_sexp__
=
2128 let _loc = "Xxx.storage"
2131 | Sexp.List
([ v1; v2
]) ->
2132 let v1 = storagebis_of_sexp
v1
2133 and v2
= Conv.bool_of_sexp v2
2135 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
2136 and storage_of_sexp sexp
=
2137 try storage_of_sexp__ sexp
2139 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2140 and storagebis_of_sexp__
=
2141 let _loc = "Xxx.storagebis"
2144 | Sexp.Atom
("noSto" | "NoSto") -> NoSto
2145 | Sexp.Atom
("stoTypedef" | "StoTypedef") -> StoTypedef
2146 | (Sexp.List
(Sexp.Atom
(("sto" | "Sto" as tag
)) :: sexp_args
) as sexp
)
2148 (match sexp_args
with
2149 | [ v1 ] -> let v1 = storageClass_of_sexp
v1 in Sto
v1
2150 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2151 | (Sexp.List
(Sexp.Atom
("noSto" | "NoSto") :: _
) as sexp
) ->
2152 Conv_error.stag_no_args
_loc sexp
2153 | (Sexp.List
(Sexp.Atom
("stoTypedef" | "StoTypedef") :: _
) as sexp
) ->
2154 Conv_error.stag_no_args
_loc sexp
2155 | (Sexp.Atom
("sto" | "Sto") as sexp
) ->
2156 Conv_error.stag_takes_args
_loc sexp
2157 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2158 Conv_error.nested_list_invalid_sum
_loc sexp
2159 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2160 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2161 and storagebis_of_sexp sexp
= storagebis_of_sexp__ sexp
2162 and storageClass_of_sexp__
=
2163 let _loc = "Xxx.storageClass"
2166 | Sexp.Atom
("auto" | "Auto") -> Auto
2167 | Sexp.Atom
("static" | "Static") -> Static
2168 | Sexp.Atom
("register" | "Register") -> Register
2169 | Sexp.Atom
("extern" | "Extern") -> Extern
2170 | (Sexp.List
(Sexp.Atom
("auto" | "Auto") :: _
) as sexp
) ->
2171 Conv_error.stag_no_args
_loc sexp
2172 | (Sexp.List
(Sexp.Atom
("static" | "Static") :: _
) as sexp
) ->
2173 Conv_error.stag_no_args
_loc sexp
2174 | (Sexp.List
(Sexp.Atom
("register" | "Register") :: _
) as sexp
) ->
2175 Conv_error.stag_no_args
_loc sexp
2176 | (Sexp.List
(Sexp.Atom
("extern" | "Extern") :: _
) as sexp
) ->
2177 Conv_error.stag_no_args
_loc sexp
2178 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2179 Conv_error.nested_list_invalid_sum
_loc sexp
2180 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2181 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2182 and storageClass_of_sexp sexp
= storageClass_of_sexp__ sexp
2183 and local_decl_of_sexp__
=
2184 let _loc = "Xxx.local_decl"
2187 | Sexp.Atom
("localDecl" | "LocalDecl") -> LocalDecl
2188 | Sexp.Atom
("notLocalDecl" | "NotLocalDecl") -> NotLocalDecl
2189 | (Sexp.List
(Sexp.Atom
("localDecl" | "LocalDecl") :: _
) as sexp
) ->
2190 Conv_error.stag_no_args
_loc sexp
2191 | (Sexp.List
(Sexp.Atom
("notLocalDecl" | "NotLocalDecl") :: _
) as sexp
)
2192 -> Conv_error.stag_no_args
_loc sexp
2193 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2194 Conv_error.nested_list_invalid_sum
_loc sexp
2195 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2196 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2197 and local_decl_of_sexp sexp
= local_decl_of_sexp__ sexp
2198 and initialiser_of_sexp__
=
2199 let _loc = "Xxx.initialiser"
2200 in fun sexp
-> wrap_of_sexp initialiserbis_of_sexp sexp
2201 and initialiser_of_sexp sexp
=
2202 try initialiser_of_sexp__ sexp
2204 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2205 and initialiserbis_of_sexp__
=
2206 let _loc = "Xxx.initialiserbis"
2209 | (Sexp.List
(Sexp.Atom
(("initExpr" | "InitExpr" as tag
)) :: sexp_args
)
2211 (match sexp_args
with
2212 | [ v1 ] -> let v1 = expression_of_sexp
v1 in InitExpr
v1
2213 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2214 | (Sexp.List
(Sexp.Atom
(("initList" | "InitList" as tag
)) :: sexp_args
)
2216 (match sexp_args
with
2219 Conv.list_of_sexp
(wrap2_of_sexp initialiser_of_sexp
) v1
2221 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2223 (Sexp.Atom
(("initDesignators" | "InitDesignators" as tag
)) ::
2226 (match sexp_args
with
2228 let v1 = Conv.list_of_sexp designator_of_sexp
v1
2229 and v2
= initialiser_of_sexp v2
2230 in InitDesignators
((v1, v2
))
2231 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2233 (Sexp.Atom
(("initFieldOld" | "InitFieldOld" as tag
)) :: sexp_args
)
2235 (match sexp_args
with
2237 let v1 = Conv.string_of_sexp
v1
2238 and v2
= initialiser_of_sexp v2
2239 in InitFieldOld
((v1, v2
))
2240 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2242 (Sexp.Atom
(("initIndexOld" | "InitIndexOld" as tag
)) :: sexp_args
)
2244 (match sexp_args
with
2246 let v1 = expression_of_sexp
v1
2247 and v2
= initialiser_of_sexp v2
2248 in InitIndexOld
((v1, v2
))
2249 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2250 | (Sexp.Atom
("initExpr" | "InitExpr") as sexp
) ->
2251 Conv_error.stag_takes_args
_loc sexp
2252 | (Sexp.Atom
("initList" | "InitList") as sexp
) ->
2253 Conv_error.stag_takes_args
_loc sexp
2254 | (Sexp.Atom
("initDesignators" | "InitDesignators") as sexp
) ->
2255 Conv_error.stag_takes_args
_loc sexp
2256 | (Sexp.Atom
("initFieldOld" | "InitFieldOld") as sexp
) ->
2257 Conv_error.stag_takes_args
_loc sexp
2258 | (Sexp.Atom
("initIndexOld" | "InitIndexOld") as sexp
) ->
2259 Conv_error.stag_takes_args
_loc sexp
2260 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2261 Conv_error.nested_list_invalid_sum
_loc sexp
2262 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2263 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2264 and initialiserbis_of_sexp sexp
= initialiserbis_of_sexp__ sexp
2265 and designator_of_sexp__
=
2266 let _loc = "Xxx.designator"
2267 in fun sexp
-> wrap_of_sexp designatorbis_of_sexp sexp
2268 and designator_of_sexp sexp
=
2269 try designator_of_sexp__ sexp
2271 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2272 and designatorbis_of_sexp__
=
2273 let _loc = "Xxx.designatorbis"
2277 (Sexp.Atom
(("designatorField" | "DesignatorField" as tag
)) ::
2280 (match sexp_args
with
2281 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in DesignatorField
v1
2282 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2284 (Sexp.Atom
(("designatorIndex" | "DesignatorIndex" as tag
)) ::
2287 (match sexp_args
with
2288 | [ v1 ] -> let v1 = expression_of_sexp
v1 in DesignatorIndex
v1
2289 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2291 (Sexp.Atom
(("designatorRange" | "DesignatorRange" as tag
)) ::
2294 (match sexp_args
with
2296 let v1 = expression_of_sexp
v1
2297 and v2
= expression_of_sexp v2
2298 in DesignatorRange
((v1, v2
))
2299 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2300 | (Sexp.Atom
("designatorField" | "DesignatorField") as sexp
) ->
2301 Conv_error.stag_takes_args
_loc sexp
2302 | (Sexp.Atom
("designatorIndex" | "DesignatorIndex") as sexp
) ->
2303 Conv_error.stag_takes_args
_loc sexp
2304 | (Sexp.Atom
("designatorRange" | "DesignatorRange") as sexp
) ->
2305 Conv_error.stag_takes_args
_loc sexp
2306 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2307 Conv_error.nested_list_invalid_sum
_loc sexp
2308 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2309 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2310 and designatorbis_of_sexp sexp
= designatorbis_of_sexp__ sexp
2311 and definition_of_sexp__
=
2312 let _loc = "Xxx.definition"
2313 in fun sexp
-> wrap_of_sexp definitionbis_of_sexp sexp
2314 and definition_of_sexp sexp
=
2315 try definition_of_sexp__ sexp
2317 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2318 and definitionbis_of_sexp__
=
2319 let _loc = "Xxx.definitionbis"
2322 | (Sexp.List field_sexps
as sexp
) ->
2323 let f_name_field = ref None
and f_type_field
= ref None
2324 and f_storage_field
= ref None
and f_body_field
= ref None
2325 and f_attr_field
= ref None
and f_old_c_style_field
= ref None
2326 and duplicates
= ref [] and extra
= ref [] in
2329 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
2330 ((match field_name
with
2332 (match !f_name_field with
2334 let fvalue = name_of_sexp field_sexp
2335 in f_name_field := Some
fvalue
2336 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2338 (match !f_type_field
with
2340 let fvalue = functionType_of_sexp field_sexp
2341 in f_type_field
:= Some
fvalue
2342 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2344 (match !f_storage_field
with
2346 let fvalue = storage_of_sexp field_sexp
2347 in f_storage_field
:= Some
fvalue
2348 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2350 (match !f_body_field
with
2352 let fvalue = compound_of_sexp field_sexp
2353 in f_body_field
:= Some
fvalue
2354 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2356 (match !f_attr_field
with
2359 Conv.list_of_sexp attribute_of_sexp field_sexp
2360 in f_attr_field
:= Some
fvalue
2361 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2362 | "f_old_c_style" ->
2363 (match !f_old_c_style_field
with
2367 (Conv.list_of_sexp declaration_of_sexp
)
2369 in f_old_c_style_field
:= Some
fvalue
2370 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2372 if !Conv.record_check_extra_fields
2373 then extra
:= field_name
:: !extra
2376 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
2380 if !duplicates
<> []
2381 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
2384 then Conv_error.record_extra_fields
_loc !extra sexp
2386 (match ((!f_name_field), (!f_type_field
), (!f_storage_field
),
2387 (!f_body_field
), (!f_attr_field
),
2388 (!f_old_c_style_field
))
2390 | (Some f_name_value
, Some f_type_value
,
2391 Some f_storage_value
, Some f_body_value
,
2392 Some f_attr_value
, Some f_old_c_style_value
) ->
2394 f_name
= f_name_value
;
2395 f_type
= f_type_value
;
2396 f_storage
= f_storage_value
;
2397 f_body
= f_body_value
;
2398 f_attr
= f_attr_value
;
2399 f_old_c_style
= f_old_c_style_value
;
2402 Conv_error.record_undefined_elements
_loc sexp
2403 [ ((!f_name_field = None
), "f_name");
2404 ((!f_type_field
= None
), "f_type");
2405 ((!f_storage_field
= None
), "f_storage");
2406 ((!f_body_field
= None
), "f_body");
2407 ((!f_attr_field
= None
), "f_attr");
2408 ((!f_old_c_style_field
= None
), "f_old_c_style") ]))
2409 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
2410 and definitionbis_of_sexp sexp
= definitionbis_of_sexp__ sexp
2411 and cpp_directive_of_sexp__
=
2412 let _loc = "Xxx.cpp_directive"
2415 | (Sexp.List
(Sexp.Atom
(("define" | "Define" as tag
)) :: sexp_args
) as
2417 (match sexp_args
with
2418 | [ v1 ] -> let v1 = define_of_sexp
v1 in Define
v1
2419 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2420 | (Sexp.List
(Sexp.Atom
(("include" | "Include" as tag
)) :: sexp_args
) as
2422 (match sexp_args
with
2423 | [ v1 ] -> let v1 = includ_of_sexp
v1 in Include
v1
2424 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2425 | (Sexp.List
(Sexp.Atom
(("undef" | "Undef" as tag
)) :: sexp_args
) as
2427 (match sexp_args
with
2428 | [ v1 ] -> let v1 = wrap_of_sexp
Conv.string_of_sexp
v1 in Undef
v1
2429 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2431 (Sexp.Atom
(("pragmaAndCo" | "PragmaAndCo" as tag
)) :: sexp_args
)
2433 (match sexp_args
with
2434 | [ v1 ] -> let v1 = il_of_sexp
v1 in PragmaAndCo
v1
2435 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2436 | (Sexp.Atom
("define" | "Define") as sexp
) ->
2437 Conv_error.stag_takes_args
_loc sexp
2438 | (Sexp.Atom
("include" | "Include") as sexp
) ->
2439 Conv_error.stag_takes_args
_loc sexp
2440 | (Sexp.Atom
("undef" | "Undef") as sexp
) ->
2441 Conv_error.stag_takes_args
_loc sexp
2442 | (Sexp.Atom
("pragmaAndCo" | "PragmaAndCo") as sexp
) ->
2443 Conv_error.stag_takes_args
_loc sexp
2444 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2445 Conv_error.nested_list_invalid_sum
_loc sexp
2446 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2447 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2448 and cpp_directive_of_sexp sexp
= cpp_directive_of_sexp__ sexp
2449 and define_of_sexp__
=
2450 let _loc = "Xxx.define"
2453 | Sexp.List
([ v1; v2
]) ->
2454 let v1 = wrap_of_sexp
Conv.string_of_sexp
v1
2457 | Sexp.List
([ v1; v2
]) ->
2458 let v1 = define_kind_of_sexp
v1
2459 and v2
= define_val_of_sexp v2
2461 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
2463 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
2464 and define_of_sexp sexp
=
2465 try define_of_sexp__ sexp
2467 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2468 and define_kind_of_sexp__
=
2469 let _loc = "Xxx.define_kind"
2472 | Sexp.Atom
("defineVar" | "DefineVar") -> DefineVar
2474 (Sexp.Atom
(("defineFunc" | "DefineFunc" as tag
)) :: sexp_args
)
2476 (match sexp_args
with
2481 (wrap2_of_sexp
(wrap_of_sexp
Conv.string_of_sexp
)))
2484 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2485 | (Sexp.List
(Sexp.Atom
("defineVar" | "DefineVar") :: _
) as sexp
) ->
2486 Conv_error.stag_no_args
_loc sexp
2487 | (Sexp.Atom
("defineFunc" | "DefineFunc") as sexp
) ->
2488 Conv_error.stag_takes_args
_loc sexp
2489 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2490 Conv_error.nested_list_invalid_sum
_loc sexp
2491 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2492 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2493 and define_kind_of_sexp sexp
= define_kind_of_sexp__ sexp
2494 and define_val_of_sexp__
=
2495 let _loc = "Xxx.define_val"
2499 (Sexp.Atom
(("defineExpr" | "DefineExpr" as tag
)) :: sexp_args
)
2501 (match sexp_args
with
2502 | [ v1 ] -> let v1 = expression_of_sexp
v1 in DefineExpr
v1
2503 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2505 (Sexp.Atom
(("defineStmt" | "DefineStmt" as tag
)) :: sexp_args
)
2507 (match sexp_args
with
2508 | [ v1 ] -> let v1 = statement_of_sexp
v1 in DefineStmt
v1
2509 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2511 (Sexp.Atom
(("defineType" | "DefineType" as tag
)) :: sexp_args
)
2513 (match sexp_args
with
2514 | [ v1 ] -> let v1 = fullType_of_sexp
v1 in DefineType
v1
2515 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2517 (Sexp.Atom
(("defineDoWhileZero" | "DefineDoWhileZero" as tag
)) ::
2520 (match sexp_args
with
2525 | Sexp.List
([ v1; v2
]) ->
2526 let v1 = statement_of_sexp
v1
2527 and v2
= expression_of_sexp v2
2529 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
2531 in DefineDoWhileZero
v1
2532 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2534 (Sexp.Atom
(("defineFunction" | "DefineFunction" as tag
)) ::
2537 (match sexp_args
with
2538 | [ v1 ] -> let v1 = definition_of_sexp
v1 in DefineFunction
v1
2539 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2541 (Sexp.Atom
(("defineInit" | "DefineInit" as tag
)) :: sexp_args
)
2543 (match sexp_args
with
2544 | [ v1 ] -> let v1 = initialiser_of_sexp
v1 in DefineInit
v1
2545 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2547 (Sexp.Atom
(("defineText" | "DefineText" as tag
)) :: sexp_args
)
2549 (match sexp_args
with
2551 let v1 = wrap_of_sexp
Conv.string_of_sexp
v1 in DefineText
v1
2552 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2553 | Sexp.Atom
("defineEmpty" | "DefineEmpty") -> DefineEmpty
2554 | Sexp.Atom
("defineTodo" | "DefineTodo") -> DefineTodo
2555 | (Sexp.Atom
("defineExpr" | "DefineExpr") as sexp
) ->
2556 Conv_error.stag_takes_args
_loc sexp
2557 | (Sexp.Atom
("defineStmt" | "DefineStmt") as sexp
) ->
2558 Conv_error.stag_takes_args
_loc sexp
2559 | (Sexp.Atom
("defineType" | "DefineType") as sexp
) ->
2560 Conv_error.stag_takes_args
_loc sexp
2561 | (Sexp.Atom
("defineDoWhileZero" | "DefineDoWhileZero") as sexp
) ->
2562 Conv_error.stag_takes_args
_loc sexp
2563 | (Sexp.Atom
("defineFunction" | "DefineFunction") as sexp
) ->
2564 Conv_error.stag_takes_args
_loc sexp
2565 | (Sexp.Atom
("defineInit" | "DefineInit") as sexp
) ->
2566 Conv_error.stag_takes_args
_loc sexp
2567 | (Sexp.Atom
("defineText" | "DefineText") as sexp
) ->
2568 Conv_error.stag_takes_args
_loc sexp
2569 | (Sexp.List
(Sexp.Atom
("defineEmpty" | "DefineEmpty") :: _
) as sexp
) ->
2570 Conv_error.stag_no_args
_loc sexp
2571 | (Sexp.List
(Sexp.Atom
("defineTodo" | "DefineTodo") :: _
) as sexp
) ->
2572 Conv_error.stag_no_args
_loc sexp
2573 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2574 Conv_error.nested_list_invalid_sum
_loc sexp
2575 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2576 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2577 and define_val_of_sexp sexp
= define_val_of_sexp__ sexp
2578 and includ_of_sexp__
=
2579 let _loc = "Xxx.includ"
2582 | (Sexp.List field_sexps
as sexp
) ->
2583 let i_include_field = ref None
and i_rel_pos_field
= ref None
2584 and i_is_in_ifdef_field
= ref None
and i_content_field
= ref None
2585 and duplicates
= ref [] and extra
= ref [] in
2588 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
2589 ((match field_name
with
2591 (match !i_include_field with
2594 wrap_of_sexp inc_file_of_sexp field_sexp
2595 in i_include_field := Some
fvalue
2596 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2598 (match !i_rel_pos_field
with
2602 (Conv.option_of_sexp include_rel_pos_of_sexp
)
2604 in i_rel_pos_field
:= Some
fvalue
2605 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2606 | "i_is_in_ifdef" ->
2607 (match !i_is_in_ifdef_field
with
2609 let fvalue = Conv.bool_of_sexp field_sexp
2610 in i_is_in_ifdef_field
:= Some
fvalue
2611 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2613 (match !i_content_field
with
2618 | Sexp.List
([ v1; v2
]) ->
2619 let v1 = Common.filename_of_sexp
v1
2620 and v2
= program_of_sexp v2
2623 Conv_error.tuple_of_size_n_expected
_loc 2
2626 in i_content_field
:= Some
fvalue
2627 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2629 if !Conv.record_check_extra_fields
2630 then extra
:= field_name
:: !extra
2633 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
2637 if !duplicates
<> []
2638 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
2641 then Conv_error.record_extra_fields
_loc !extra sexp
2643 (match ((!i_include_field), (!i_rel_pos_field
),
2644 (!i_is_in_ifdef_field
), (!i_content_field
))
2646 | (Some i_include_value
, Some i_rel_pos_value
,
2647 Some i_is_in_ifdef_value
, Some i_content_value
) ->
2649 i_include
= i_include_value
;
2650 i_rel_pos
= i_rel_pos_value
;
2651 i_is_in_ifdef
= i_is_in_ifdef_value
;
2652 i_content
= i_content_value
;
2655 Conv_error.record_undefined_elements
_loc sexp
2656 [ ((!i_include_field = None
), "i_include");
2657 ((!i_rel_pos_field
= None
), "i_rel_pos");
2658 ((!i_is_in_ifdef_field
= None
), "i_is_in_ifdef");
2659 ((!i_content_field
= None
), "i_content") ]))
2660 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
2661 and includ_of_sexp sexp
= includ_of_sexp__ sexp
2662 and inc_file_of_sexp__
=
2663 let _loc = "Xxx.inc_file"
2666 | (Sexp.List
(Sexp.Atom
(("local" | "Local" as tag
)) :: sexp_args
) as
2668 (match sexp_args
with
2670 let v1 = Conv.list_of_sexp inc_elem_of_sexp
v1 in Local
v1
2671 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2672 | (Sexp.List
(Sexp.Atom
(("nonLocal" | "NonLocal" as tag
)) :: sexp_args
)
2674 (match sexp_args
with
2676 let v1 = Conv.list_of_sexp inc_elem_of_sexp
v1 in NonLocal
v1
2677 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2678 | (Sexp.List
(Sexp.Atom
(("weird" | "Weird" as tag
)) :: sexp_args
) as
2680 (match sexp_args
with
2681 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in Weird
v1
2682 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2683 | (Sexp.Atom
("local" | "Local") as sexp
) ->
2684 Conv_error.stag_takes_args
_loc sexp
2685 | (Sexp.Atom
("nonLocal" | "NonLocal") as sexp
) ->
2686 Conv_error.stag_takes_args
_loc sexp
2687 | (Sexp.Atom
("weird" | "Weird") as sexp
) ->
2688 Conv_error.stag_takes_args
_loc sexp
2689 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2690 Conv_error.nested_list_invalid_sum
_loc sexp
2691 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2692 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2693 and inc_file_of_sexp sexp
= inc_file_of_sexp__ sexp
2694 and inc_elem_of_sexp__
=
2695 let _loc = "Xxx.inc_elem" in fun sexp
-> Conv.string_of_sexp sexp
2696 and inc_elem_of_sexp sexp
=
2697 try inc_elem_of_sexp__ sexp
2699 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2700 and include_rel_pos_of_sexp__
=
2701 let _loc = "Xxx.include_rel_pos"
2704 | (Sexp.List field_sexps
as sexp
) ->
2705 let first_of_field = ref None
and last_of_field
= ref None
2706 and duplicates
= ref [] and extra
= ref [] in
2709 | Sexp.List
([ Sexp.Atom field_name
; field_sexp
]) :: tail
->
2710 ((match field_name
with
2712 (match !first_of_field with
2716 (Conv.list_of_sexp
Conv.string_of_sexp
)
2718 in first_of_field := Some
fvalue
2719 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2721 (match !last_of_field
with
2725 (Conv.list_of_sexp
Conv.string_of_sexp
)
2727 in last_of_field
:= Some
fvalue
2728 | Some _
-> duplicates
:= field_name
:: !duplicates
)
2730 if !Conv.record_check_extra_fields
2731 then extra
:= field_name
:: !extra
2734 | sexp
:: _
-> Conv_error.record_only_pairs_expected
_loc sexp
2738 if !duplicates
<> []
2739 then Conv_error.record_duplicate_fields
_loc !duplicates sexp
2742 then Conv_error.record_extra_fields
_loc !extra sexp
2744 (match ((!first_of_field), (!last_of_field
)) with
2745 | (Some first_of_value
, Some last_of_value
) ->
2746 { first_of
= first_of_value
; last_of
= last_of_value
; }
2748 Conv_error.record_undefined_elements
_loc sexp
2749 [ ((!first_of_field = None
), "first_of");
2750 ((!last_of_field
= None
), "last_of") ]))
2751 | (Sexp.Atom _
as sexp
) -> Conv_error.record_list_instead_atom
_loc sexp
2752 and include_rel_pos_of_sexp sexp
= include_rel_pos_of_sexp__ sexp
2753 and ifdef_directive_of_sexp__
=
2754 let _loc = "Xxx.ifdef_directive"
2758 (Sexp.Atom
(("ifdefDirective" | "IfdefDirective" as tag
)) ::
2761 (match sexp_args
with
2766 | Sexp.List
([ v1; v2
]) ->
2767 let v1 = ifdefkind_of_sexp
v1
2768 and v2
= matching_tag_of_sexp v2
2770 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
2772 in IfdefDirective
v1
2773 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2774 | (Sexp.Atom
("ifdefDirective" | "IfdefDirective") as sexp
) ->
2775 Conv_error.stag_takes_args
_loc sexp
2776 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2777 Conv_error.nested_list_invalid_sum
_loc sexp
2778 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2779 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2780 and ifdef_directive_of_sexp sexp
= ifdef_directive_of_sexp__ sexp
2781 and ifdefkind_of_sexp__
=
2782 let _loc = "Xxx.ifdefkind"
2785 | Sexp.Atom
("ifdef" | "Ifdef") -> Ifdef
2786 | Sexp.Atom
("ifdefElseif" | "IfdefElseif") -> IfdefElseif
2787 | Sexp.Atom
("ifdefElse" | "IfdefElse") -> IfdefElse
2788 | Sexp.Atom
("ifdefEndif" | "IfdefEndif") -> IfdefEndif
2789 | (Sexp.List
(Sexp.Atom
("ifdef" | "Ifdef") :: _
) as sexp
) ->
2790 Conv_error.stag_no_args
_loc sexp
2791 | (Sexp.List
(Sexp.Atom
("ifdefElseif" | "IfdefElseif") :: _
) as sexp
) ->
2792 Conv_error.stag_no_args
_loc sexp
2793 | (Sexp.List
(Sexp.Atom
("ifdefElse" | "IfdefElse") :: _
) as sexp
) ->
2794 Conv_error.stag_no_args
_loc sexp
2795 | (Sexp.List
(Sexp.Atom
("ifdefEndif" | "IfdefEndif") :: _
) as sexp
) ->
2796 Conv_error.stag_no_args
_loc sexp
2797 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2798 Conv_error.nested_list_invalid_sum
_loc sexp
2799 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2800 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2801 and ifdefkind_of_sexp sexp
= ifdefkind_of_sexp__ sexp
2802 and matching_tag_of_sexp__
=
2803 let _loc = "Xxx.matching_tag"
2806 | (Sexp.List
(Sexp.Atom
(("ifdefTag" | "IfdefTag" as tag
)) :: sexp_args
)
2808 (match sexp_args
with
2812 | Sexp.List
([ v1; v2
]) ->
2813 let v1 = Conv.int_of_sexp
v1
2814 and v2
= Conv.int_of_sexp v2
2816 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
2818 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2819 | (Sexp.Atom
("ifdefTag" | "IfdefTag") as sexp
) ->
2820 Conv_error.stag_takes_args
_loc sexp
2821 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2822 Conv_error.nested_list_invalid_sum
_loc sexp
2823 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2824 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2825 and matching_tag_of_sexp sexp
= matching_tag_of_sexp__ sexp
2826 and toplevel_of_sexp__
=
2827 let _loc = "Xxx.toplevel"
2831 (Sexp.Atom
(("declaration" | "Declaration" as tag
)) :: sexp_args
)
2833 (match sexp_args
with
2834 | [ v1 ] -> let v1 = declaration_of_sexp
v1 in Declaration
v1
2835 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2837 (Sexp.Atom
(("definition" | "Definition" as tag
)) :: sexp_args
)
2839 (match sexp_args
with
2840 | [ v1 ] -> let v1 = definition_of_sexp
v1 in Definition
v1
2841 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2842 | (Sexp.List
(Sexp.Atom
(("cppTop" | "CppTop" as tag
)) :: sexp_args
) as
2844 (match sexp_args
with
2845 | [ v1 ] -> let v1 = cpp_directive_of_sexp
v1 in CppTop
v1
2846 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2847 | (Sexp.List
(Sexp.Atom
(("ifdefTop" | "IfdefTop" as tag
)) :: sexp_args
)
2849 (match sexp_args
with
2850 | [ v1 ] -> let v1 = ifdef_directive_of_sexp
v1 in IfdefTop
v1
2851 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2852 | (Sexp.List
(Sexp.Atom
(("macroTop" | "MacroTop" as tag
)) :: sexp_args
)
2854 (match sexp_args
with
2856 let v1 = Conv.string_of_sexp
v1
2857 and v2
= Conv.list_of_sexp
(wrap2_of_sexp argument_of_sexp
) v2
2858 and v3
= il_of_sexp v3
2859 in MacroTop
((v1, v2
, v3
))
2860 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2861 | (Sexp.List
(Sexp.Atom
(("emptyDef" | "EmptyDef" as tag
)) :: sexp_args
)
2863 (match sexp_args
with
2864 | [ v1 ] -> let v1 = il_of_sexp
v1 in EmptyDef
v1
2865 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2867 (Sexp.Atom
(("notParsedCorrectly" | "NotParsedCorrectly" as tag
)) ::
2870 (match sexp_args
with
2871 | [ v1 ] -> let v1 = il_of_sexp
v1 in NotParsedCorrectly
v1
2872 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2873 | (Sexp.List
(Sexp.Atom
(("finalDef" | "FinalDef" as tag
)) :: sexp_args
)
2875 (match sexp_args
with
2876 | [ v1 ] -> let v1 = info_of_sexp
v1 in FinalDef
v1
2877 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2878 | (Sexp.Atom
("declaration" | "Declaration") as sexp
) ->
2879 Conv_error.stag_takes_args
_loc sexp
2880 | (Sexp.Atom
("definition" | "Definition") as sexp
) ->
2881 Conv_error.stag_takes_args
_loc sexp
2882 | (Sexp.Atom
("cppTop" | "CppTop") as sexp
) ->
2883 Conv_error.stag_takes_args
_loc sexp
2884 | (Sexp.Atom
("ifdefTop" | "IfdefTop") as sexp
) ->
2885 Conv_error.stag_takes_args
_loc sexp
2886 | (Sexp.Atom
("macroTop" | "MacroTop") as sexp
) ->
2887 Conv_error.stag_takes_args
_loc sexp
2888 | (Sexp.Atom
("emptyDef" | "EmptyDef") as sexp
) ->
2889 Conv_error.stag_takes_args
_loc sexp
2890 | (Sexp.Atom
("notParsedCorrectly" | "NotParsedCorrectly") as sexp
) ->
2891 Conv_error.stag_takes_args
_loc sexp
2892 | (Sexp.Atom
("finalDef" | "FinalDef") as sexp
) ->
2893 Conv_error.stag_takes_args
_loc sexp
2894 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
2895 Conv_error.nested_list_invalid_sum
_loc sexp
2896 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
2897 | sexp
-> Conv_error.unexpected_stag
_loc sexp
2898 and toplevel_of_sexp sexp
= toplevel_of_sexp__ sexp
2899 and program_of_sexp__
=
2900 let _loc = "Xxx.program"
2901 in fun sexp
-> Conv.list_of_sexp toplevel_of_sexp sexp
2902 and program_of_sexp sexp
=
2903 try program_of_sexp__ sexp
2905 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2910 and metavars_binding_of_sexp__ =
2911 let _loc = "Xxx.metavars_binding"
2915 Common.assoc_of_sexp Ast_cocci.meta_name_of_sexp metavar_binding_kind_of_sexp
2919 and metavars_binding_of_sexp sexp
=
2920 try metavars_binding_of_sexp__ sexp
2922 | Conv_error.No_variant_match
((msg
, sexp
)) -> Conv.of_sexp_error msg sexp
2923 and metavar_binding_kind_of_sexp__
=
2924 let _loc = "Xxx.metavar_binding_kind"
2928 (Sexp.Atom
(("metaIdVal" | "MetaIdVal" as tag
)) :: sexp_args
)
2930 (match sexp_args
with
2931 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in MetaIdVal
v1
2932 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2934 (Sexp.Atom
(("metaFuncVal" | "MetaFuncVal" as tag
)) :: sexp_args
)
2936 (match sexp_args
with
2937 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in MetaFuncVal
v1
2938 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2940 (Sexp.Atom
(("metaLocalFuncVal" | "MetaLocalFuncVal" as tag
)) ::
2943 (match sexp_args
with
2944 | [ v1 ] -> let v1 = Conv.string_of_sexp
v1 in MetaLocalFuncVal
v1
2945 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2947 (Sexp.Atom
(("metaExprVal" | "MetaExprVal" as tag
)) :: sexp_args
)
2949 (match sexp_args
with
2950 | [ v1 ] -> let v1 = expression_of_sexp
v1 in MetaExprVal
v1
2951 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2953 (Sexp.Atom
(("metaExprListVal" | "MetaExprListVal" as tag
)) ::
2956 (match sexp_args
with
2958 let v1 = Conv.list_of_sexp
(wrap2_of_sexp argument_of_sexp
) v1
2959 in MetaExprListVal
v1
2960 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2962 (Sexp.Atom
(("metaParamVal" | "MetaParamVal" as tag
)) :: sexp_args
)
2964 (match sexp_args
with
2965 | [ v1 ] -> let v1 = parameterType_of_sexp
v1 in MetaParamVal
v1
2966 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2968 (Sexp.Atom
(("metaParamListVal" | "MetaParamListVal" as tag
)) ::
2971 (match sexp_args
with
2974 Conv.list_of_sexp
(wrap2_of_sexp parameterType_of_sexp
) v1
2975 in MetaParamListVal
v1
2976 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2978 (Sexp.Atom
(("metaTypeVal" | "MetaTypeVal" as tag
)) :: sexp_args
)
2980 (match sexp_args
with
2981 | [ v1 ] -> let v1 = fullType_of_sexp
v1 in MetaTypeVal
v1
2982 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2984 (Sexp.Atom
(("metaInitVal" | "MetaInitVal" as tag
)) :: sexp_args
)
2986 (match sexp_args
with
2987 | [ v1 ] -> let v1 = initialiser_of_sexp
v1 in MetaInitVal
v1
2988 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2990 (Sexp.Atom
(("metaStmtVal" | "MetaStmtVal" as tag
)) :: sexp_args
)
2992 (match sexp_args
with
2993 | [ v1 ] -> let v1 = statement_of_sexp
v1 in MetaStmtVal
v1
2994 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
2996 (Sexp.Atom
(("metaPosVal" | "MetaPosVal" as tag
)) :: sexp_args
)
2998 (match sexp_args
with
3002 | Sexp.List
([ v1; v2
]) ->
3003 let v1 = Ast_cocci.fixpos_of_sexp v1
3004 and v2
= Ast_cocci.fixpos_of_sexp v2
3006 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 2 sexp
)
3008 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
3010 (Sexp.Atom
(("metaPosValList" | "MetaPosValList" as tag
)) ::
3013 (match sexp_args
with
3018 | Sexp.List
([ v1; v2
; v3
; v4
]) ->
3019 let v1 = Common.filename_of_sexp
v1
3020 and v2
= Conv.string_of_sexp v2
3021 and v3
= posl_of_sexp v3
3022 and v4
= posl_of_sexp v4
3024 | sexp
-> Conv_error.tuple_of_size_n_expected
_loc 4 sexp
)
3026 in MetaPosValList
v1
3027 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
3029 (Sexp.Atom
(("metaListlenVal" | "MetaListlenVal" as tag
)) ::
3032 (match sexp_args
with
3033 | [ v1 ] -> let v1 = Conv.int_of_sexp
v1 in MetaListlenVal
v1
3034 | _
-> Conv_error.stag_incorrect_n_args
_loc tag sexp
)
3035 | (Sexp.Atom
("metaIdVal" | "MetaIdVal") as sexp
) ->
3036 Conv_error.stag_takes_args
_loc sexp
3037 | (Sexp.Atom
("metaFuncVal" | "MetaFuncVal") as sexp
) ->
3038 Conv_error.stag_takes_args
_loc sexp
3039 | (Sexp.Atom
("metaLocalFuncVal" | "MetaLocalFuncVal") as sexp
) ->
3040 Conv_error.stag_takes_args
_loc sexp
3041 | (Sexp.Atom
("metaExprVal" | "MetaExprVal") as sexp
) ->
3042 Conv_error.stag_takes_args
_loc sexp
3043 | (Sexp.Atom
("metaExprListVal" | "MetaExprListVal") as sexp
) ->
3044 Conv_error.stag_takes_args
_loc sexp
3045 | (Sexp.Atom
("metaParamVal" | "MetaParamVal") as sexp
) ->
3046 Conv_error.stag_takes_args
_loc sexp
3047 | (Sexp.Atom
("metaParamListVal" | "MetaParamListVal") as sexp
) ->
3048 Conv_error.stag_takes_args
_loc sexp
3049 | (Sexp.Atom
("metaTypeVal" | "MetaTypeVal") as sexp
) ->
3050 Conv_error.stag_takes_args
_loc sexp
3051 | (Sexp.Atom
("metaInitVal" | "MetaInitVal") as sexp
) ->
3052 Conv_error.stag_takes_args
_loc sexp
3053 | (Sexp.Atom
("metaStmtVal" | "MetaStmtVal") as sexp
) ->
3054 Conv_error.stag_takes_args
_loc sexp
3055 | (Sexp.Atom
("metaPosVal" | "MetaPosVal") as sexp
) ->
3056 Conv_error.stag_takes_args
_loc sexp
3057 | (Sexp.Atom
("metaPosValList" | "MetaPosValList") as sexp
) ->
3058 Conv_error.stag_takes_args
_loc sexp
3059 | (Sexp.Atom
("metaListlenVal" | "MetaListlenVal") as sexp
) ->
3060 Conv_error.stag_takes_args
_loc sexp
3061 | (Sexp.List
(Sexp.List _
:: _
) as sexp
) ->
3062 Conv_error.nested_list_invalid_sum
_loc sexp
3063 | (Sexp.List
[] as sexp
) -> Conv_error.empty_list_invalid_sum
_loc sexp
3064 | sexp
-> Conv_error.unexpected_stag
_loc sexp
3065 and metavar_binding_kind_of_sexp sexp
= metavar_binding_kind_of_sexp__ sexp
3074 cocci_tag
= v_cocci_tag
;
3075 comments_tag
= v_comments_tag
3077 if not
!show_info then Sexp.Atom
""
3080 let arg = Conv.sexp_of_ref sexp_of_comments_around v_comments_tag
in
3081 let bnd = Sexp.List
[ Sexp.Atom
"comments_tag"; arg ] in
3082 let bnds = bnd :: bnds in
3085 (Conv.sexp_of_option
3087 let v1 = Ast_cocci.sexp_of_mcodekind v1
3088 and v2
= (* sexp_of_metavars_binding v2 *) failwith
"todo"
3089 in Sexp.List
[ v1; v2
]))
3091 let bnd = Sexp.List
[ Sexp.Atom
"cocci_tag"; arg ] in
3092 let bnds = bnd :: bnds in
3093 let arg = sexp_of_parse_info v_pinfo
in
3094 let bnd = Sexp.List
[ Sexp.Atom
"pinfo"; arg ] in
3095 let bnds = bnd :: bnds in Sexp.List
bnds
3096 and sexp_of_il v
= Conv.sexp_of_list sexp_of_info v
3097 and sexp_of_wrap _of_a
(v1, v2
) =
3098 let v1 = _of_a
v1 and v2
= sexp_of_il v2
in Sexp.List
[ v1; v2
]
3099 and sexp_of_wrap2 _of_a
(v1, v2
) =
3100 let v1 = _of_a
v1 and v2
= sexp_of_il v2
in Sexp.List
[ v1; v2
]
3104 sexp_of_comments_around
{
3105 mbefore
= v_mbefore
;
3107 mbefore2
= v_mbefore2
;
3111 let arg = Conv.sexp_of_list sexp_of_comment_and_relative_pos v_mafter2
in
3112 let bnd = Sexp.List
[ Sexp.Atom
"mafter2"; arg ] in
3113 let bnds = bnd :: bnds in
3114 let arg = Conv.sexp_of_list sexp_of_comment_and_relative_pos v_mbefore2
in
3115 let bnd = Sexp.List
[ Sexp.Atom
"mbefore2"; arg ] in
3116 let bnds = bnd :: bnds in
3117 let arg = Conv.sexp_of_list
Token_c.sexp_of_comment_like_token v_mafter
in
3118 let bnd = Sexp.List
[ Sexp.Atom
"mafter"; arg ] in
3119 let bnds = bnd :: bnds in
3120 let arg = Conv.sexp_of_list
Token_c.sexp_of_comment_like_token v_mbefore
in
3121 let bnd = Sexp.List
[ Sexp.Atom
"mbefore"; arg ] in
3122 let bnds = bnd :: bnds in Sexp.List
bnds
3123 and sexp_of_comment_and_relative_pos
{ minfo
= v_minfo
; mpos
= v_mpos
} =
3125 let arg = Conv.sexp_of_int v_mpos
in
3126 let bnd = Sexp.List
[ Sexp.Atom
"mpos"; arg ] in
3127 let bnds = bnd :: bnds in
3128 let arg = Common.sexp_of_parse_info v_minfo
in
3129 let bnd = Sexp.List
[ Sexp.Atom
"minfo"; arg ] in
3130 let bnds = bnd :: bnds in Sexp.List
bnds
3131 and sexp_of_comment v
= Common.sexp_of_parse_info v
3132 and sexp_of_com v
= Conv.sexp_of_ref
(Conv.sexp_of_list sexp_of_comment
) v
3138 let rec sexp_of_name =
3141 let v1 = sexp_of_wrap
Conv.sexp_of_string
v1
3142 in Sexp.List
[ Sexp.Atom
"RegularName"; v1 ]
3143 | CppConcatenatedName
v1 ->
3145 Conv.sexp_of_list
(sexp_of_wrap2
(sexp_of_wrap
Conv.sexp_of_string
))
3147 in Sexp.List
[ Sexp.Atom
"CppConcatenatedName"; v1 ]
3148 | CppVariadicName
v1 ->
3149 let v1 = sexp_of_wrap
Conv.sexp_of_string
v1
3150 in Sexp.List
[ Sexp.Atom
"CppVariadicName"; v1 ]
3151 | CppIdentBuilder
((v1, v2
)) ->
3152 let v1 = sexp_of_wrap
Conv.sexp_of_string
v1
3154 Conv.sexp_of_list
(sexp_of_wrap2
(sexp_of_wrap
Conv.sexp_of_string
))
3156 in Sexp.List
[ Sexp.Atom
"CppIdentBuilder"; v1; v2
]
3157 and sexp_of_fullType
(v1, v2
) =
3158 let v1 = sexp_of_typeQualifier
v1
3159 and v2
= sexp_of_typeC v2
3160 in Sexp.List
[ v1; v2
]
3161 and sexp_of_typeC v
= sexp_of_wrap sexp_of_typeCbis v
3162 and sexp_of_typeCbis
=
3165 let v1 = sexp_of_baseType
v1 in Sexp.List
[ Sexp.Atom
"BaseType"; v1 ]
3167 let v1 = sexp_of_fullType
v1 in Sexp.List
[ Sexp.Atom
"Pointer"; v1 ]
3168 | Array
((v1, v2
)) ->
3169 let v1 = Conv.sexp_of_option sexp_of_constExpression
v1
3170 and v2
= sexp_of_fullType v2
3171 in Sexp.List
[ Sexp.Atom
"Array"; v1; v2
]
3172 | FunctionType
v1 ->
3173 let v1 = sexp_of_functionType
v1
3174 in Sexp.List
[ Sexp.Atom
"FunctionType"; v1 ]
3175 | Enum
((v1, v2
)) ->
3176 let v1 = Conv.sexp_of_option
Conv.sexp_of_string
v1
3177 and v2
= sexp_of_enumType v2
3178 in Sexp.List
[ Sexp.Atom
"Enum"; v1; v2
]
3179 | StructUnion
((v1, v2
, v3
)) ->
3180 let v1 = sexp_of_structUnion
v1
3181 and v2
= Conv.sexp_of_option
Conv.sexp_of_string v2
3182 and v3
= sexp_of_structType v3
3183 in Sexp.List
[ Sexp.Atom
"StructUnion"; v1; v2
; v3
]
3185 let v1 = Conv.sexp_of_string
v1
3186 in Sexp.List
[ Sexp.Atom
"EnumName"; v1 ]
3187 | StructUnionName
((v1, v2
)) ->
3188 let v1 = sexp_of_structUnion
v1
3189 and v2
= Conv.sexp_of_string v2
3190 in Sexp.List
[ Sexp.Atom
"StructUnionName"; v1; v2
]
3191 | TypeName
((v1, v2
)) ->
3192 let v1 = sexp_of_name v1
3193 and v2
= Conv.sexp_of_option sexp_of_fullType v2
3194 in Sexp.List
[ Sexp.Atom
"TypeName"; v1; v2
]
3196 let v1 = sexp_of_fullType
v1 in Sexp.List
[ Sexp.Atom
"ParenType"; v1 ]
3198 let v1 = sexp_of_expression
v1
3199 in Sexp.List
[ Sexp.Atom
"TypeOfExpr"; v1 ]
3201 let v1 = sexp_of_fullType
v1
3202 in Sexp.List
[ Sexp.Atom
"TypeOfType"; v1 ]
3203 and sexp_of_baseType
=
3205 | Void
-> Sexp.Atom
"Void"
3207 let v1 = sexp_of_intType
v1 in Sexp.List
[ Sexp.Atom
"IntType"; v1 ]
3209 let v1 = sexp_of_floatType
v1
3210 in Sexp.List
[ Sexp.Atom
"FloatType"; v1 ]
3211 and sexp_of_intType
=
3213 | CChar
-> Sexp.Atom
"CChar"
3214 | Si
v1 -> let v1 = sexp_of_signed
v1 in Sexp.List
[ Sexp.Atom
"Si"; v1 ]
3215 and sexp_of_signed
(v1, v2
) =
3216 let v1 = sexp_of_sign
v1 and v2
= sexp_of_base v2
in Sexp.List
[ v1; v2
]
3219 | CChar2
-> Sexp.Atom
"CChar2"
3220 | CShort
-> Sexp.Atom
"CShort"
3221 | CInt
-> Sexp.Atom
"CInt"
3222 | CLong
-> Sexp.Atom
"CLong"
3223 | CLongLong
-> Sexp.Atom
"CLongLong"
3225 function | Signed
-> Sexp.Atom
"Signed" | UnSigned
-> Sexp.Atom
"UnSigned"
3226 and sexp_of_floatType
=
3228 | CFloat
-> Sexp.Atom
"CFloat"
3229 | CDouble
-> Sexp.Atom
"CDouble"
3230 | CLongDouble
-> Sexp.Atom
"CLongDouble"
3231 and sexp_of_structUnion
=
3232 function | Struct
-> Sexp.Atom
"Struct" | Union
-> Sexp.Atom
"Union"
3233 and sexp_of_structType v
= Conv.sexp_of_list sexp_of_field v
3236 | DeclarationField
v1 ->
3237 let v1 = sexp_of_field_declaration
v1
3238 in Sexp.List
[ Sexp.Atom
"DeclarationField"; v1 ]
3240 let v1 = sexp_of_info
v1 in Sexp.List
[ Sexp.Atom
"EmptyField"; v1 ]
3241 | MacroDeclField
v1 ->
3245 let v1 = Conv.sexp_of_string
v1
3246 and v2
= Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_argument
) v2
3247 in Sexp.List
[ v1; v2
])
3249 in Sexp.List
[ Sexp.Atom
"MacroDeclField"; v1 ]
3250 | CppDirectiveStruct
v1 ->
3251 let v1 = sexp_of_cpp_directive
v1
3252 in Sexp.List
[ Sexp.Atom
"CppDirectiveStruct"; v1 ]
3254 let v1 = sexp_of_ifdef_directive
v1
3255 in Sexp.List
[ Sexp.Atom
"IfdefStruct"; v1 ]
3256 and sexp_of_field_declaration
=
3258 | FieldDeclList
v1 ->
3260 sexp_of_wrap
(Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_fieldkind
)) v1
3261 in Sexp.List
[ Sexp.Atom
"FieldDeclList"; v1 ]
3262 and sexp_of_fieldkind
=
3264 | Simple
((v1, v2
)) ->
3265 let v1 = Conv.sexp_of_option
sexp_of_name v1
3266 and v2
= sexp_of_fullType v2
3267 in Sexp.List
[ Sexp.Atom
"Simple"; v1; v2
]
3268 | BitField
((v1, v2
, v3
, v4
)) ->
3269 let v1 = Conv.sexp_of_option
sexp_of_name v1
3270 and v2
= sexp_of_fullType v2
3271 and v3
= sexp_of_info v3
3272 and v4
= sexp_of_constExpression v4
3273 in Sexp.List
[ Sexp.Atom
"BitField"; v1; v2
; v3
; v4
]
3274 and sexp_of_enumType v
=
3278 let v1 = sexp_of_name v1
3282 let v1 = sexp_of_info
v1
3283 and v2
= sexp_of_constExpression v2
3284 in Sexp.List
[ v1; v2
])
3286 in Sexp.List
[ v1; v2
]))
3288 and sexp_of_functionType
(v1, v2
) =
3289 let v1 = sexp_of_fullType
v1
3293 let v1 = Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_parameterType
) v1
3294 and v2
= sexp_of_wrap
Conv.sexp_of_bool v2
3295 in Sexp.List
[ v1; v2
]
3296 in Sexp.List
[ v1; v2
]
3298 sexp_of_parameterType
{
3299 p_namei
= v_p_namei
;
3300 p_register
= v_p_register
;
3304 let arg = sexp_of_fullType v_p_type
in
3305 let bnd = Sexp.List
[ Sexp.Atom
"p_type"; arg ] in
3306 let bnds = bnd :: bnds in
3307 let arg = sexp_of_wrap
Conv.sexp_of_bool v_p_register
in
3308 let bnd = Sexp.List
[ Sexp.Atom
"p_register"; arg ] in
3309 let bnds = bnd :: bnds in
3310 let arg = Conv.sexp_of_option
sexp_of_name v_p_namei
in
3311 let bnd = Sexp.List
[ Sexp.Atom
"p_namei"; arg ] in
3312 let bnds = bnd :: bnds in Sexp.List
bnds
3313 and sexp_of_typeQualifier v
= sexp_of_wrap sexp_of_typeQualifierbis v
3314 and sexp_of_typeQualifierbis
{ const
= v_const
; volatile
= v_volatile
} =
3315 if not
!show_qualifier then Sexp.Atom
""
3318 let arg = Conv.sexp_of_bool v_volatile
in
3319 let bnd = Sexp.List
[ Sexp.Atom
"volatile"; arg ] in
3320 let bnds = bnd :: bnds in
3321 let arg = Conv.sexp_of_bool v_const
in
3322 let bnd = Sexp.List
[ Sexp.Atom
"const"; arg ] in
3323 let bnds = bnd :: bnds in Sexp.List
bnds
3324 and sexp_of_attribute v
= sexp_of_wrap sexp_of_attributebis v
3325 and sexp_of_attributebis
=
3328 let v1 = Conv.sexp_of_string
v1
3329 in Sexp.List
[ Sexp.Atom
"Attribute"; v1 ]
3330 and sexp_of_expression v
=
3333 let v1 = sexp_of_expressionbis
v1
3335 if not
!show_expr_info then Sexp.Atom
""
3336 else Conv.sexp_of_ref sexp_of_exp_info v2
3337 in Sexp.List
[ v1; v2
])
3339 and sexp_of_exp_info
(v1, v2
) =
3340 let v1 = Conv.sexp_of_option sexp_of_exp_type
v1
3341 and v2
= sexp_of_test v2
3342 in Sexp.List
[ v1; v2
]
3343 and sexp_of_exp_type
(v1, v2
) =
3344 let v1 = sexp_of_fullType
v1
3345 and v2
= sexp_of_local v2
3346 in Sexp.List
[ v1; v2
]
3350 let v1 = sexp_of_parse_info v1
3351 in Sexp.List
[ Sexp.Atom
"LocalVar"; v1 ]
3352 | NotLocalVar
-> Sexp.Atom
"NotLocalVar"
3354 function | Test
-> Sexp.Atom
"Test" | NotTest
-> Sexp.Atom
"NotTest"
3355 and sexp_of_expressionbis
=
3358 let v1 = sexp_of_name v1 in Sexp.List
[ Sexp.Atom
"Ident"; v1 ]
3360 let v1 = sexp_of_constant
v1 in Sexp.List
[ Sexp.Atom
"Constant"; v1 ]
3361 | FunCall
((v1, v2
)) ->
3362 let v1 = sexp_of_expression
v1
3363 and v2
= Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_argument
) v2
3364 in Sexp.List
[ Sexp.Atom
"FunCall"; v1; v2
]
3365 | CondExpr
((v1, v2
, v3
)) ->
3366 let v1 = sexp_of_expression
v1
3367 and v2
= Conv.sexp_of_option sexp_of_expression v2
3368 and v3
= sexp_of_expression v3
3369 in Sexp.List
[ Sexp.Atom
"CondExpr"; v1; v2
; v3
]
3370 | Sequence
((v1, v2
)) ->
3371 let v1 = sexp_of_expression
v1
3372 and v2
= sexp_of_expression v2
3373 in Sexp.List
[ Sexp.Atom
"Sequence"; v1; v2
]
3374 | Assignment
((v1, v2
, v3
)) ->
3375 let v1 = sexp_of_expression
v1
3376 and v2
= sexp_of_assignOp v2
3377 and v3
= sexp_of_expression v3
3378 in Sexp.List
[ Sexp.Atom
"Assignment"; v1; v2
; v3
]
3379 | Postfix
((v1, v2
)) ->
3380 let v1 = sexp_of_expression
v1
3381 and v2
= sexp_of_fixOp v2
3382 in Sexp.List
[ Sexp.Atom
"Postfix"; v1; v2
]
3383 | Infix
((v1, v2
)) ->
3384 let v1 = sexp_of_expression
v1
3385 and v2
= sexp_of_fixOp v2
3386 in Sexp.List
[ Sexp.Atom
"Infix"; v1; v2
]
3387 | Unary
((v1, v2
)) ->
3388 let v1 = sexp_of_expression
v1
3389 and v2
= sexp_of_unaryOp v2
3390 in Sexp.List
[ Sexp.Atom
"Unary"; v1; v2
]
3391 | Binary
((v1, v2
, v3
)) ->
3392 let v1 = sexp_of_expression
v1
3393 and v2
= sexp_of_binaryOp v2
3394 and v3
= sexp_of_expression v3
3395 in Sexp.List
[ Sexp.Atom
"Binary"; v1; v2
; v3
]
3396 | ArrayAccess
((v1, v2
)) ->
3397 let v1 = sexp_of_expression
v1
3398 and v2
= sexp_of_expression v2
3399 in Sexp.List
[ Sexp.Atom
"ArrayAccess"; v1; v2
]
3400 | RecordAccess
((v1, v2
)) ->
3401 let v1 = sexp_of_expression
v1
3402 and v2
= sexp_of_name v2
3403 in Sexp.List
[ Sexp.Atom
"RecordAccess"; v1; v2
]
3404 | RecordPtAccess
((v1, v2
)) ->
3405 let v1 = sexp_of_expression
v1
3406 and v2
= sexp_of_name v2
3407 in Sexp.List
[ Sexp.Atom
"RecordPtAccess"; v1; v2
]
3409 let v1 = sexp_of_expression
v1
3410 in Sexp.List
[ Sexp.Atom
"SizeOfExpr"; v1 ]
3412 let v1 = sexp_of_fullType
v1
3413 in Sexp.List
[ Sexp.Atom
"SizeOfType"; v1 ]
3414 | Cast
((v1, v2
)) ->
3415 let v1 = sexp_of_fullType
v1
3416 and v2
= sexp_of_expression v2
3417 in Sexp.List
[ Sexp.Atom
"Cast"; v1; v2
]
3418 | StatementExpr
v1 ->
3419 let v1 = sexp_of_wrap sexp_of_compound
v1
3420 in Sexp.List
[ Sexp.Atom
"StatementExpr"; v1 ]
3421 | Constructor
((v1, v2
)) ->
3422 let v1 = sexp_of_fullType
v1
3423 and v2
= Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_initialiser
) v2
3424 in Sexp.List
[ Sexp.Atom
"Constructor"; v1; v2
]
3426 let v1 = sexp_of_expression
v1
3427 in Sexp.List
[ Sexp.Atom
"ParenExpr"; v1 ]
3428 and sexp_of_argument v
=
3429 Common.sexp_of_either sexp_of_expression sexp_of_weird_argument v
3430 and sexp_of_weird_argument
=
3433 let v1 = sexp_of_parameterType
v1
3434 in Sexp.List
[ Sexp.Atom
"ArgType"; v1 ]
3436 let v1 = sexp_of_action_macro
v1
3437 in Sexp.List
[ Sexp.Atom
"ArgAction"; v1 ]
3438 and sexp_of_action_macro
=
3441 let v1 = sexp_of_il
v1 in Sexp.List
[ Sexp.Atom
"ActMisc"; v1 ]
3442 and sexp_of_constant
=
3448 let v1 = Conv.sexp_of_string
v1
3449 and v2
= sexp_of_isWchar v2
3450 in Sexp.List
[ v1; v2
])
3451 in Sexp.List
[ Sexp.Atom
"String"; v1 ]
3453 let v1 = Conv.sexp_of_list
Conv.sexp_of_string
v1
3454 in Sexp.List
[ Sexp.Atom
"MultiString"; v1 ]
3459 let v1 = Conv.sexp_of_string
v1
3460 and v2
= sexp_of_isWchar v2
3461 in Sexp.List
[ v1; v2
])
3462 in Sexp.List
[ Sexp.Atom
"Char"; v1 ]
3463 | Int
(v1, _todo
) ->
3464 let v1 = Conv.sexp_of_string
v1 in Sexp.List
[ Sexp.Atom
"Int"; v1 ]
3469 let v1 = Conv.sexp_of_string
v1
3470 and v2
= sexp_of_floatType v2
3471 in Sexp.List
[ v1; v2
])
3472 in Sexp.List
[ Sexp.Atom
"Float"; v1 ]
3473 and sexp_of_isWchar
=
3474 function | IsWchar
-> Sexp.Atom
"IsWchar" | IsChar
-> Sexp.Atom
"IsChar"
3475 and sexp_of_unaryOp
=
3477 | GetRef
-> Sexp.Atom
"GetRef"
3478 | DeRef
-> Sexp.Atom
"DeRef"
3479 | UnPlus
-> Sexp.Atom
"UnPlus"
3480 | UnMinus
-> Sexp.Atom
"UnMinus"
3481 | Tilde
-> Sexp.Atom
"Tilde"
3482 | Not
-> Sexp.Atom
"Not"
3483 | GetRefLabel
-> Sexp.Atom
"GetRefLabel"
3484 and sexp_of_assignOp
=
3486 | SimpleAssign
-> Sexp.Atom
"SimpleAssign"
3488 let v1 = sexp_of_arithOp
v1 in Sexp.List
[ Sexp.Atom
"OpAssign"; v1 ]
3490 function | Dec
-> Sexp.Atom
"Dec" | Inc
-> Sexp.Atom
"Inc"
3491 and sexp_of_binaryOp
=
3494 let v1 = sexp_of_arithOp
v1 in Sexp.List
[ Sexp.Atom
"Arith"; v1 ]
3496 let v1 = sexp_of_logicalOp
v1 in Sexp.List
[ Sexp.Atom
"Logical"; v1 ]
3497 and sexp_of_arithOp
=
3499 | Plus
-> Sexp.Atom
"Plus"
3500 | Minus
-> Sexp.Atom
"Minus"
3501 | Mul
-> Sexp.Atom
"Mul"
3502 | Div
-> Sexp.Atom
"Div"
3503 | Mod
-> Sexp.Atom
"Mod"
3504 | DecLeft
-> Sexp.Atom
"DecLeft"
3505 | DecRight
-> Sexp.Atom
"DecRight"
3506 | And
-> Sexp.Atom
"And"
3507 | Or
-> Sexp.Atom
"Or"
3508 | Xor
-> Sexp.Atom
"Xor"
3509 and sexp_of_logicalOp
=
3511 | Inf
-> Sexp.Atom
"Inf"
3512 | Sup
-> Sexp.Atom
"Sup"
3513 | InfEq
-> Sexp.Atom
"InfEq"
3514 | SupEq
-> Sexp.Atom
"SupEq"
3515 | Eq
-> Sexp.Atom
"Eq"
3516 | NotEq
-> Sexp.Atom
"NotEq"
3517 | AndLog
-> Sexp.Atom
"AndLog"
3518 | OrLog
-> Sexp.Atom
"OrLog"
3519 and sexp_of_constExpression v
= sexp_of_expression v
3520 and sexp_of_statement v
= sexp_of_wrap sexp_of_statementbis v
3521 and sexp_of_statementbis
=
3524 let v1 = sexp_of_labeled
v1 in Sexp.List
[ Sexp.Atom
"Labeled"; v1 ]
3526 let v1 = sexp_of_compound
v1 in Sexp.List
[ Sexp.Atom
"Compound"; v1 ]
3527 | ExprStatement
v1 ->
3528 let v1 = sexp_of_exprStatement
v1
3529 in Sexp.List
[ Sexp.Atom
"ExprStatement"; v1 ]
3531 let v1 = sexp_of_selection
v1
3532 in Sexp.List
[ Sexp.Atom
"Selection"; v1 ]
3534 let v1 = sexp_of_iteration
v1
3535 in Sexp.List
[ Sexp.Atom
"Iteration"; v1 ]
3536 | Jump
v1 -> let v1 = sexp_of_jump
v1 in Sexp.List
[ Sexp.Atom
"Jump"; v1 ]
3538 let v1 = sexp_of_declaration
v1 in Sexp.List
[ Sexp.Atom
"Decl"; v1 ]
3540 let v1 = sexp_of_asmbody
v1 in Sexp.List
[ Sexp.Atom
"Asm"; v1 ]
3542 let v1 = sexp_of_definition
v1
3543 in Sexp.List
[ Sexp.Atom
"NestedFunc"; v1 ]
3544 | MacroStmt
-> Sexp.Atom
"MacroStmt"
3545 and sexp_of_labeled
=
3547 | Label
((v1, v2
)) ->
3548 let v1 = sexp_of_name v1
3549 and v2
= sexp_of_statement v2
3550 in Sexp.List
[ Sexp.Atom
"Label"; v1; v2
]
3551 | Case
((v1, v2
)) ->
3552 let v1 = sexp_of_expression
v1
3553 and v2
= sexp_of_statement v2
3554 in Sexp.List
[ Sexp.Atom
"Case"; v1; v2
]
3555 | CaseRange
((v1, v2
, v3
)) ->
3556 let v1 = sexp_of_expression
v1
3557 and v2
= sexp_of_expression v2
3558 and v3
= sexp_of_statement v3
3559 in Sexp.List
[ Sexp.Atom
"CaseRange"; v1; v2
; v3
]
3561 let v1 = sexp_of_statement
v1 in Sexp.List
[ Sexp.Atom
"Default"; v1 ]
3562 and sexp_of_compound v
= Conv.sexp_of_list sexp_of_statement_sequencable v
3563 and sexp_of_statement_sequencable
=
3566 let v1 = sexp_of_statement
v1 in Sexp.List
[ Sexp.Atom
"StmtElem"; v1 ]
3567 | CppDirectiveStmt
v1 ->
3568 let v1 = sexp_of_cpp_directive
v1
3569 in Sexp.List
[ Sexp.Atom
"CppDirectiveStmt"; v1 ]
3571 let v1 = sexp_of_ifdef_directive
v1
3572 in Sexp.List
[ Sexp.Atom
"IfdefStmt"; v1 ]
3573 | IfdefStmt2
((v1, v2
)) ->
3574 let v1 = Conv.sexp_of_list sexp_of_ifdef_directive
v1
3576 Conv.sexp_of_list
(Conv.sexp_of_list sexp_of_statement_sequencable
)
3578 in Sexp.List
[ Sexp.Atom
"IfdefStmt2"; v1; v2
]
3579 and sexp_of_exprStatement v
= Conv.sexp_of_option sexp_of_expression v
3580 and sexp_of_selection
=
3582 | If
((v1, v2
, v3
)) ->
3583 let v1 = sexp_of_expression
v1
3584 and v2
= sexp_of_statement v2
3585 and v3
= sexp_of_statement v3
3586 in Sexp.List
[ Sexp.Atom
"If"; v1; v2
; v3
]
3587 | Switch
((v1, v2
)) ->
3588 let v1 = sexp_of_expression
v1
3589 and v2
= sexp_of_statement v2
3590 in Sexp.List
[ Sexp.Atom
"Switch"; v1; v2
]
3591 and sexp_of_iteration
=
3593 | While
((v1, v2
)) ->
3594 let v1 = sexp_of_expression
v1
3595 and v2
= sexp_of_statement v2
3596 in Sexp.List
[ Sexp.Atom
"While"; v1; v2
]
3597 | DoWhile
((v1, v2
)) ->
3598 let v1 = sexp_of_statement
v1
3599 and v2
= sexp_of_expression v2
3600 in Sexp.List
[ Sexp.Atom
"DoWhile"; v1; v2
]
3601 | For
((v1, v2
, v3
, v4
)) ->
3602 let v1 = sexp_of_wrap sexp_of_exprStatement
v1
3603 and v2
= sexp_of_wrap sexp_of_exprStatement v2
3604 and v3
= sexp_of_wrap sexp_of_exprStatement v3
3605 and v4
= sexp_of_statement v4
3606 in Sexp.List
[ Sexp.Atom
"For"; v1; v2
; v3
; v4
]
3607 | MacroIteration
((v1, v2
, v3
)) ->
3608 let v1 = Conv.sexp_of_string
v1
3609 and v2
= Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_argument
) v2
3610 and v3
= sexp_of_statement v3
3611 in Sexp.List
[ Sexp.Atom
"MacroIteration"; v1; v2
; v3
]
3614 | Goto
v1 -> let v1 = sexp_of_name v1 in Sexp.List
[ Sexp.Atom
"Goto"; v1 ]
3615 | Continue
-> Sexp.Atom
"Continue"
3616 | Break
-> Sexp.Atom
"Break"
3617 | Return
-> Sexp.Atom
"Return"
3619 let v1 = sexp_of_expression
v1
3620 in Sexp.List
[ Sexp.Atom
"ReturnExpr"; v1 ]
3621 | GotoComputed
v1 ->
3622 let v1 = sexp_of_expression
v1
3623 in Sexp.List
[ Sexp.Atom
"GotoComputed"; v1 ]
3624 and sexp_of_asmbody
(v1, v2
) =
3625 let v1 = sexp_of_il
v1
3626 and v2
= Conv.sexp_of_list
(sexp_of_wrap sexp_of_colon
) v2
3627 in Sexp.List
[ v1; v2
]
3631 let v1 = Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_colon_option
) v1
3632 in Sexp.List
[ Sexp.Atom
"Colon"; v1 ]
3633 and sexp_of_colon_option v
= sexp_of_wrap sexp_of_colon_option_bis v
3634 and sexp_of_colon_option_bis
=
3636 | ColonMisc
-> Sexp.Atom
"ColonMisc"
3638 let v1 = sexp_of_expression
v1
3639 in Sexp.List
[ Sexp.Atom
"ColonExpr"; v1 ]
3640 and sexp_of_declaration
=
3644 sexp_of_wrap
(Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_onedecl
)) v1
3645 in Sexp.List
[ Sexp.Atom
"DeclList"; v1 ]
3650 let v1 = Conv.sexp_of_string
v1
3651 and v2
= Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_argument
) v2
3652 in Sexp.List
[ v1; v2
])
3654 in Sexp.List
[ Sexp.Atom
"MacroDecl"; v1 ]
3657 v_namei
= v_v_namei
;
3659 v_type_bis
= v_v_type_bis
;
3660 v_storage
= v_v_storage
;
3661 v_local
= v_v_local
;
3665 let arg = Conv.sexp_of_list sexp_of_attribute v_v_attr
in
3666 let bnd = Sexp.List
[ Sexp.Atom
"v_attr"; arg ] in
3667 let bnds = bnd :: bnds in
3668 let arg = sexp_of_local_decl v_v_local
in
3669 let bnd = Sexp.List
[ Sexp.Atom
"v_local"; arg ] in
3670 let bnds = bnd :: bnds in
3671 let arg = sexp_of_storage v_v_storage
in
3672 let bnd = Sexp.List
[ Sexp.Atom
"v_storage"; arg ] in
3673 let bnds = bnd :: bnds in
3675 Conv.sexp_of_ref
(Conv.sexp_of_option sexp_of_fullType
) v_v_type_bis
in
3676 let bnd = Sexp.List
[ Sexp.Atom
"v_type_bis"; arg ] in
3677 let bnds = bnd :: bnds in
3678 let arg = sexp_of_fullType v_v_type
in
3679 let bnd = Sexp.List
[ Sexp.Atom
"v_type"; arg ] in
3680 let bnds = bnd :: bnds in
3684 let v1 = sexp_of_name v1
3688 let v1 = sexp_of_info
v1
3689 and v2
= sexp_of_initialiser v2
3690 in Sexp.List
[ v1; v2
])
3692 in Sexp.List
[ v1; v2
])
3694 let bnd = Sexp.List
[ Sexp.Atom
"v_namei"; arg ] in
3695 let bnds = bnd :: bnds in Sexp.List
bnds
3696 and sexp_of_storage
(v1, v2
) =
3697 let v1 = sexp_of_storagebis
v1
3698 and v2
= Conv.sexp_of_bool v2
3699 in Sexp.List
[ v1; v2
]
3700 and sexp_of_storagebis
=
3702 | NoSto
-> Sexp.Atom
"NoSto"
3703 | StoTypedef
-> Sexp.Atom
"StoTypedef"
3705 let v1 = sexp_of_storageClass
v1 in Sexp.List
[ Sexp.Atom
"Sto"; v1 ]
3706 and sexp_of_storageClass
=
3708 | Auto
-> Sexp.Atom
"Auto"
3709 | Static
-> Sexp.Atom
"Static"
3710 | Register
-> Sexp.Atom
"Register"
3711 | Extern
-> Sexp.Atom
"Extern"
3712 and sexp_of_local_decl
=
3714 | LocalDecl
-> Sexp.Atom
"LocalDecl"
3715 | NotLocalDecl
-> Sexp.Atom
"NotLocalDecl"
3716 and sexp_of_initialiser v
= sexp_of_wrap sexp_of_initialiserbis v
3717 and sexp_of_initialiserbis
=
3720 let v1 = sexp_of_expression
v1
3721 in Sexp.List
[ Sexp.Atom
"InitExpr"; v1 ]
3723 let v1 = Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_initialiser
) v1
3724 in Sexp.List
[ Sexp.Atom
"InitList"; v1 ]
3725 | InitDesignators
((v1, v2
)) ->
3726 let v1 = Conv.sexp_of_list sexp_of_designator
v1
3727 and v2
= sexp_of_initialiser v2
3728 in Sexp.List
[ Sexp.Atom
"InitDesignators"; v1; v2
]
3729 | InitFieldOld
((v1, v2
)) ->
3730 let v1 = Conv.sexp_of_string
v1
3731 and v2
= sexp_of_initialiser v2
3732 in Sexp.List
[ Sexp.Atom
"InitFieldOld"; v1; v2
]
3733 | InitIndexOld
((v1, v2
)) ->
3734 let v1 = sexp_of_expression
v1
3735 and v2
= sexp_of_initialiser v2
3736 in Sexp.List
[ Sexp.Atom
"InitIndexOld"; v1; v2
]
3737 and sexp_of_designator v
= sexp_of_wrap sexp_of_designatorbis v
3738 and sexp_of_designatorbis
=
3740 | DesignatorField
v1 ->
3741 let v1 = Conv.sexp_of_string
v1
3742 in Sexp.List
[ Sexp.Atom
"DesignatorField"; v1 ]
3743 | DesignatorIndex
v1 ->
3744 let v1 = sexp_of_expression
v1
3745 in Sexp.List
[ Sexp.Atom
"DesignatorIndex"; v1 ]
3746 | DesignatorRange
((v1, v2
)) ->
3747 let v1 = sexp_of_expression
v1
3748 and v2
= sexp_of_expression v2
3749 in Sexp.List
[ Sexp.Atom
"DesignatorRange"; v1; v2
]
3750 and sexp_of_definition v
= sexp_of_wrap sexp_of_definitionbis v
3752 sexp_of_definitionbis
{
3755 f_storage
= v_f_storage
;
3758 f_old_c_style
= v_f_old_c_style
3762 Conv.sexp_of_option
(Conv.sexp_of_list sexp_of_declaration
)
3764 let bnd = Sexp.List
[ Sexp.Atom
"f_old_c_style"; arg ] in
3765 let bnds = bnd :: bnds in
3766 let arg = Conv.sexp_of_list sexp_of_attribute v_f_attr
in
3767 let bnd = Sexp.List
[ Sexp.Atom
"f_attr"; arg ] in
3768 let bnds = bnd :: bnds in
3769 let arg = sexp_of_compound v_f_body
in
3770 let bnd = Sexp.List
[ Sexp.Atom
"f_body"; arg ] in
3771 let bnds = bnd :: bnds in
3772 let arg = sexp_of_storage v_f_storage
in
3773 let bnd = Sexp.List
[ Sexp.Atom
"f_storage"; arg ] in
3774 let bnds = bnd :: bnds in
3775 let arg = sexp_of_functionType v_f_type
in
3776 let bnd = Sexp.List
[ Sexp.Atom
"f_type"; arg ] in
3777 let bnds = bnd :: bnds in
3778 let arg = sexp_of_name v_f_name
in
3779 let bnd = Sexp.List
[ Sexp.Atom
"f_name"; arg ] in
3780 let bnds = bnd :: bnds in Sexp.List
bnds
3781 and sexp_of_cpp_directive
=
3784 let v1 = sexp_of_define
v1 in Sexp.List
[ Sexp.Atom
"Define"; v1 ]
3786 let v1 = sexp_of_includ
v1 in Sexp.List
[ Sexp.Atom
"Include"; v1 ]
3788 let v1 = sexp_of_wrap
Conv.sexp_of_string
v1
3789 in Sexp.List
[ Sexp.Atom
"Undef"; v1 ]
3791 let v1 = sexp_of_il
v1 in Sexp.List
[ Sexp.Atom
"PragmaAndCo"; v1 ]
3792 and sexp_of_define
(v1, v2
) =
3793 let v1 = sexp_of_wrap
Conv.sexp_of_string
v1
3797 let v1 = sexp_of_define_kind
v1
3798 and v2
= sexp_of_define_val v2
3799 in Sexp.List
[ v1; v2
]
3800 in Sexp.List
[ v1; v2
]
3801 and sexp_of_define_kind
=
3803 | DefineVar
-> Sexp.Atom
"DefineVar"
3808 (sexp_of_wrap2
(sexp_of_wrap
Conv.sexp_of_string
)))
3810 in Sexp.List
[ Sexp.Atom
"DefineFunc"; v1 ]
3811 and sexp_of_define_val
=
3814 let v1 = sexp_of_expression
v1
3815 in Sexp.List
[ Sexp.Atom
"DefineExpr"; v1 ]
3817 let v1 = sexp_of_statement
v1
3818 in Sexp.List
[ Sexp.Atom
"DefineStmt"; v1 ]
3820 let v1 = sexp_of_fullType
v1
3821 in Sexp.List
[ Sexp.Atom
"DefineType"; v1 ]
3822 | DefineDoWhileZero
v1 ->
3826 let v1 = sexp_of_statement
v1
3827 and v2
= sexp_of_expression v2
3828 in Sexp.List
[ v1; v2
])
3830 in Sexp.List
[ Sexp.Atom
"DefineDoWhileZero"; v1 ]
3831 | DefineFunction
v1 ->
3832 let v1 = sexp_of_definition
v1
3833 in Sexp.List
[ Sexp.Atom
"DefineFunction"; v1 ]
3835 let v1 = sexp_of_initialiser
v1
3836 in Sexp.List
[ Sexp.Atom
"DefineInit"; v1 ]
3838 let v1 = sexp_of_wrap
Conv.sexp_of_string
v1
3839 in Sexp.List
[ Sexp.Atom
"DefineText"; v1 ]
3840 | DefineEmpty
-> Sexp.Atom
"DefineEmpty"
3841 | DefineTodo
-> Sexp.Atom
"DefineTodo"
3844 i_include
= v_i_include
;
3845 i_rel_pos
= v_i_rel_pos
;
3846 i_is_in_ifdef
= v_i_is_in_ifdef
;
3847 i_content
= v_i_content
3853 let v1 = Common.sexp_of_filename
v1
3854 and v2
= sexp_of_program v2
3855 in Sexp.List
[ v1; v2
])
3857 let bnd = Sexp.List
[ Sexp.Atom
"i_content"; arg ] in
3858 let bnds = bnd :: bnds in
3859 let arg = Conv.sexp_of_bool v_i_is_in_ifdef
in
3860 let bnd = Sexp.List
[ Sexp.Atom
"i_is_in_ifdef"; arg ] in
3861 let bnds = bnd :: bnds in
3863 Conv.sexp_of_ref
(Conv.sexp_of_option sexp_of_include_rel_pos
)
3865 let bnd = Sexp.List
[ Sexp.Atom
"i_rel_pos"; arg ] in
3866 let bnds = bnd :: bnds in
3867 let arg = sexp_of_wrap sexp_of_inc_file v_i_include
in
3868 let bnd = Sexp.List
[ Sexp.Atom
"i_include"; arg ] in
3869 let bnds = bnd :: bnds in Sexp.List
bnds
3870 and sexp_of_inc_file
=
3873 let v1 = Conv.sexp_of_list sexp_of_inc_elem
v1
3874 in Sexp.List
[ Sexp.Atom
"Local"; v1 ]
3876 let v1 = Conv.sexp_of_list sexp_of_inc_elem
v1
3877 in Sexp.List
[ Sexp.Atom
"NonLocal"; v1 ]
3879 let v1 = Conv.sexp_of_string
v1 in Sexp.List
[ Sexp.Atom
"Weird"; v1 ]
3880 and sexp_of_inc_elem v
= Conv.sexp_of_string v
3881 and sexp_of_include_rel_pos
{ first_of
= v_first_of
; last_of
= v_last_of
} =
3884 Conv.sexp_of_list
(Conv.sexp_of_list
Conv.sexp_of_string
) v_last_of
in
3885 let bnd = Sexp.List
[ Sexp.Atom
"last_of"; arg ] in
3886 let bnds = bnd :: bnds in
3888 Conv.sexp_of_list
(Conv.sexp_of_list
Conv.sexp_of_string
) v_first_of
in
3889 let bnd = Sexp.List
[ Sexp.Atom
"first_of"; arg ] in
3890 let bnds = bnd :: bnds in Sexp.List
bnds
3891 and sexp_of_ifdef_directive
=
3893 | IfdefDirective
v1 ->
3897 let v1 = sexp_of_ifdefkind
v1
3898 and v2
= sexp_of_matching_tag v2
3899 in Sexp.List
[ v1; v2
])
3901 in Sexp.List
[ Sexp.Atom
"IfdefDirective"; v1 ]
3902 and sexp_of_ifdefkind
=
3904 | Ifdef
-> Sexp.Atom
"Ifdef"
3905 | IfdefElseif
-> Sexp.Atom
"IfdefElseif"
3906 | IfdefElse
-> Sexp.Atom
"IfdefElse"
3907 | IfdefEndif
-> Sexp.Atom
"IfdefEndif"
3908 and sexp_of_matching_tag
=
3914 let v1 = Conv.sexp_of_int
v1
3915 and v2
= Conv.sexp_of_int v2
3916 in Sexp.List
[ v1; v2
])
3917 in Sexp.List
[ Sexp.Atom
"IfdefTag"; v1 ]
3918 and sexp_of_toplevel
=
3921 let v1 = sexp_of_declaration
v1
3922 in Sexp.List
[ Sexp.Atom
"Declaration"; v1 ]
3924 let v1 = sexp_of_definition
v1
3925 in Sexp.List
[ Sexp.Atom
"Definition"; v1 ]
3927 let v1 = sexp_of_cpp_directive
v1
3928 in Sexp.List
[ Sexp.Atom
"CppTop"; v1 ]
3930 let v1 = sexp_of_ifdef_directive
v1
3931 in Sexp.List
[ Sexp.Atom
"IfdefTop"; v1 ]
3932 | MacroTop
((v1, v2
, v3
)) ->
3933 let v1 = Conv.sexp_of_string
v1
3934 and v2
= Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_argument
) v2
3935 and v3
= sexp_of_il v3
3936 in Sexp.List
[ Sexp.Atom
"MacroTop"; v1; v2
; v3
]
3938 let v1 = sexp_of_il
v1 in Sexp.List
[ Sexp.Atom
"EmptyDef"; v1 ]
3939 | NotParsedCorrectly
v1 ->
3940 let v1 = sexp_of_il
v1
3941 in Sexp.List
[ Sexp.Atom
"NotParsedCorrectly"; v1 ]
3943 let v1 = sexp_of_info
v1 in Sexp.List
[ Sexp.Atom
"FinalDef"; v1 ]
3944 and sexp_of_program v
= Conv.sexp_of_list sexp_of_toplevel v
3947 and sexp_of_metavars_binding v =
3950 Common.sexp_of_assoc Ast_cocci.sexp_of_meta_name sexp_of_metavar_binding_kind v
3952 and sexp_of_metavar_binding_kind
=
3955 let v1 = Conv.sexp_of_string
v1
3956 in Sexp.List
[ Sexp.Atom
"MetaIdVal"; v1 ]
3958 let v1 = Conv.sexp_of_string
v1
3959 in Sexp.List
[ Sexp.Atom
"MetaFuncVal"; v1 ]
3960 | MetaLocalFuncVal
v1 ->
3961 let v1 = Conv.sexp_of_string
v1
3962 in Sexp.List
[ Sexp.Atom
"MetaLocalFuncVal"; v1 ]
3964 let v1 = sexp_of_expression
v1
3965 in Sexp.List
[ Sexp.Atom
"MetaExprVal"; v1 ]
3966 | MetaExprListVal
v1 ->
3967 let v1 = Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_argument
) v1
3968 in Sexp.List
[ Sexp.Atom
"MetaExprListVal"; v1 ]
3969 | MetaParamVal
v1 ->
3970 let v1 = sexp_of_parameterType
v1
3971 in Sexp.List
[ Sexp.Atom
"MetaParamVal"; v1 ]
3972 | MetaParamListVal
v1 ->
3973 let v1 = Conv.sexp_of_list
(sexp_of_wrap2 sexp_of_parameterType
) v1
3974 in Sexp.List
[ Sexp.Atom
"MetaParamListVal"; v1 ]
3976 let v1 = sexp_of_fullType
v1
3977 in Sexp.List
[ Sexp.Atom
"MetaTypeVal"; v1 ]
3979 let v1 = sexp_of_initialiser
v1
3980 in Sexp.List
[ Sexp.Atom
"MetaInitVal"; v1 ]
3982 let v1 = sexp_of_statement
v1
3983 in Sexp.List
[ Sexp.Atom
"MetaStmtVal"; v1 ]
3988 let v1 = Ast_cocci.sexp_of_fixpos v1
3989 and v2
= Ast_cocci.sexp_of_fixpos v2
3990 in Sexp.List
[ v1; v2
])
3991 in Sexp.List
[ Sexp.Atom
"MetaPosVal"; v1 ]
3992 | MetaPosValList
v1 ->
3995 (fun (v1, v2
, v3
, v4
) ->
3996 let v1 = Common.sexp_of_filename
v1
3997 and v2
= Conv.sexp_of_string v2
3998 and v3
= sexp_of_posl v3
3999 and v4
= sexp_of_posl v4
4000 in Sexp.List
[ v1; v2
; v3
; v4
])
4002 in Sexp.List
[ Sexp.Atom
"MetaPosValList"; v1 ]
4003 | MetaListlenVal
v1 ->
4004 let v1 = Conv.sexp_of_int
v1
4005 in Sexp.List
[ Sexp.Atom
"MetaListlenVal"; v1 ]
4010 let string_of_toplevel top
=
4011 let sexp = sexp_of_toplevel top
in
4012 let s = Sexp.to_string_hum
sexp in
4015 let string_of_expression x
=
4016 let sexp = sexp_of_expression x
in
4017 let s = Sexp.to_string_hum
sexp in
4020 let string_of_program xs
=
4021 let sexp = sexp_of_program xs
in
4022 let s = Sexp.to_string_hum
sexp in