summaryrefslogtreecommitdiff
path: root/yacc/reader.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2003-07-17 14:51:43 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2003-07-17 14:51:43 +0000
commit7617bb244a5e64e3e5e0a79d9b5545216321b038 (patch)
treef34d26da4517f8ac090bc097e3dad18a055dbba0 /yacc/reader.c
parent8327be578f36df547e8ea2dd03c84c8c26ff0845 (diff)
downloadocaml-7617bb244a5e64e3e5e0a79d9b5545216321b038.tar.gz
Rejeter les points d'entree ayant un type polymorphe (PR#1583)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5709 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'yacc/reader.c')
-rw-r--r--yacc/reader.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/yacc/reader.c b/yacc/reader.c
index fa95740f5a..f7847f9e97 100644
--- a/yacc/reader.c
+++ b/yacc/reader.c
@@ -1658,6 +1658,24 @@ void pack_symbols(void)
FREE(v);
}
+static unsigned char caml_ident_start[32] =
+"\000\000\000\000\000\000\000\000\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\377\377\177\377\377\377\177\377";
+static unsigned char caml_ident_body[32] =
+"\000\000\000\000\200\000\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\377\377\177\377\377\377\177\377";
+
+#define In_bitmap(bm,c) (bm[(unsigned char)(c) >> 3] & (1 << ((c) & 7)))
+
+static int is_polymorphic(char * s)
+{
+ while (*s != 0) {
+ char c = *s++;
+ if (c == '\'') return 1;
+ if (In_bitmap(caml_ident_start, c)) {
+ while (In_bitmap(caml_ident_body, *s)) s++;
+ }
+ }
+ return 0;
+}
void make_goal(void)
{
@@ -1682,6 +1700,8 @@ void make_goal(void)
pitem[nitems++] = bp;
if (bp->tag == NULL)
entry_without_type(bp->name);
+ if (is_polymorphic(bp->tag))
+ polymorphic_entry_point(bp->name);
fprintf(entry_file,
"let %s (lexfun : Lexing.lexbuf -> token) (lexbuf : Lexing.lexbuf) =\n (yyparse yytables %d lexfun lexbuf : %s)\n",
bp->name, bp->entry, bp->tag);