Commit 0805d2b9 authored by Julien Lopez's avatar Julien Lopez

Now we can use the syntax: type t = [('a) | 'df']

parent f481f019
......@@ -600,7 +600,7 @@ EXTEND Gram
| "no_arrow" [ x = pat; "|"; y = pat -> mk _loc (Or (x,y)) ]
| "simple" [ x = pat; "&"; y = pat -> mk _loc (And (x,y))
| x = pat; "\\"; y = pat -> mk _loc (Diff (x,y)) ]
| "var_typ" [ `SQUOTE; x = IDENT -> mk _loc (TVar x) ]
| "var_typ" [ x = PTYPE -> mk _loc (TVar x) ]
|
[ "{"; r = record_spec; "}" -> r
| "ref"; p = pat ->
......
......@@ -51,7 +51,7 @@ type token =
| CHAR of string
| STRING of string
| STRING2 of string
| SQUOTE
| PTYPE of string
| EOI
module Token = struct
......@@ -67,11 +67,11 @@ module Token = struct
| KEYWORD s -> sf "KEYWORD %S" s
| IDENT s -> sf "IDENT %S" s
| INT s -> sf "INT %s" s
| SQUOTE -> sf "'"
| CHAR s -> sf "CHAR \'%s\'" s
| STRING s -> sf "STRING \"%s\"" s
| STRING2 s -> sf "STRING \'%s\'" s
(* here it's not %S since the string is already escaped *)
| PTYPE s -> sf "PTYPE \'%S\'" s
| ANY_IN_NS s -> sf "ANY_IN_NS %S" s
| EOI -> sf "EOI"
......@@ -84,7 +84,7 @@ module Token = struct
let extract_string =
function
| KEYWORD s | IDENT s | INT s | CHAR s | STRING s | STRING2 s |
| KEYWORD s | IDENT s | INT s | CHAR s | STRING s | STRING2 s | PTYPE s |
ANY_IN_NS s -> s
| tok ->
invalid_arg ("Cannot extract a string from this token: "^
......@@ -226,7 +226,10 @@ let rec token = lexer
let s = L.utf8_lexeme lexbuf in
let s = String.make 1 (s.[String.length s - 2]) in
return lexbuf (CHAR s)
| "'" -> return lexbuf SQUOTE
| "'" qname ->
let s = L.utf8_lexeme lexbuf in
let s = String.sub s 1 (String.length s - 1) in
return lexbuf (PTYPE s)
| "(*" ->
in_comment := true;
comment (L.lexeme_start lexbuf) lexbuf;
......@@ -274,7 +277,10 @@ and token2 = lexer
let s = String.sub s 1 (String.length s - 2) in
let s = unescape s (L.lexeme_start lexbuf) in
return lexbuf (STRING2 s)
| "'" -> return lexbuf SQUOTE
| "('" qname ")" ->
let s = L.utf8_lexeme lexbuf in
let s = String.sub s 1 (String.length s - 1) in
return lexbuf (PTYPE s)
| "(*" ->
in_comment := true;
comment (L.lexeme_start lexbuf) lexbuf;
......
......@@ -8,7 +8,7 @@ type token =
| CHAR of string
| STRING of string
| STRING2 of string
| SQUOTE
| PTYPE of string
| EOI
exception Error of int * int * string
......
type a = ('a,'b);;
type b = 'a;;
type t = [('a)];;
type u = [('a) | ('a')];;
......@@ -122,7 +122,8 @@ GOODTESTS="$ROOT/misc/addrbook.cd $ROOT/misc/biblio.cd\
$ROOT/misc/overloading.cd $ROOT/misc/overloading2.cd $ROOT/misc/patterns.cd\
$ROOT/misc/security.cd $ROOT/misc/str.cd $ROOT/misc/stress_opt_arg.cd\
$ROOT/misc/stress_opt_seq.cd $ROOT/misc/vouill.cd $ROOT/misc/web.cd\
$ROOT/misc/wp.cd $ROOT/misc/xtrans.cd $ROOT/misc/ref.cd $ROOT/misc/xhtml.cd"
$ROOT/misc/wp.cd $ROOT/misc/xtrans.cd $ROOT/misc/ref.cd $ROOT/misc/xhtml.cd\
$ROOT/misc/polysyntax.cd"
BADTESTS="$ROOT/misc/bugs_prod.cd $ROOT/misc/eval_concat.cd"
EXTENDEDTESTS="$ROOT/misc/html2latex.cd"
......
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