Skip to content

Commit

Permalink
Whitespace cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mjambon committed Nov 23, 2012
1 parent cf7cc82 commit 7177896
Show file tree
Hide file tree
Showing 27 changed files with 490 additions and 490 deletions.
2 changes: 1 addition & 1 deletion INSTALL
Expand Up @@ -10,7 +10,7 @@ Requirements:
- easy-format http://martin.jambon.free.fr/easy-format.html


GODI makes the installation process straightforward,
GODI makes the installation process straightforward,
although other package managers can be equally convenient.


Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -70,7 +70,7 @@ install: META

uninstall:
test ! -f $(BINDIR)/atdcat || rm $(BINDIR)/atdcat
test ! -f $(BINDIR)/atdcat.exe || rm $(BINDIR)/atdcat.exe
test ! -f $(BINDIR)/atdcat.exe || rm $(BINDIR)/atdcat.exe
ocamlfind remove atd

reinstall:
Expand Down
22 changes: 11 additions & 11 deletions atd_annot.ml
Expand Up @@ -38,11 +38,11 @@ let get_flag k k2 l =
let loc, l2 = List.assoc k1 l in
let loc, o = List.assoc k2 l2 in
match o with
None -> Some true
None -> Some true
| Some "true" -> Some true
| Some "false" -> Some false
| Some s ->
error_at loc
error_at loc
(sprintf "Invalid value %S for flag %s.%s" s k1 k2)
with Not_found -> None
) k
Expand All @@ -60,15 +60,15 @@ let get_field parse default k k2 l =
let loc, l2 = List.assoc k1 l in
let loc, o = List.assoc k2 l2 in
match o with
Some s ->
(match parse s with
Some x as y -> y
| None ->
error_at loc
(sprintf "Invalid annotation <%s %s=%S>" k1 k2 s)
)
Some s ->
(match parse s with
Some x as y -> y
| None ->
error_at loc
(sprintf "Invalid annotation <%s %s=%S>" k1 k2 s)
)
| None ->
error_at loc
error_at loc
(sprintf "Missing value for annotation %s.%s" k1 k2)
with Not_found ->
None
Expand Down Expand Up @@ -126,7 +126,7 @@ let override_values x1 x2 = x1

let override_fields (loc1, l1) (loc2, l2) =
(loc1, collapse override_values (l1 @ l2))

let merge l =
collapse override_fields l

Expand Down
2 changes: 1 addition & 1 deletion atd_annot.mli
Expand Up @@ -102,7 +102,7 @@ val set_field : Atd_ast.loc -> string -> string -> string option -> t -> t

