summaryrefslogtreecommitdiff
blob: 4a753d65be81ba252cc9701ab3ef9070ba461fe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00018.html

*** ../bash-4.0/parse.y	2009-01-08 08:29:12.000000000 -0500
--- parse.y	2009-03-03 16:58:50.000000000 -0500
***************
*** 3172,3175 ****
--- 3179,3187 ----
  }
  
+ /* Not exactly right yet, should handle shell metacharacters, too.  If
+    any changes are made to this test, make analogous changes to subst.c:
+    extract_delimited_string(). */
+ #define COMMENT_BEGIN(x)	((x) == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
+ 
  /* Parse a $(...) command substitution.  This is messier than I'd like, and
     reproduces a lot more of the token-reading code than I'd like. */
***************
*** 3365,3369 ****
  	      tflags &= ~LEX_RESWDOK;
  	    }
! 	  else if (shellbreak (ch) == 0)
  {
  	      tflags &= ~LEX_RESWDOK;
--- 3377,3383 ----
  	      tflags &= ~LEX_RESWDOK;
  	    }
! 	  else if MBTEST((tflags & LEX_CKCOMMENT) && COMMENT_BEGIN(ch))
! 	    ;	/* don't turn off LEX_RESWDOK if we're starting a comment */
! 	  else if MBTEST(shellbreak (ch) == 0)
  {
  	      tflags &= ~LEX_RESWDOK;