summaryrefslogtreecommitdiff
path: root/pez.c
diff options
context:
space:
mode:
Diffstat (limited to 'pez.c')
-rw-r--r--pez.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pez.c b/pez.c
index 1ad9670..2864444 100644
--- a/pez.c
+++ b/pez.c
@@ -2438,6 +2438,12 @@ flushconst(Comp *cm)
}
static bool
+reserved(const char *s)
+{
+ return !strcmp(s, "FOR") || !strcmp(s, "RET");
+}
+
+static bool
primaryexpr(Comp *cm)
{
char buf[NAMEMAX];
@@ -2492,6 +2498,10 @@ primaryexpr(Comp *cm)
// identifier
*buf = c;
TRY(readident(cm, buf + 1, sizeof buf - 1));
+ if (reserved(buf)) {
+ comperr(cm, *buf, "'%s' is a reserved keyword", buf);
+ return 0;
+ }
Ident:
local = findlocal(cm, buf);
if (local) {
@@ -3325,6 +3335,10 @@ decl(Comp *cm, Local **pl, bool nofold)
return 0;
}
TRY(readident(cm, name, sizeof name));
+ if (reserved(name)) {
+ comperr(cm, *name, "'%s' is a reserved keyword", name);
+ return 0;
+ }
eatspaces(cm);
switch ((c = nextchr(cm))) {
case ':': // constant