Project

General

Profile

Revision 6afa892a src/types.ml

View differences:

src/types.ml
35 35
  | Tbool
36 36
  | Trat (* Actually unused for now. Only place where it can appear is
37 37
            in a clock declaration *)
38
  | Tclock of type_expr (* An type expression explicitely tagged as carrying a clock *)
38
  | Tclock of type_expr (* A type expression explicitely tagged as carrying a clock *)
39 39
  | Tarrow of type_expr * type_expr
40 40
  | Ttuple of type_expr list
41 41
  | Tenum of ident list
......
55 55
  | Unbound_type of ident
56 56
  | Not_a_dimension
57 57
  | Not_a_constant
58
  | Assigned_constant of ident
58 59
  | WrongArity of int * int
59 60
  | WrongMorphism of int * int
60 61
  | Type_clash of type_expr * type_expr
......
119 120
  | Tbool ->
120 121
    fprintf fmt "bool"
121 122
  | Tclock t ->
122
    fprintf fmt "%a clock" print_ty t
123
    fprintf fmt "%a clock" print_node_ty t
123 124
  | Tstatic (_, t) ->
124 125
    fprintf fmt "%a" print_node_ty t
125 126
  | Tconst t ->
......
127 128
  | Trat ->
128 129
    fprintf fmt "rat"
129 130
  | Tarrow (ty1,ty2) ->
130
    fprintf fmt "%a -> %a" print_ty ty1 print_ty ty2
131
    fprintf fmt "%a -> %a" print_node_ty ty1 print_node_ty ty2
131 132
  | Ttuple tylist ->
132 133
    fprintf fmt "(%a)"
133
      (Utils.fprintf_list ~sep:"*" print_ty) tylist
134
      (Utils.fprintf_list ~sep:"*" print_node_ty) tylist
134 135
  | Tenum taglist ->
135 136
    fprintf fmt "enum {%a }"
136 137
      (Utils.fprintf_list ~sep:", " pp_print_string) taglist
......
138 139
    fprintf fmt "struct {%a }"
139 140
      (Utils.fprintf_list ~sep:"; " print_node_struct_ty_field) fieldlist
140 141
  | Tarray (e, ty) ->
141
    fprintf fmt "%a^%a" print_ty ty Dimension.pp_dimension e
142
    fprintf fmt "%a^%a" print_node_ty ty Dimension.pp_dimension e
142 143
  | Tlink ty ->
143
      print_ty fmt ty
144
      print_node_ty fmt ty
144 145
  | Tunivar ->
145 146
    fprintf fmt "'%s" (name_of_type ty.tid)
146 147

  
......
155 156
    fprintf fmt "Multiple definitions of variable %s@." id
156 157
  | Not_a_constant ->
157 158
    fprintf fmt "This expression is not a constant@."
159
  | Assigned_constant id ->
160
    fprintf fmt "The constant %s cannot be assigned@." id
158 161
  | Not_a_dimension ->
159 162
    fprintf fmt "This expression is not a valid dimension@."
160 163
  | WrongArity (ar1, ar2) ->
......
201 204
  | Tstruct fl -> (try Some (List.assoc label fl) with Not_found -> None)
202 205
  | _          -> None
203 206

  
204
let is_clock_type ty =
207
let is_numeric_type ty =
208
 match (repr ty).tdesc with
209
 | Tint
210
 | Treal -> true
211
 | _     -> false
212

  
213
let is_bool_type ty =
214
 match (repr ty).tdesc with
215
 | Tbool -> true
216
 | _     -> false
217

  
218
let get_clock_base_type ty =
205 219
 match (repr ty).tdesc with
206
 | Tclock _ -> true
207
 | _        -> false
220
 | Tclock ty -> Some ty
221
 | _         -> None
208 222

  
209 223
let rec is_dimension_type ty =
210 224
 match (repr ty).tdesc with

Also available in: Unified diff