summaryrefslogtreecommitdiff
path: root/lib/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parser.c')
-rw-r--r--lib/parser.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/lib/parser.c b/lib/parser.c
index 6d608b4..23239c4 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -96,7 +96,7 @@ static void push_op(op_t op)
if (pileop_pos != PILEOP_MAX)
pile_operators[pileop_pos++] = op;
else
- exception(2, _("Too many nested operators in expression.\n"));
+ exception(1, _("Too many nested operators in expression.\n"));
}
@@ -127,7 +127,7 @@ static void push_call(int call)
if (pilecall_pos != PILECALL_MAX)
pile_nestedcall[pilecall_pos++] = call;
else
- exception(2, _("Too many nested functions calls in expression.\n"));
+ exception(1, _("Too many nested functions calls in expression.\n"));
}
/* Cette fonction lit un "mot" sur la chaine line et renvoit le nouveau pointeur */
@@ -175,7 +175,7 @@ static char *getword(char *line, char *p)
}
line++;
}
- while (((*line) && (*line != ')') && (*line != ']')
+ while (((*line) && (*line != ')')
&& (*line != ';') && (get_func(*line) == -1)
&& (get_func(o) == -1)) || (instring));
*p = '\0';
@@ -193,7 +193,7 @@ void parse_line(char *line)
sprintf(buffer, "Read line '%s'", line);
pushcontext(buffer);
- while (*line) {
+ while ((*line) && !(global_error)) {
line = getword(line, buffer);
sprintf(imm, "Analysing word '%s' at position %i", buffer, line - d);
pushcontext(imm);
@@ -209,9 +209,8 @@ void parse_line(char *line)
exception(1, _("Invalid binary operator"));
}
}
- while (get_pri(get_last_op()) >= get_pri(buffer[0])
- && (((get_last_op() & 127) != '(')
- && ((get_last_op() & 127) != '['))) {
+ while ((get_pri(get_last_op()) >= get_pri(buffer[0]))
+ && ((get_last_op() & 127) != '(')) {
act_pile(get_func(pop_op()));
got_unary = 0;
}
@@ -223,8 +222,7 @@ void parse_line(char *line)
} else
push_op(buffer[0]);
got_unary = 128;
- } else if ((buffer[0] == ';') || (buffer[0] == ')')
- || (buffer[0] == ']')) {
+ } else if ((buffer[0] == ';') || (buffer[0] == ')')) {
/* Le mot lut est un opérateur spécial, on vide la pile */
switch (buffer[0]) {
case ';':
@@ -257,21 +255,6 @@ void parse_line(char *line)
}
got_unary = 0;
break;
- case ']':
- /* Fin d'opérateur de décalage */
- while (1) {
- if (!pileop_pos)
- exception(1, _("Parse error: too much right parenthesis"));
- op = pop_op();
- if (((op & 127) == '['))
- break;
- if (((op & 127) == '('))
- exception(1, _("Parse error: enclosure mismatch"));
- act_pile(get_func(op));
- }
- act_pile(get_func(op));
- got_unary = 0;
- break;
}
} else if (((buffer[0] >= 'A') && (buffer[0] <= 'Z'))
|| ((buffer[0] >= 'a') && (buffer[0] <= 'z'))
@@ -289,6 +272,5 @@ void parse_line(char *line)
}
popcontext();
}
-
popcontext();
}