Download raw body.
ksh: specify missing closing token
ksh -c ': $('
ksh: no closing quote
is a bit confusing as there are no quotes; it's the $( that's unclosed.
Patch changes it to
./obj/ksh -c ': $('
./obj/ksh: no closing )
I only handled the states I could test; if someone knows how SLETPAREN,
SHEREDELIM, SHEREDQUOTE are reachable at this point I can add cases for
them as well.
diff --git lex.c lex.c
index 41178694fa6..2980271388e 100644
--- lex.c
+++ lex.c
@@ -718,9 +718,31 @@ yylex(int cf)
}
Done:
Xcheck(ws, wp);
- if (statep != &states[1])
- /* XXX figure out what is missing */
- yyerror("no closing quote\n");
+ if (statep != &states[1]) {
+ const char *missing;
+
+ switch (statep->ls_state) {
+ case SBRACE:
+ case STBRACE:
+ case SBRACEQ:
+ missing = "}";
+ break;
+ case SCSPAREN:
+ case SPATTERN:
+ missing = ")";
+ break;
+ case SBQUOTE:
+ missing = "`";
+ break;
+ case SASPAREN:
+ missing = "))";
+ break;
+ default:
+ missing="quote";
+ break;
+ }
+ yyerror("no closing %s\n", missing);
+ }
/* This done to avoid tests for SHEREDELIM wherever SBASE tested */
if (state == SHEREDELIM)
ksh: specify missing closing token