summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-04-29 21:23:39 -0700
committerOri Bernstein <ori@eigenstate.org>2015-04-29 21:23:39 -0700
commitff18725b46d903e6dcedd0c6262aea47fe6c8869 (patch)
treecfdee0a795df83e672a3709b285ff40ca4a9d7d0 /parse
parent404f711755c8dbe4104eedbae62cddfbba6bbfa8 (diff)
downloadmc-ff18725b46d903e6dcedd0c6262aea47fe6c8869.tar.gz
Add regex parsing to libregex.
I'd like to use the same regex parser for source indexing and parser generation.
Diffstat (limited to 'parse')
-rw-r--r--parse/gram.y5
-rw-r--r--parse/infer.c4
2 files changed, 4 insertions, 5 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 74f24c6..8190e9c 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -467,10 +467,7 @@ typaramlist
compoundtype
: functype {$$ = $1;}
| type Tosqbrac Tcolon Tcsqbrac {$$ = mktyslice($2->loc, $1);}
- | type Tosqbrac expr Tcsqbrac {
- $3->expr.type = mktype($3->loc, Tyuint32);
- $$ = mktyarray($2->loc, $1, $3);
- }
+ | type Tosqbrac expr Tcsqbrac {$$ = mktyarray($2->loc, $1, $3);}
| type Tosqbrac Tellipsis Tcsqbrac {$$ = mktyarray($2->loc, $1, NULL);}
| type Tderef {$$ = mktyptr($2->loc, $1);}
| Tat Tident {$$ = mktyparam($1->loc, $2->id);}
diff --git a/parse/infer.c b/parse/infer.c
index b60d79d..576ac3f 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1712,8 +1712,10 @@ static Type *tyfix(Inferstate *st, Node *ctx, Type *orig, int noerr)
st->intype--;
} else if (t->type == Tyunion) {
for (i = 0; i < t->nmemb; i++) {
- if (t->udecls[i]->etype)
+ if (t->udecls[i]->etype) {
+ tyresolve(st, t->udecls[i]->etype);
t->udecls[i]->etype = tyfix(st, ctx, t->udecls[i]->etype, noerr);
+ }
}
} else if (t->type == Tyname) {
for (i = 0; i < t->narg; i++)