summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-26 11:06:05 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-26 11:06:05 -0800
commitfe0bcf756016bd8cad54c1af77f054b94fc8d11b (patch)
tree550cd7812212cbcbabba3cef5980cbdc73662e1f /parse
parent74b3aaed1a5a978a4d64ae4bdce9b0cdcf82860c (diff)
downloadmc-fe0bcf756016bd8cad54c1af77f054b94fc8d11b.tar.gz
Remove the '$' shorthand for end of array.
Diffstat (limited to 'parse')
-rw-r--r--parse/gram.y12
-rw-r--r--parse/infer.c6
-rw-r--r--parse/ops.def1
-rw-r--r--parse/tok.c5
4 files changed, 8 insertions, 16 deletions
diff --git a/parse/gram.y b/parse/gram.y
index a07d235..732ad9b 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -78,7 +78,6 @@ static void setupinit(Node *n);
%token<tok> Tat /* @ */
%token<tok> Ttick /* ` */
%token<tok> Tderef /* # */
-%token<tok> Tidxlen /* $ */
%token<tok> Ttype /* type */
%token<tok> Tfor /* for */
@@ -597,13 +596,14 @@ optexpr : expr {$$ = $1;}
| /* empty */ {$$ = NULL;}
;
-loopcond : exprln {$$ = $1;}
+loopcond: exprln {$$ = $1;}
| Tendln {$$ = mkboollit($1->loc, 1);}
;
-optexprln: exprln {$$ = $1;}
- | Tendln {$$ = NULL;}
- ;
+optexprln
+ : exprln {$$ = $1;}
+ | Tendln {$$ = NULL;}
+ ;
exprln : expr Tendln
;
@@ -737,8 +737,6 @@ atomicexpr
{$$ = mkexpr($1->loc, Ovar, mkname($1->loc, $1->id), NULL);}
| Tgap
{$$ = mkexpr($1->loc, Ogap, NULL);}
- | Tidxlen
- {$$ = mkexpr($1->loc, Oidxlen, NULL);}
| literal
| Toparen expr Tcparen
{$$ = $2;}
diff --git a/parse/infer.c b/parse/infer.c
index 84bbd46..a76d420 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1583,12 +1583,6 @@ static void inferexpr(Inferstate *st, Node **np, Type *ret, int *sawret)
infersub(st, n, ret, sawret, &isconst);
settype(st, n, mktype(n->loc, Tyvoid));
break;
- case Oidxlen:
- t = mktyvar(n->loc);
- constrain(st, n, t, traittab[Tcnum]);
- constrain(st, n, t, traittab[Tcint]);
- settype(st, n, t);
- break;
case Odef:
case Odead: n->expr.type = mktype(n->loc, Tyvoid); break;
case Obad:
diff --git a/parse/ops.def b/parse/ops.def
index 2a8f64d..dd9447a 100644
--- a/parse/ops.def
+++ b/parse/ops.def
@@ -55,7 +55,6 @@ O(Oucon, 1, OTmisc, "`")
O(Otup, 1, OTmisc, NULL)
O(Ostruct, 1, OTmisc, NULL)
O(Oarr, 1, OTmisc, NULL)
-O(Oidxlen, 1, OTmisc, "$")
/* all below this point are backend-only */
O(Odead, 0, OTmisc, "DEAD") /* dead code */
diff --git a/parse/tok.c b/parse/tok.c
index cd3346d..17fef0f 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -77,7 +77,9 @@ static Tok *mktok(int tt)
return t;
}
-static int identchar(int c) { return isalnum(c) || c == '_' || c == '$'; }
+static int identchar(int c) {
+ return isalnum(c) || c == '_' || c == '$';
+}
static void eatcomment(void)
{
@@ -160,7 +162,6 @@ static int kwd(char *s)
char *kw;
int tt;
} kwmap[] = {
- {"$", Tidxlen},
{"$noret", Tattr},
{"_", Tgap},
{"break", Tbreak},