Skip to content

Commit

Permalink
Add builtin types: function and object
Browse files Browse the repository at this point in the history
  • Loading branch information
arseny30 committed Feb 15, 2018
1 parent a111989 commit f49077d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tl-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f49077d

Please sign in to comment.