Displaying 15 results from an estimated 15 matches for "pgetc_eatbnl".
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
.../?p=libs/klibc/klibc.git;a=commit;h=acd0936c5f8b4f5d94065ca46714d17e6a882cf2
Author: Harald van Dijk <harald at gigawatt.nl>
AuthorDate: Thu, 8 Mar 2018 08:37:11 +0100
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000
[klibc] parser: use pgetc_eatbnl() in more places
dash has a pgetc_eatbnl function in parser.c which skips any
backslash-newline combinations. It's not used everywhere it could be.
There is also some duplicated backslash-newline handling elsewhere in
parser.c. Replace most of the calls to pgetc() with calls to
pgetc_eatbnl()...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...bs/klibc/klibc.git;a=commit;h=a4659bfa776f24f790c3ec071c5c9ef9459cdb70
Author: Harald van Dijk <harald at gigawatt.nl>
AuthorDate: Thu, 8 Mar 2018 08:37:11 +0100
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:54 +0000
[klibc] dash: parser: use pgetc_eatbnl() in more places
[ dash commit 6bbc71d84bea101370830dc3272f51c5ec1a7a78 ]
dash has a pgetc_eatbnl function in parser.c which skips any
backslash-newline combinations. It's not used everywhere it could be.
There is also some duplicated backslash-newline handling elsewhere in
parser.c. Replace...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Handle backslash newlines properly after dollar sign
...sh/parser.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 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[] = "}-+?="...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Handle backslash newlines properly after dollar sign
...sh/parser.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 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[] = "}-+?="...
2019 Jan 25
0
[klibc:update-dash] parser: Fix incorrect eating of backslash newlines
...Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/parser.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 8e407816..8bd3db44 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -853,6 +853,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 cons...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix incorrect eating of backslash newlines
...Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/parser.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 8e407816..8bd3db44 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -853,6 +853,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 cons...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...lquote;
+ int varnest; /* levels of variables expansion */
+ int parenlevel; /* levels of parens in arithmetic */
+ int dqvarnest; /* levels of variables expansion within double quotes */
+};
+
struct heredoc *heredoclist; /* list of here documents to read */
@@ -841,6 +853,21 @@ static int pgetc_eatbnl(void)
return c;
}
+static void synstack_push(struct synstack **stack, struct synstack *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 s...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...lquote;
+ int varnest; /* levels of variables expansion */
+ int parenlevel; /* levels of parens in arithmetic */
+ int dqvarnest; /* levels of variables expansion within double quotes */
+};
+
struct heredoc *heredoclist; /* list of here documents to read */
@@ -841,6 +853,21 @@ static int pgetc_eatbnl(void)
return c;
}
+static void synstack_push(struct synstack **stack, struct synstack *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 s...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Catch variable length expansions on non-existant specials
...adent.org.uk>
---
usr/dash/parser.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 382ddf24..382658e7 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1229,8 +1229,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- }
- else if (is_special(c)) {
+ } else {
int cc = c;
c = pgetc_eatbnl();
@@ -1251,10 +1250,14 @@ varname:
}
}
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
}
- e...
2019 Jan 25
0
[klibc:update-dash] parser: Fix parsing of ${}
...at decadent.org.uk>
---
usr/dash/parser.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 6a8a4a43..efa8060f 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1262,7 +1262,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- } else {
+ } else if (c != '}') {
int cc = c;
c = pgetc_eatbnl();
@@ -1290,7 +1290,8 @@ varname:
}
USTPUTC(cc, out);
- }
+ } else
+ goto badsub;
if (subtype == 0) {
int cc = c;
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Catch variable length expansions on non-existant specials
...adent.org.uk>
---
usr/dash/parser.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 382ddf24..382658e7 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1229,8 +1229,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- }
- else if (is_special(c)) {
+ } else {
int cc = c;
c = pgetc_eatbnl();
@@ -1251,10 +1250,14 @@ varname:
}
}
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
}
- e...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix parsing of ${}
...at decadent.org.uk>
---
usr/dash/parser.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 6a8a4a43..efa8060f 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1262,7 +1262,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- } else {
+ } else if (c != '}') {
int cc = c;
c = pgetc_eatbnl();
@@ -1290,7 +1290,8 @@ varname:
}
USTPUTC(cc, out);
- }
+ } else
+ goto badsub;
if (subtype == 0) {
int cc = c;
2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...;\n') {
- plinno++;
- if (doprompt)
- setprompt(2);
+ nlprompt();
continue;
}
pungetc();
goto breakloop;
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);
- p...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...;\n') {
- plinno++;
- if (doprompt)
- setprompt(2);
+ nlprompt();
continue;
}
pungetc();
goto breakloop;
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);
- p...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Only accept single-digit parameter expansion outside of braces
...decadent.org.uk>
---
usr/dash/parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index 4bda42e8..b318b085 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1268,7 +1268,7 @@ varname:
do {
STPUTC(c, out);
c = pgetc_eatbnl();
- } while (is_digit(c));
+ } while (!subtype && is_digit(c));
} else if (c != '}') {
int cc = c;