search for: peektoken

Displaying 5 results from an estimated 5 matches for "peektoken".

2019 Jan 25
0
[klibc:update-dash] [PARSER] Simplify EOF/newline handling in list parser
...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 | CHKKWD | CHKALIAS; - if (nlflag == 2 && tokendlist[peektoken()]) - return NULL; n1 = NULL; for (;;) { + switch (peektoken()) { + case TNL: + if (!(nlflag & 1)) + break; + parseheredoc(); + return n1; + + case TEOF: + if (!n1 && (nlflag & 1)) + n1 = NEOF; + parseheredoc(); + return n1; + } + + checkkwd = CHKNL | CHK...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Simplify EOF/newline handling in list parser
...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 | CHKKWD | CHKALIAS; - if (nlflag == 2 && tokendlist[peektoken()]) - return NULL; n1 = NULL; for (;;) { + switch (peektoken()) { + case TNL: + if (!(nlflag & 1)) + break; + parseheredoc(); + return n1; + + case TEOF: + if (!n1 && (nlflag & 1)) + n1 = NEOF; + parseheredoc(); + return n1; + } + + checkkwd = CHKNL | CHK...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Do not push token back before parseheredoc
...19 Nov 2018 18:43:58 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: parser: Do not push token back before parseheredoc [ dash commit 2c3ba509eb8117894d515e8fffc94aa099f38f8a ] When we read the first token in list() we use peektoken instead of readtoken as the following code needs to use the same token again. However, this is wrong when we're in a here-document as it will clobber the saved token without resetting the tokpushback flag. This patch fixes it by doing the tokpushback after parseheredoc and setting lasttoken a...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...+++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/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 @@ p...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...+++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/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 @@ p...