search for: readtoken1

Displaying 15 results from an estimated 15 matches for "readtoken1".

2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
.../usr/dash/parser.c b/usr/dash/parser.c index 382658e7..8b945e36 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -106,6 +106,7 @@ STATIC void parseheredoc(void); STATIC int peektoken(void); STATIC int readtoken(void); STATIC int xxreadtoken(void); +STATIC int pgetc_eatbnl(); STATIC int readtoken1(int, char const *, char *, int); STATIC void synexpect(int) __attribute__((__noreturn__)); STATIC void synerror(const char *) __attribute__((__noreturn__)); @@ -656,8 +657,10 @@ parseheredoc(void) if (needprompt) { setprompt(2); } - readtoken1(pgetc(), here->here->type == NHERE?...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
.../usr/dash/parser.c b/usr/dash/parser.c index 382658e7..8b945e36 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -106,6 +106,7 @@ STATIC void parseheredoc(void); STATIC int peektoken(void); STATIC int readtoken(void); STATIC int xxreadtoken(void); +STATIC int pgetc_eatbnl(); STATIC int readtoken1(int, char const *, char *, int); STATIC void synexpect(int) __attribute__((__noreturn__)); STATIC void synerror(const char *) __attribute__((__noreturn__)); @@ -656,8 +657,10 @@ parseheredoc(void) if (needprompt) { setprompt(2); } - readtoken1(pgetc(), here->here->type == NHERE?...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...nstack *next, + const char *syntax) +{ + memset(next, 0, sizeof(*next)); + next->syntax = syntax; + next->next = *stack; + (*stack)->prev = next; + *stack = next; +} + +static void synstack_pop(struct synstack **stack) +{ + *stack = (*stack)->next; +} + /* @@ -870,24 +897,15 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) size_t len; struct nodelist *bqlist; int quotef; - int dblquote; - int varnest; /* levels of variables expansion */ - int arinest; /* levels of arithmetic expansion */ - int parenlevel; /* levels of parens in arithmetic */ - int dq...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...nstack *next, + const char *syntax) +{ + memset(next, 0, sizeof(*next)); + next->syntax = syntax; + next->next = *stack; + (*stack)->prev = next; + *stack = next; +} + +static void synstack_pop(struct synstack **stack) +{ + *stack = (*stack)->next; +} + /* @@ -870,24 +897,15 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) size_t len; struct nodelist *bqlist; int quotef; - int dblquote; - int varnest; /* levels of variables expansion */ - int arinest; /* levels of arithmetic expansion */ - int parenlevel; /* levels of parens in arithmetic */ - int dq...
2012 Oct 01
0
[klibc:master] Avoid overflow for very long variable name
...#5 0x000000000040c970 in ckmalloc (nbytes=18446744071562067984) at memalloc.c:57 #6 0x000000000040ca78 in stalloc (nbytes=18446744071562067972) at memalloc.c:132 #7 0x000000000040ece9 in grabstackblock (len=18446744071562067972) at memalloc.h:67 #8 0x00000000004106b5 in readtoken1 (firstc=118, syntax=0x419522 "", eofmark=0x0, striptabs=0) at parser.c:1040 #9 0x00000000004101a4 in xxreadtoken () at parser.c:826 #10 0x000000000040fe1d in readtoken () at parser.c:697 #11 0x000000000040edcc in parsecmd (interact=0) at parser.c:145 #12 0x000000000040c679...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...case '\n': - plinno++; - needprompt = doprompt; + nlnoprompt(); RETURN(TNL); case PEOF: RETURN(TEOF); @@ -837,9 +847,7 @@ static int pgetc_eatbnl(void) break; } - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); } return c; @@ -913,9 +921,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) if (syntax == BASESYNTAX) goto endword; /* exit outer loop */ USTPUTC(c, out); - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); c = pgetc(); goto loop; /* continue outer loop */ case C...
2019 Jan 25
0
[klibc:update-dash] parser: Fix incorrect eating of backslash newlines
...53,11 @@ static int pgetc_eatbnl(void) return c; } +static int pgetc_top(struct synstack *stack) +{ + return stack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); +} + static void synstack_push(struct synstack **stack, struct synstack *next, const char *syntax) { @@ -915,7 +920,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) attyline(); if (synstack->syntax == BASESYNTAX) return readtoken(); - c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); + c = pgetc_top(synstack); goto loop; } #endif @@ -929,7 +934,7 @@ readtoken1(int firstc...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...case '\n': - plinno++; - needprompt = doprompt; + nlnoprompt(); RETURN(TNL); case PEOF: RETURN(TEOF); @@ -837,9 +847,7 @@ static int pgetc_eatbnl(void) break; } - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); } return c; @@ -913,9 +921,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) if (syntax == BASESYNTAX) goto endword; /* exit outer loop */ USTPUTC(c, out); - plinno++; - if (doprompt) - setprompt(2); + nlprompt(); c = pgetc(); goto loop; /* continue outer loop */ case C...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix incorrect eating of backslash newlines
...53,11 @@ static int pgetc_eatbnl(void) return c; } +static int pgetc_top(struct synstack *stack) +{ + return stack->syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); +} + static void synstack_push(struct synstack **stack, struct synstack *next, const char *syntax) { @@ -915,7 +920,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) attyline(); if (synstack->syntax == BASESYNTAX) return readtoken(); - c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); + c = pgetc_top(synstack); goto loop; } #endif @@ -929,7 +934,7 @@ readtoken1(int firstc...
2019 Jan 25
0
[klibc:update-dash] parser: Fix single-quoted patterns in here-documents
....au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --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...
2019 Jan 25
0
[klibc:update-dash] parser: Allow newlines within parameter substitution
....au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 && + !...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix single-quoted patterns in here-documents
....au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --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: Allow newlines within parameter substitution
....au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 && + !...
2020 Mar 28
0
[klibc:master] dash: output: Fix clang warnings about GNU old-style field designator
...... ----------------------------------------------------------------------- Fix the issue bu using C99 initializers instead. This should be safe and should not introduce any compatibility problems as it is done already in other parts of the codebase, like src/expand.c:ccmatch() and src/parser.c::readtoken1(). Signed-off-by: Antonio Ospite <ao2 at ao2.it> Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/output.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/usr/dash/outp...
2006 Jan 08
2
[mips] pipe doesn't work in dash
...be related to the following warnings during compilation but I'm not sure: klibc/arch/mips/syscall.S: Assembler messages: klibc/arch/mips/syscall.S:12: Warning: Macro instruction expanded into multiple instructions in a branch delay slot KLIBCCC dash/parser.o dash/parser.c: In function 'readtoken1': dash/parser.c:1272: warning: 'saveprompt' may be used uninitialized in this function dash/parser.c:849: warning: 'prevsyntax' may be used uninitialized in this function dash/parser.c:842: warning: variable 'quotef' might be clobbered by 'longjmp' or 'vfork&...