summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormongo <andmarti@gmail.com>2023-06-01 09:42:53 -0300
committermongo <andmarti@gmail.com>2023-06-01 09:42:53 -0300
commit1b31cabf28b3955fa6a127cff0a150c088e8afff (patch)
tree42cf89fbf8b917bb92ee086f67a240de51eaa34d
parent0d47acd9d9a70980359cd692f86f6728571da9db (diff)
parent9da214a7a36393c0342258679690a83f6405a30a (diff)
Merge branch 'pr-789' into dev
-rwxr-xr-xsrc/gram.y11
-rw-r--r--src/lex.c26
2 files changed, 20 insertions, 17 deletions
diff --git a/src/gram.y b/src/gram.y
index 3d38471..11ef14a 100755
--- a/src/gram.y
+++ b/src/gram.y
@@ -1240,12 +1240,15 @@ command:
| // nothing
| error {
sc_error("syntax error: %s", line);
- line[0]='\0';
+ YYABORT;
+
//linelim = 0;
//yyparse();
- linelim = -1;
- yyclearin;
- yyerrok;
+
+ //line[0]='\0';
+ //linelim = -1;
+ //yyclearin;
+ //yyerrok;
};
term: var {
diff --git a/src/lex.c b/src/lex.c
index c71fef1..5ff8eda 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -157,23 +157,23 @@ int yylex() {
ret = WORD;
if (!linelim || isfunc) {
if (isfunc) isfunc--;
- for (tblp = linelim ? experres : statres; tblp->key; tblp++)
- if (((tblp->key[0]^tokenst[0])&0137)==0
- && tblp->key[tokenl]==0) {
- int i = 1;
- while (i<tokenl && ((tokenst[i]^tblp->key[i])&0137)==0)
- i++;
- if (i >= tokenl) {
- ret = tblp->val;
- colstate = (ret <= S_FORMAT);
- if (isgoto) {
- isfunc = isgoto = 0;
- if (ret != K_ERROR && ret != K_INVALID)
- ret = WORD;
+ for (tblp = linelim ? experres : statres; tblp->key; tblp++) {
+ if (((tblp->key[0]^tokenst[0])&0137)==0) {
+ int i = 1;
+ while (tblp->key[i] && i<tokenl && ((tokenst[i]^tblp->key[i])&0137)==0)
+ i++;
+ if (i >= tokenl && tblp->key[i] == '\0') {
+ ret = tblp->val;
+ colstate = (ret <= S_FORMAT);
+ if (isgoto) {
+ isfunc = isgoto = 0;
+ if (ret != K_ERROR && ret != K_INVALID)
+ ret = WORD;
}
break;
}
}
+ }
}
if (ret == WORD) {