parse “$( (( … ) … ) … )” correctly (LP#1532621)
This commit is contained in:
parent
2492c5692b
commit
0a1f594503
6
lex.c
6
lex.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
* 2011, 2012, 2013, 2014, 2015
|
* 2011, 2012, 2013, 2014, 2015, 2016
|
||||||
* mirabilos <m@mirbsd.org>
|
* mirabilos <m@mirbsd.org>
|
||||||
*
|
*
|
||||||
* Provided that these terms and disclaimer and all copyright notices
|
* Provided that these terms and disclaimer and all copyright notices
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.214 2015/12/12 19:05:52 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.215 2016/01/14 19:52:20 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* states while lexing word
|
* states while lexing word
|
||||||
@ -777,6 +777,7 @@ yylex(int cf)
|
|||||||
Source *s;
|
Source *s;
|
||||||
|
|
||||||
ungetsc(c2);
|
ungetsc(c2);
|
||||||
|
ungetsc(c);
|
||||||
/*
|
/*
|
||||||
* mismatched parenthesis -
|
* mismatched parenthesis -
|
||||||
* assume we were really
|
* assume we were really
|
||||||
@ -789,6 +790,7 @@ yylex(int cf)
|
|||||||
s->start = s->str = s->u.freeme = dp;
|
s->start = s->str = s->u.freeme = dp;
|
||||||
s->next = source;
|
s->next = source;
|
||||||
source = s;
|
source = s;
|
||||||
|
ungetsc('('/*)*/);
|
||||||
return ('('/*)*/);
|
return ('('/*)*/);
|
||||||
}
|
}
|
||||||
} else if (c == '(')
|
} else if (c == '(')
|
||||||
|
5
syn.c
5
syn.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
* 2011, 2012, 2013, 2014, 2015
|
* 2011, 2012, 2013, 2014, 2015, 2016
|
||||||
* mirabilos <m@mirbsd.org>
|
* mirabilos <m@mirbsd.org>
|
||||||
*
|
*
|
||||||
* Provided that these terms and disclaimer and all copyright notices
|
* Provided that these terms and disclaimer and all copyright notices
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.107 2015/12/12 21:03:53 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.108 2016/01/14 19:52:20 tg Exp $");
|
||||||
|
|
||||||
struct nesting_state {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@ -400,6 +400,7 @@ get_command(int cf)
|
|||||||
case LWORD:
|
case LWORD:
|
||||||
break;
|
break;
|
||||||
case '(': /*)*/
|
case '(': /*)*/
|
||||||
|
c = '(';
|
||||||
goto Subshell;
|
goto Subshell;
|
||||||
default:
|
default:
|
||||||
syntaxerr(NULL);
|
syntaxerr(NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user