diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-09-25 22:29:00 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2007-09-25 22:29:00 +0800 |
commit | 7cfd8be0dc83342b4a71f3a8e5b7efab4670e50c (patch) | |
tree | 58bea2cd50124e8599e4ebdbbd2f622138bdc8c2 /src/TOUR | |
parent | [EXPAND] Do not expand tilde in parameter expansion within quotes (diff) | |
download | dash-7cfd8be0dc83342b4a71f3a8e5b7efab4670e50c.tar.gz dash-7cfd8be0dc83342b4a71f3a8e5b7efab4670e50c.zip |
[EXPAND] Move parse-time quote flag detection to run-time
Because the parser does not recursively parse parameter expansion with respect to quotes, we can't accurately determine quote status at parse time. This patch works around this by moving the quote detection to run-time where we do interpret it recursively. Test case: foo=\\ echo "<${foo#[\\]}>" Old result: <\> New result: <>
Diffstat (limited to '')
-rw-r--r-- | src/TOUR | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/TOUR b/src/TOUR index 0c60e2a..4baac62 100644 --- a/src/TOUR +++ b/src/TOUR @@ -159,7 +159,6 @@ special codes defined in parser.h. The special codes are: CTLVAR Variable substitution CTLENDVAR End of variable substitution CTLBACKQ Command substitution - CTLBACKQ|CTLQUOTE Command substitution inside double quotes CTLESC Escape next character A variable substitution contains the following elements: @@ -179,16 +178,13 @@ stitution. The possible types are: VSASSIGN ${var=text} VSASSIGN|VSNUL ${var=text} -In addition, the type field will have the VSQUOTE flag set if the -variable is enclosed in double quotes. The name of the variable -comes next, terminated by an equals sign. If the type is not -VSNORMAL, then the text field in the substitution follows, ter- -minated by a CTLENDVAR byte. +The name of the variable comes next, terminated by an equals +sign. If the type is not VSNORMAL, then the text field in the +substitution follows, terminated by a CTLENDVAR byte. Commands in back quotes are parsed and stored in a linked list. The locations of these commands in the string are indicated by -CTLBACKQ and CTLBACKQ+CTLQUOTE characters, depending upon whether -the back quotes were enclosed in double quotes. +the CTLBACKQ character. The character CTLESC escapes the next character, so that in case any of the CTL characters mentioned above appear in the input, |