Commit 25879ea4 authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA] Fixes on test generator and on GRAMMAR

parent 81ac96c0
......@@ -4,7 +4,7 @@ expr = id
| "`false"
| STRING
| abstr
| "let" STRING ":" type_id "=" expr "in" expr ":" type_id
| "let" LIDENT ":" type_id "=" expr "in" expr ":" type_id
| expr "." expr
| expr "," expr
| expr "+" expr
......@@ -54,8 +54,8 @@ branches = (* empty *)
id = LIDENT (* [a-z_][A-Za-z0-9_]* *)
;;
type_id = LIDENT
| "'" LIDENT "{" id "/" type_id sigma "}"
type_id = UIDENT
| "'" UIDENT "{" id "/" type_id sigma "}"
| "[" complex_type_id "]"
| "(" complex_type_id ")"
;;
......
......@@ -32,9 +32,9 @@ let rec g_ident nb res =
(if rand < 26 then
String.make 1 (char_of_int (int_of_char 'a' + rand))
else if rand < 52 then
String.make 1 (char_of_int (int_of_char 'A' + rand))
String.make 1 (char_of_int (int_of_char 'A' + rand - 26))
else if rand < 62 then
String.make 1 (char_of_int (int_of_char '0' + rand))
String.make 1 (char_of_int (int_of_char '0' + rand - 52))
else "_"
)
in
......@@ -43,7 +43,7 @@ let rec g_ident nb res =
let g_lident nb res =
if nb = 0 then res else
let rand = Random.int 27 in
let res = res ^ (if rand = 26 then "_"
let res = res ^ " " ^ (if rand = 26 then "_"
else String.make 1 (char_of_int (int_of_char 'a' + rand))) in
g_ident (nb - 1) res
......@@ -64,11 +64,11 @@ let rec g_token n = function
Printf.eprintf "File %s, line %d, characters %d-%d:Unknown rule %s\n"
(Loc.file_name loc) l cbegin cend name; raise Error
in g_states "" (max (n-1) 0) states
| String(_, s) -> s
| String(_, s) -> " " ^ s ^ " "
| Special(loc, spe) -> match spe with
| "LIDENT" -> g_lident 3 ""
| "UIDENT" -> g_uident 3 ""
| "STRING" -> g_ident 3 ""
| "STRING" -> "\"" ^ g_ident 3 "" ^ "\""
| "INTEGER" -> string_of_int (Random.int 1000)
| _ ->
let l = Loc.start_line loc in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment