Displaying 7 results from an estimated 7 matches for "parsebackq".
2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...doprompt)
- setprompt(2);
+ nlprompt();
} else {
if (
dblquote &&
@@ -1092,8 +1096,7 @@ checkend: {
if (c == '\n' || c == PEOF) {
c = PEOF;
- plinno++;
- needprompt = doprompt;
+ nlnoprompt();
} else {
int len;
@@ -1342,9 +1345,7 @@ parsebackq: {
case '\\':
if ((pc = pgetc()) == '\n') {
- plinno++;
- if (doprompt)
- setprompt(2);
+ nlprompt();
/*
* If eating a newline, avoid putting
* the newline into the new character
@@ -1366,8 +1367,7 @@ parseb...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...doprompt)
- setprompt(2);
+ nlprompt();
} else {
if (
dblquote &&
@@ -1092,8 +1096,7 @@ checkend: {
if (c == '\n' || c == PEOF) {
c = PEOF;
- plinno++;
- needprompt = doprompt;
+ nlnoprompt();
} else {
int len;
@@ -1342,9 +1345,7 @@ parsebackq: {
case '\\':
if ((pc = pgetc()) == '\n') {
- plinno++;
- if (doprompt)
- setprompt(2);
+ nlprompt();
/*
* If eating a newline, avoid putting
* the newline into the new character
@@ -1366,8 +1367,7 @@ parseb...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Save/restore here-documents in command substitution
...: Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/parser.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 8bd3db44..809c6a8a 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1368,6 +1368,7 @@ parsebackq: {
union node *n;
char *str;
size_t savelen;
+ 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;
+ here...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...->type = NHERE;
heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc));
heredoc->here = np;
- if ((c = pgetc()) == '-') {
+ if ((c = pgetc_eatbnl()) == '-') {
heredoc->striptabs = 1;
} else {
heredoc->striptabs = 0;
@@ -1336,21 +1328,12 @@ parsebackq: {
if (needprompt) {
setprompt(2);
}
- switch (pc = pgetc()) {
+ switch (pc = pgetc_eatbnl()) {
case '`':
goto done;
case '\\':
- if ((pc = pgetc()) == '\n') {
- nlprompt();
- /*
- * If eating a newl...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...->type = NHERE;
heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc));
heredoc->here = np;
- if ((c = pgetc()) == '-') {
+ if ((c = pgetc_eatbnl()) == '-') {
heredoc->striptabs = 1;
} else {
heredoc->striptabs = 0;
@@ -1336,21 +1328,12 @@ parsebackq: {
if (needprompt) {
setprompt(2);
}
- switch (pc = pgetc()) {
+ switch (pc = pgetc_eatbnl()) {
case '`':
goto done;
case '\\':
- if ((pc = pgetc()) == '\n') {
- nlprompt();
- /*
- * If eating a newl...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...& eofmark == NULL)
+ if (synstack->syntax != BASESYNTAX && eofmark == NULL)
synerror("Unterminated quoted string");
- if (varnest != 0) {
+ if (synstack->varnest != 0) {
/* { */
synerror("Missing '}'");
}
@@ -1202,6 +1234,8 @@ parsesub: {
PARSEBACKQNEW();
}
} else {
+ const char *newsyn = synstack->syntax;
+
USTPUTC(CTLVAR, out);
typeloc = out - (char *)stackblock();
STADJUST(1, out);
@@ -1252,6 +1286,8 @@ varname:
}
if (subtype == 0) {
+ int cc = c;
+
switch (c) {
case ':':
subtype = VSNUL;
@@...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...& eofmark == NULL)
+ if (synstack->syntax != BASESYNTAX && eofmark == NULL)
synerror("Unterminated quoted string");
- if (varnest != 0) {
+ if (synstack->varnest != 0) {
/* { */
synerror("Missing '}'");
}
@@ -1202,6 +1234,8 @@ parsesub: {
PARSEBACKQNEW();
}
} else {
+ const char *newsyn = synstack->syntax;
+
USTPUTC(CTLVAR, out);
typeloc = out - (char *)stackblock();
STADJUST(1, out);
@@ -1252,6 +1286,8 @@ varname:
}
if (subtype == 0) {
+ int cc = c;
+
switch (c) {
case ':':
subtype = VSNUL;
@@...