From f49077de7f7aa5721483c5686182deebad5e78dd Mon Sep 17 00:00:00 2001 From: Arseny Smirnov Date: Thu, 15 Feb 2018 13:42:26 +0300 Subject: [PATCH] Add builtin types: function and object --- tl-parser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tl-parser.c b/tl-parser.c index 669d5ba..b021185 100644 --- a/tl-parser.c +++ b/tl-parser.c @@ -2445,6 +2445,8 @@ int tl_parse_builtin_combinator_decl (struct tree *T, int fun) { if ((!mystrcmp2 (T->c[0]->text, T->c[0]->len, "int") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Int")) || (!mystrcmp2 (T->c[0]->text, T->c[0]->len, "long") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Long")) || (!mystrcmp2 (T->c[0]->text, T->c[0]->len, "double") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Double")) || + (!mystrcmp2 (T->c[0]->text, T->c[0]->len, "object") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Object")) || + (!mystrcmp2 (T->c[0]->text, T->c[0]->len, "function") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "Function")) || (!mystrcmp2 (T->c[0]->text, T->c[0]->len, "string") && !mystrcmp2 (T->c[1]->text, T->c[1]->len, "String"))) { struct tl_type *t = tl_add_type (T->c[1]->text, T->c[1]->len, 0, 0); if (!t) { @@ -2951,7 +2953,8 @@ void write_type (struct tl_type *t) { } int is_builtin_type (const char *id) { - return !strcmp (id, "int") || !strcmp (id, "long") || !strcmp (id, "double") || !strcmp (id, "string"); + return !strcmp (id, "int") || !strcmp (id, "long") || !strcmp (id, "double") || !strcmp (id, "string") + || !strcmp(id, "object") || !strcmp(id, "function"); } void write_combinator (struct tl_constructor *c) {