aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_util.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-06 14:34:53 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-07-06 14:34:53 -0700
commit345a52862587210477f8e5a9a41c21c26a265009 (patch)
tree9ac5160fdd6a08b429dc946be839445d2f87d26c /parse_util.h
parent01d8490255764855fbf4d3e39995d061b3e69bfe (diff)
Untangle unescaping responsibilities in highlight.cpp. Fix cd autosuggestions to properly handle quotes. Factor out some of the quote unescaping behavior from reader.cpp to parse_util.cpp.
Add some autosuggestion tests
Diffstat (limited to 'parse_util.h')
-rw-r--r--parse_util.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/parse_util.h b/parse_util.h
index 241790cc..a3ffc193 100644
--- a/parse_util.h
+++ b/parse_util.h
@@ -124,6 +124,21 @@ void parse_util_set_argv( const wchar_t * const *argv, const wcstring_list_t &na
*/
wchar_t *parse_util_unescape_wildcards( const wchar_t *in );
+/**
+ Calculates information on the parameter at the specified index.
+
+ \param cmd The command to be analyzed
+ \param pos An index in the string which is inside the parameter
+ \param quote If not NULL, store the type of quote this parameter has, can be either ', " or \\0, meaning the string is not quoted.
+ \param offset If not NULL, get_param will store the offset to the beginning of the parameter.
+ \param type If not NULL, get_param will store the token type as returned by tok_last.
+*/
+void parse_util_get_parameter_info( const wcstring &cmd, const size_t pos, wchar_t *quote, size_t *offset, int *type );
+
+/**
+ Attempts to escape the string 'cmd' using the given quote type, as determined by the quote character. The quote can be a single quote or double quote, or L'\0' to indicate no quoting (and thus escaping should be with backslashes).
+*/
+wcstring parse_util_escape_string_with_quote( const wcstring &cmd, wchar_t quote);
#endif