Compare commits

...

3 Commits

Author SHA1 Message Date
Arseny Smirnov
f49077de7f Add builtin types: function and object 2018-02-15 13:42:26 +03:00
vvaltman
a111989860 added multiple ns 2018-02-15 12:32:55 +03:00
vysheng
36bf1902ff Merge pull request #5 from BenWiederhake/develop
Fix endianess, clean up on the way.
2015-10-17 16:33:25 +03:00

View File

@ -265,7 +265,7 @@ char *parse_lex (void) {
parse.lex.type = lex_lc_ident; parse.lex.type = lex_lc_ident;
return (parse.lex.ptr = p); return (parse.lex.ptr = p);
} }
if (curch == '.') { while (curch == '.') {
parse.lex.flags |= 1; parse.lex.flags |= 1;
nextch (); nextch ();
if (is_uletter (curch)) { if (is_uletter (curch)) {
@ -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")) || 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, "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, "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"))) { (!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); struct tl_type *t = tl_add_type (T->c[1]->text, T->c[1]->len, 0, 0);
if (!t) { if (!t) {
@ -2951,7 +2953,8 @@ void write_type (struct tl_type *t) {
} }
int is_builtin_type (const char *id) { 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) { void write_combinator (struct tl_constructor *c) {