Displaying 13 results from an estimated 13 matches for "firstc".
Did you mean:
first
2012 Oct 01
0
[klibc:master] Avoid overflow for very long variable name
...0000040c970 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 in cmdlo...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...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 dqvarnest; /*...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...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 dqvarnest; /*...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...readtoken1(c, BASESYNTAX, (char *)NULL, 0);
#undef RETURN
}
@@ -836,7 +830,7 @@ static int pgetc_eatbnl(void)
int c;
while ((c = pgetc()) == '\\') {
- if (pgetc() != '\n') {
+ if (pgetc2() != '\n') {
pungetc();
break;
}
@@ -903,7 +897,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
attyline();
if (syntax == BASESYNTAX)
return readtoken();
- c = pgetc();
+ c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
goto loop;
}
#endif
@@ -916,7 +910,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark,...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...readtoken1(c, BASESYNTAX, (char *)NULL, 0);
#undef RETURN
}
@@ -836,7 +830,7 @@ static int pgetc_eatbnl(void)
int c;
while ((c = pgetc()) == '\\') {
- if (pgetc() != '\n') {
+ if (pgetc2() != '\n') {
pungetc();
break;
}
@@ -903,7 +897,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
attyline();
if (syntax == BASESYNTAX)
return readtoken();
- c = pgetc();
+ c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl();
goto loop;
}
#endif
@@ -916,7 +910,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark,...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Add nlprompt/nlnoprompt helpers
...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 CWORD:
@@ -9...
2019 Jan 25
0
[klibc:update-dash] parser: Fix incorrect eating of backslash newlines
...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, char cons...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Add nlprompt/nlnoprompt helpers
...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 CWORD:
@@ -9...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix incorrect eating of backslash newlines
...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, char cons...
2019 Jan 25
0
[klibc:update-dash] parser: Fix single-quoted patterns in here-documents
...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
...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 &&
+ !synstack-&g...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix single-quoted patterns in here-documents
...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
...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 &&
+ !synstack-&g...