Project

General

Profile

« Previous | Next » 

Revision 57c96fb7

Added by LĂ©lio Brun 11 months ago

setup tests for dune

View differences:

src/parsers/parser_lustre.mly
19 19
let get_loc () = Location.symbol_rloc ()
20 20

  
21 21
let mkident x = x, get_loc ()
22
let mktyp = mktyp (get_loc ())
22
let mktyp x = mktyp (get_loc ()) x
23 23
let mkotyp x = match x with Some t -> Some (mktyp t) | None -> None
24
let mkclock = mkclock (get_loc ())
24
let mkclock x = mkclock (get_loc ()) x
25 25
let mkvar_decl x loc = mkvar_decl loc ~orig:true x
26
let mkexpr = mkexpr (get_loc ())
27
let mkeexpr = mkeexpr (get_loc ())
28
let mkeq = mkeq (get_loc ())
29
let mkassert = mkassert (get_loc ())
30
let mktop_decl = mktop_decl (get_loc ()) (Location.get_module ())
31
let mkpredef_call = mkpredef_call (get_loc ())
26
let mkexpr x = mkexpr (get_loc ()) x
27
let mkeexpr x = mkeexpr (get_loc ()) x
28
let mkeq x = mkeq (get_loc ()) x
29
let mkassert x = mkassert (get_loc ()) x
30
let mktop_decl x = mktop_decl (get_loc ()) (Location.get_module ()) x
31
let mkpredef_call x = mkpredef_call (get_loc ()) x
32 32
let mkpredef_call_b f x1 x2 = mkpredef_call f [x1; x2]
33 33
let mkpredef_call_u f x = mkpredef_call f [x]
34 34

  
35
let mkdim_int = mkdim_int (get_loc ())
35
let mkdim_int x = mkdim_int (get_loc ()) x
36 36
(* let mkdim_bool b = mkdim_bool (get_loc ()) b *)
37
let mkdim_ident = mkdim_ident (get_loc ())
38
let mkdim_appl = mkdim_appl (get_loc ())
37
let mkdim_ident x = mkdim_ident (get_loc ()) x
38
let mkdim_appl x = mkdim_appl (get_loc ()) x
39 39
let mkdim_appl_b f x1 x2 = mkdim_appl f [x1; x2]
40 40
let mkdim_appl_u f x = mkdim_appl f [x]
41
let mkdim_ite = mkdim_ite (get_loc ())
41
let mkdim_ite x = mkdim_ite (get_loc ()) x
42 42

  
43 43
let mkarraytype = List.fold_left (fun t d -> Tydec_array (d, t))
44 44

  
......
96 96
%token EOF
97 97

  
98 98
%nonassoc p_string
99
%nonassoc p_vdecl
100
%left SCOL
99
(* %nonassoc p_vdecl *)
100
(* %left SCOL *)
101 101
%nonassoc EVERY
102 102
%nonassoc ELSE
103 103
%right ARROW FBY
......
189 189
| CONST ds=cdecl+ SCOL
190 190
  { List.map ((|>) true) ds }
191 191
| nodei_spec=nodespecs nodei_stateless=state_annot nodei_id=node_ident_decl
192
  LPAR nodei_inputs=vdecl_list SCOL? RPAR
193
  RETURNS LPAR nodei_outputs=vdecl_list SCOL? RPAR
192
  LPAR nodei_inputs=var_decl_list(vdecl) RPAR
193
  RETURNS LPAR nodei_outputs=var_decl_list(vdecl) RPAR
194 194
  nodei_prototype=preceded(PROTOTYPE, node_ident)?
195 195
  nodei_in_lib=preceded(LIB, module_ident)* SCOL
196 196
  { let nd = mktop_decl true (ImportedNode {
......
215 215
| CONST ds=cdecl+ SCOL
216 216
  { List.map ((|>) false) ds }
217 217
| node_dec_stateless=state_annot node_id=node_ident_decl
218
  LPAR node_inputs=vdecl_list SCOL? RPAR
219
  RETURNS LPAR node_outputs=vdecl_list SCOL? RPAR SCOL?
218
  LPAR node_inputs=var_decl_list(vdecl) RPAR
219
  RETURNS LPAR node_outputs=var_decl_list(vdecl) RPAR SCOL?
220 220
  node_spec=nodespecs
221 221
  node_locals=locals LET content=stmt_list TEL
222 222
  { let node_stmts, node_asserts, node_annot = content in
......
351 351

  
352 352
top_contract:
353 353
| CONTRACT node_id=node_ident_decl
354
  LPAR node_inputs=vdecl_list SCOL? RPAR
355
  RETURNS LPAR node_outputs=vdecl_list SCOL? RPAR SCOL?
354
  LPAR node_inputs=var_decl_list(vdecl) RPAR
355
  RETURNS LPAR node_outputs=var_decl_list(vdecl) RPAR SCOL?
356 356
  LET cc=contract_content TEL
357 357
  { let nd = mktop_decl true (Node {
358 358
                                  node_id;
......
566 566
| IF d=dim THEN t=dim ELSE f=dim { mkdim_ite d t f }
567 567

  
568 568
%inline locals:
569
| xs=loption(preceded(VAR, flatten(separated_nonempty_list(SCOL, local_vdecl))))
570
  { xs }
569
| xs=loption(preceded(VAR, var_decl_list(local_vdecl))) { xs }
571 570

  
572
vdecl_list:
573
| d=vdecl %prec p_vdecl { d }
574
| d=vdecl SCOL ds=vdecl_list { d @ ds }
571
var_decl_list(X):
572
| d=X ioption(SCOL)            { d }
573
| d=X SCOL ds=var_decl_list(X) { d @ ds }
575 574

  
576 575
vdecl:
577 576
| xs=ident_list COL t=typeconst c=clock?

Also available in: Unified diff