search for: synstack

Displaying 10 results from an estimated 10 matches for "synstack".

2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...ion */ #define EXP_QUOTED 0x100 /* expand word in double quotes */ diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 8b945e36..c28363ca 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -80,6 +80,18 @@ struct heredoc { int striptabs; /* if set, strip leading tabs */ }; +struct synstack { + const char *syntax; + struct synstack *prev; + struct synstack *next; + int innerdq; + int varpushed; + int dblquote; + int varnest; /* levels of variables expansion */ + int parenlevel; /* levels of parens in arithmetic */ + int dqvarnest; /* levels of variables expansion within double quot...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...ion */ #define EXP_QUOTED 0x100 /* expand word in double quotes */ diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 8b945e36..c28363ca 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -80,6 +80,18 @@ struct heredoc { int striptabs; /* if set, strip leading tabs */ }; +struct synstack { + const char *syntax; + struct synstack *prev; + struct synstack *next; + int innerdq; + int varpushed; + int dblquote; + int varnest; /* levels of variables expansion */ + int parenlevel; /* levels of parens in arithmetic */ + int dqvarnest; /* levels of variables expansion within double quot...
2019 Jan 25
0
[klibc:update-dash] parser: Fix incorrect eating of backslash newlines
...57ee59 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Fri, 11 May 2018 23:41:25 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] parser: Fix incorrect eating of backslash newlines With the introduction of synstack->syntax, a number of references to the syntax variable was missed during the conversion. This causes backslash newlines to be incorrectly removed in single quote context. This patch also combines these calls into a new helper function pgetc_top. Fixes: ab1cecb40478 ("parser: Add syntax s...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix incorrect eating of backslash newlines
...> AuthorDate: Fri, 11 May 2018 23:41:25 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: parser: Fix incorrect eating of backslash newlines [ dash commit 469c5fd4f57622b1a6571172898ab29430319d4a ] With the introduction of synstack->syntax, a number of references to the syntax variable was missed during the conversion. This causes backslash newlines to be incorrectly removed in single quote context. This patch also combines these calls into a new helper function pgetc_top. Fixes: ab1cecb40478 ("parser: Add syntax s...
2019 Jan 25
0
[klibc:update-dash] parser: Fix parameter expansion inside inner double quotes
.../dash/parser.c b/usr/dash/parser.c index efa8060f..8e407816 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1325,10 +1325,11 @@ badsub: pungetc(); } - if (newsyn == ARISYNTAX && subtype > VSNORMAL) + if (newsyn == ARISYNTAX) newsyn = DQSYNTAX; - if (newsyn != synstack->syntax) { + if ((newsyn != synstack->syntax || synstack->innerdq) && + subtype != VSNORMAL) { synstack_push(&synstack, synstack->prev ?: alloca(sizeof(*synstack)),
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix parameter expansion inside inner double quotes
.../dash/parser.c b/usr/dash/parser.c index efa8060f..8e407816 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1325,10 +1325,11 @@ badsub: pungetc(); } - if (newsyn == ARISYNTAX && subtype > VSNORMAL) + if (newsyn == ARISYNTAX) newsyn = DQSYNTAX; - if (newsyn != synstack->syntax) { + if ((newsyn != synstack->syntax || synstack->innerdq) && + subtype != VSNORMAL) { synstack_push(&synstack, synstack->prev ?: alloca(sizeof(*synstack)),
2019 Jan 25
0
[klibc:update-dash] parser: Allow newlines within parameter substitution
...n(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index ae76400e..6a8a4a43 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -924,7 +924,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ switch(synstack->syntax[c]) { case CNL: /* '\n' */ - if (synstack->syntax == BASESYNTAX) + if (synstack->syntax == BASESYNTAX && + !synstack->varnest) goto endword; /* exit outer loop */ USTPUTC(c, out); nlprompt();
2020 Mar 28
0
[klibc:update-dash] dash: parser: Allow newlines within parameter substitution
...n(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index ae76400e..6a8a4a43 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -924,7 +924,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ switch(synstack->syntax[c]) { case CNL: /* '\n' */ - if (synstack->syntax == BASESYNTAX) + if (synstack->syntax == BASESYNTAX && + !synstack->varnest) goto endword; /* exit outer loop */ USTPUTC(c, out); nlprompt();
2019 Jan 25
0
[klibc:update-dash] parser: Fix single-quoted patterns in here-documents
...iff --git a/usr/dash/parser.c b/usr/dash/parser.c index c28363ca..cd980941 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -934,7 +934,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(c, out); break; case CCTL: - if (eofmark == NULL || synstack->dblquote) + if ((!eofmark) | synstack->dblquote | + synstack->varnest) USTPUTC(CTLESC, out); USTPUTC(c, out); break;
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix single-quoted patterns in here-documents
...iff --git a/usr/dash/parser.c b/usr/dash/parser.c index c28363ca..cd980941 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -934,7 +934,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(c, out); break; case CCTL: - if (eofmark == NULL || synstack->dblquote) + if ((!eofmark) | synstack->dblquote | + synstack->varnest) USTPUTC(CTLESC, out); USTPUTC(c, out); break;