val merge : t -> t
(** Merge sections of the same name together,
and keeps only the first occurrence of each
and keeps only the first occurrence of each
field.
{v
Expand Down
46 changes: 23 additions & 23 deletions atd_ast.ml
Expand Up @@ -26,7 +26,7 @@ and module_item =

and type_param = string list

and type_expr =
and type_expr =
[ `Sum of (loc * variant list * annot)
| `Record of (loc * field list * annot)
| `Tuple of (loc * cell list * annot)
Expand All @@ -39,7 +39,7 @@ and type_expr =
]
(* `List, `Option, `Nullable, and `Shared are
the only predefined types with a type
parameter (and no special syntax). *)
parameter (and no special syntax). *)

and type_inst = loc * string * type_expr list

Expand Down Expand Up @@ -105,7 +105,7 @@ let annot_of_type_expr = function
| `Name (_, _, an) -> an
| `Tvar (_, _) -> []



let map_annot f = function
`Sum (loc, vl, a) -> `Sum (loc, vl, f a)
Expand All @@ -131,7 +131,7 @@ let rec amap_type_expr f (x : type_expr) =
| `Tvar _ as x -> x
| `Name (loc, (loc2, name, args), a) ->
`Name (loc, (loc2, name, List.map (amap_type_expr f) args), f a)

and amap_variant f = function
`Variant (loc, (name, a), o) ->
let o =
Expand Down Expand Up @@ -167,39 +167,39 @@ let map_all_annot f ((head, body) : full_module) =
let rec fold (f : type_expr -> 'a -> 'a) (x : type_expr) acc =
let acc = f x acc in
match x with
`Sum (loc, variant_list, annot) ->
List.fold_right (fold_variant f) variant_list acc
`Sum (loc, variant_list, annot) ->
List.fold_right (fold_variant f) variant_list acc

| `Record (loc, field_list, annot) ->
List.fold_right (fold_field f) field_list acc
List.fold_right (fold_field f) field_list acc

| `Tuple (loc, l, annot) ->
List.fold_right (fun (loc, x, _) acc -> fold f x acc) l acc
List.fold_right (fun (loc, x, _) acc -> fold f x acc) l acc

| `List (loc, type_expr, annot) ->
fold f type_expr acc
fold f type_expr acc

| `Option (loc, type_expr, annot) ->
fold f type_expr acc
fold f type_expr acc

| `Nullable (loc, type_expr, annot) ->
fold f type_expr acc
fold f type_expr acc

| `Shared (loc, type_expr, annot) ->
fold f type_expr acc

| `Name (loc, (loc2, name, type_expr_list), annot) ->
List.fold_right (fold f) type_expr_list acc
List.fold_right (fold f) type_expr_list acc

| `Tvar (loc, string) ->
acc
acc

and fold_variant f x acc =
match x with
`Variant (loc, _, Some type_expr) -> fold f type_expr acc
| `Variant _ -> acc
| `Inherit (loc, type_expr) -> fold f type_expr acc

and fold_field f x acc =
match x with
`Field (loc, _, type_expr) -> fold f type_expr acc
Expand All @@ -225,7 +225,7 @@ let extract_type_names ?(ignorable = []) x =
match x with
`Name (loc, (loc2, name, l), a) -> add name acc
| _ -> acc
)
)
x Type_names.empty
in
Type_names.elements acc
Expand Down
16 changes: 8 additions & 8 deletions atd_ast.mli
Expand Up @@ -23,7 +23,7 @@ v}
*)

and annot_field = string * (loc * string option)
(** An annotation field,
(** An annotation field,
i.e. a key with an optional value within an annotation. *)


Expand Down Expand Up @@ -51,7 +51,7 @@ and type_def = loc * (string * type_param * annot) * type_expr
and type_param = string list
(** List of type variables without the tick. *)

and type_expr =
and type_expr =
[ `Sum of (loc * variant list * annot)
| `Record of (loc * field list * annot)
| `Tuple of (loc * cell list * annot)
Expand All @@ -69,7 +69,7 @@ and type_expr =
- [`Tuple]: a tuple (within parentheses)
- [`List]: a list type written [list] with its parameter
e.g. [int list]
- [`Option]: an option type written [option] with its parameter
- [`Option]: an option type written [option] with its parameter
e.g. [string option]
- [`Nullable]: adds a null value to a type.
[`Option] should be preferred over [`Nullable] since
Expand All @@ -91,7 +91,7 @@ and variant =
| `Inherit of (loc * type_expr) ]
(**
A single variant or an [inherit] statement.
[`Inherit] statements can be expanded into variants
[`Inherit] statements can be expanded into variants
using {!Atd_inherit}
or at loading time using the [inherit_variant] option
offered by the {!Atd_util} functions.
Expand All @@ -109,7 +109,7 @@ and field_kind =
| `With_default
]
(**
Different kinds of record fields based on the
Different kinds of record fields based on the
- [`Required]: required field, e.g. [id : string]
- [`Optional]: optional field without a default value, e.g.
[?name : string option]. The ATD type of the field
Expand All @@ -128,13 +128,13 @@ type user = \{
id : string;
?name : string option;
(* Field may be omitted when no value is set, if permitted
(* Field may be omitted when no value is set, if permitted
by the target language. *)
~websites : string list;
(* Implicit default: empty list.
Field may be omitted if the field value is
equal to the default value and the
equal to the default value and the
target language permits it. *)
~level <ocaml default="`Beginner"> : level;
Expand Down Expand Up @@ -211,7 +211,7 @@ val extract_type_names :
?ignorable : string list ->
type_expr -> string list
(**
Extract all the type names occurring in a type expression
Extract all the type names occurring in a type expression
under [`Name], without duplicates.
@param ignorable specifies a list of type names to exclude from the result
*)
Expand Down

0 comments on commit 7177896

Please sign in to comment.