aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Aparício <aparicio99@gmail.com>2012-07-20 03:25:32 +0100
committerAndré Aparício <aparicio99@gmail.com>2012-08-03 01:03:41 +0100
commit14db07b33b4a2df8ede5b8f7b7cda89004009d8d (patch)
tree1b6168206f04377d98341debd76323537372b58d
parentParser&Walker: Escape '[' and ']' (diff)
downloadlibbash-14db07b33b4a2df8ede5b8f7b7cda89004009d8d.tar.gz
libbash-14db07b33b4a2df8ede5b8f7b7cda89004009d8d.tar.bz2
libbash-14db07b33b4a2df8ede5b8f7b7cda89004009d8d.zip
Parser&Walker: Escape '
-rw-r--r--bashast/bashast.g3
-rw-r--r--bashast/libbashWalker.g1
-rw-r--r--scripts/command_execution.bash2
3 files changed, 4 insertions, 2 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 61c7e57..4438b8c 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -786,7 +786,7 @@ ns_string_part
|OTHER|EQUALS|PCT|PCTPCT|PLUS|MINUS|DOT|DOTDOT|COLON
|TILDE|LSQUARE|RSQUARE|CARET|POUND|COMMA|EXPORT|LOCAL|DECLARE|AT
// Escaped characters
- |ESC_RPAREN|ESC_LPAREN|ESC_RSQUARE|ESC_LSQUARE|ESC_DOLLAR|ESC_GT|ESC_LT|ESC_TICK|ESC_DQUOTE
+ |ESC_RPAREN|ESC_LPAREN|ESC_RSQUARE|ESC_LSQUARE|ESC_DOLLAR|ESC_GT|ESC_LT|ESC_TICK|ESC_DQUOTE|ESC_SQUOTE
// The following is for filename expansion
|TIMES|QMARK;
@@ -1129,6 +1129,7 @@ SEMIC : ';';
DOUBLE_SEMIC : ';;';
PIPE : '|';
ESC_DQUOTE : '\\"';
+ESC_SQUOTE : { !double_quoted }? => '\\\'';
DQUOTE : '"' { if(LA(-1) != '\\') double_quoted = !double_quoted; };
SQUOTE : { double_quoted }? => '\'';
SINGLE_QUOTED_STRING_TOKEN : { !double_quoted }? => '\'' .* '\'';
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g
index 9c85f9d..34a7660 100644
--- a/bashast/libbashWalker.g
+++ b/bashast/libbashWalker.g
@@ -466,6 +466,7 @@ options {backtrack = true;}
|ESC_LSQUARE { $libbash_value = "["; }
|ESC_DOLLAR { $libbash_value = "$"; }
|ESC_DQUOTE { $libbash_value = "\""; }
+ |ESC_SQUOTE { $libbash_value = "'"; }
|ESC_GT { $libbash_value = ">"; }
|ESC_LT { $libbash_value = "<"; }
|ESC_TICK { $libbash_value = "`"; }
diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash
index 1cc837b..c526d75 100644
--- a/scripts/command_execution.bash
+++ b/scripts/command_execution.bash
@@ -96,7 +96,7 @@ eval abc+=\( \"\$@\" \)
declare MOZILLA_FIVE_HOME="/usr/share/${PN}"
declare foo=23 empty bar=42
echo $MOZILLA_FIVE_HOME $foo $lol $bar
-echo \(\)\[\]\$\"\>
+echo \(\)\[\]\$\"\>\'
FILE=scripts/input_output_test
echo foo > $FILE