Displaying 13 results from an estimated 13 matches for "doprompt".
Did you mean:
noprompt
2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...+---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 2b07437e..f6c43be0 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -743,6 +743,19 @@ out:
return (t);
}
+static void nlprompt(void)
+{
+ plinno++;
+ if (doprompt)
+ setprompt(2);
+}
+
+static void nlnoprompt(void)
+{
+ plinno++;
+ needprompt = doprompt;
+}
+
/*
* Read the next input token.
@@ -786,16 +799,13 @@ xxreadtoken(void)
continue;
case '\\':
if (pgetc() == '\n') {
- plinno++;
- if (doprompt)
- setprompt(2);...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...+---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 2b07437e..f6c43be0 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -743,6 +743,19 @@ out:
return (t);
}
+static void nlprompt(void)
+{
+ plinno++;
+ if (doprompt)
+ setprompt(2);
+}
+
+static void nlnoprompt(void)
+{
+ plinno++;
+ needprompt = doprompt;
+}
+
/*
* Read the next input token.
@@ -786,16 +799,13 @@ xxreadtoken(void)
continue;
case '\\':
if (pgetc() == '\n') {
- plinno++;
- if (doprompt)
- setprompt(2);...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Simplify EOF/newline handling in list parser
.../usr/dash/parser.c b/usr/dash/parser.c
index f0c919d5..382ddf24 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -135,19 +135,13 @@ static inline int realeofmark(const char *eofmark)
union node *
parsecmd(int interact)
{
- int t;
-
tokpushback = 0;
+ checkkwd = 0;
+ heredoclist = 0;
doprompt = interact;
if (doprompt)
setprompt(doprompt);
needprompt = 0;
- t = readtoken();
- if (t == TEOF)
- return NEOF;
- if (t == TNL)
- return NULL;
- tokpushback++;
return list(1);
}
@@ -158,11 +152,27 @@ list(int nlflag)
union node *n1, *n2, *n3;
int tok;
- checkkwd = CHKNL | CHKK...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Simplify EOF/newline handling in list parser
.../usr/dash/parser.c b/usr/dash/parser.c
index f0c919d5..382ddf24 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -135,19 +135,13 @@ static inline int realeofmark(const char *eofmark)
union node *
parsecmd(int interact)
{
- int t;
-
tokpushback = 0;
+ checkkwd = 0;
+ heredoclist = 0;
doprompt = interact;
if (doprompt)
setprompt(doprompt);
needprompt = 0;
- t = readtoken();
- if (t == TEOF)
- return NEOF;
- if (t == TNL)
- return NULL;
- tokpushback++;
return list(1);
}
@@ -158,11 +152,27 @@ list(int nlflag)
union node *n1, *n2, *n3;
int tok;
- checkkwd = CHKNL | CHKK...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...if (pc != '\\' && pc != '`' && pc != '$'
&& (!dblquote || pc != '"'))
STPUTC('\\', pout);
@@ -1529,7 +1512,7 @@ expandstr(const char *ps)
saveprompt = doprompt;
doprompt = 0;
- readtoken1(pgetc(), DQSYNTAX, FAKEEOFMARK, 0);
+ readtoken1(pgetc_eatbnl(), DQSYNTAX, FAKEEOFMARK, 0);
doprompt = saveprompt;
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...if (pc != '\\' && pc != '`' && pc != '$'
&& (!dblquote || pc != '"'))
STPUTC('\\', pout);
@@ -1529,7 +1512,7 @@ expandstr(const char *ps)
saveprompt = doprompt;
doprompt = 0;
- readtoken1(pgetc(), DQSYNTAX, FAKEEOFMARK, 0);
+ readtoken1(pgetc_eatbnl(), DQSYNTAX, FAKEEOFMARK, 0);
doprompt = saveprompt;
2020 Mar 28
0
[klibc:update-dash] dash: parser: Save/restore here-documents in command substitution
...+ struct heredoc *saveheredoclist;
int uninitialized_var(saveprompt);
str = NULL;
@@ -1432,6 +1433,9 @@ done:
*nlpp = (struct nodelist *)stalloc(sizeof (struct nodelist));
(*nlpp)->next = NULL;
+ saveheredoclist = heredoclist;
+ heredoclist = NULL;
+
if (oldstyle) {
saveprompt = doprompt;
doprompt = 0;
@@ -1444,17 +1448,18 @@ done:
else {
if (readtoken() != TRP)
synexpect(TRP);
+ setinputstring(nullstr);
+ parseheredoc();
}
+ heredoclist = saveheredoclist;
+
(*nlpp)->n = n;
- if (oldstyle) {
- /*
- * Start reading from old file again, ignoring any p...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Handle backslash newlines properly after dollar sign
...c4eaae2b..2b07437e 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -827,6 +827,24 @@ breakloop:
#undef RETURN
}
+static int pgetc_eatbnl(void)
+{
+ int c;
+
+ while ((c = pgetc()) == '\\') {
+ if (pgetc() != '\n') {
+ pungetc();
+ break;
+ }
+
+ plinno++;
+ if (doprompt)
+ setprompt(2);
+ }
+
+ return c;
+}
+
/*
@@ -1179,7 +1197,7 @@ parsesub: {
char *p;
static const char types[] = "}-+?=";
- c = pgetc();
+ c = pgetc_eatbnl();
if (
(checkkwd & CHKEOFMARK) ||
c <= PEOA ||
@@ -1188,7 +1206,7 @@ parsesub: {
USTPUTC('$'...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Handle backslash newlines properly after dollar sign
...c4eaae2b..2b07437e 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -827,6 +827,24 @@ breakloop:
#undef RETURN
}
+static int pgetc_eatbnl(void)
+{
+ int c;
+
+ while ((c = pgetc()) == '\\') {
+ if (pgetc() != '\n') {
+ pungetc();
+ break;
+ }
+
+ plinno++;
+ if (doprompt)
+ setprompt(2);
+ }
+
+ return c;
+}
+
/*
@@ -1179,7 +1197,7 @@ parsesub: {
char *p;
static const char types[] = "}-+?=";
- c = pgetc();
+ c = pgetc_eatbnl();
if (
(checkkwd & CHKEOFMARK) ||
c <= PEOA ||
@@ -1188,7 +1206,7 @@ parsesub: {
USTPUTC('$'...
2019 Jan 25
0
[klibc:update-dash] [SHELL] Optimize dash -c "command" to avoid a fork
...ndex 6e076a59..572cbcd5 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -64,7 +64,7 @@
*/
/* values returned by readtoken */
-#include "token.h"
+#include "token_vars.h"
@@ -86,7 +86,7 @@ struct heredoc *heredoclist; /* list of here documents to read */
int doprompt; /* if set, prompt the user */
int needprompt; /* true if interactive and at start of line */
int lasttoken; /* last token read */
-MKINIT int tokpushback; /* last token pushed back */
+int tokpushback; /* last token pushed back */
char *wordtext; /* text of last word returned by readt...
2020 Mar 28
0
[klibc:update-dash] dash: [SHELL] Optimize dash -c "command" to avoid a fork
...ndex 6e076a59..572cbcd5 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -64,7 +64,7 @@
*/
/* values returned by readtoken */
-#include "token.h"
+#include "token_vars.h"
@@ -86,7 +86,7 @@ struct heredoc *heredoclist; /* list of here documents to read */
int doprompt; /* if set, prompt the user */
int needprompt; /* true if interactive and at start of line */
int lasttoken; /* last token read */
-MKINIT int tokpushback; /* last token pushed back */
+int tokpushback; /* last token pushed back */
char *wordtext; /* text of last word returned by readt...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...quotef = 0;
bqlist = NULL;
- varnest = 0;
- arinest = 0;
- parenlevel = 0;
- dqvarnest = 0;
STARTSTACKSTR(out);
loop: { /* for each line, until end of word */
@@ -895,7 +913,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
if (c == '\034' && doprompt
&& attyset() && ! equal(termval(), "emacs")) {
attyline();
- if (syntax == BASESYNTAX)
+ if (synstack->syntax == BASESYNTAX)
return readtoken();
c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
goto loop;
@@ -904,9 +922,9 @@ readtoken1(int fir...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...quotef = 0;
bqlist = NULL;
- varnest = 0;
- arinest = 0;
- parenlevel = 0;
- dqvarnest = 0;
STARTSTACKSTR(out);
loop: { /* for each line, until end of word */
@@ -895,7 +913,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
if (c == '\034' && doprompt
&& attyset() && ! equal(termval(), "emacs")) {
attyline();
- if (syntax == BASESYNTAX)
+ if (synstack->syntax == BASESYNTAX)
return readtoken();
c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
goto loop;
@@ -904,9 +922,9 @@ readtoken1(int fir...