Excise use of parser_t's error() functionality. Thread a

parse_error_list_t through all of the expand functions, enabling them to
report errors more directly. Improve aspects of error reporting for
expansion failures.
This commit is contained in:
ridiculousfish
2014-03-21 17:13:33 -07:00
parent c71b168402
commit ad6367018b
12 changed files with 221 additions and 152 deletions

View File

@@ -241,12 +241,6 @@ class parser_t
/** Whether or not we output errors */
const bool show_errors;
/** Last error code */
int error_code;
/** Position of last error */
int err_pos;
/** Indication that we should skip all blocks */
bool cancellation_requested;
@@ -317,7 +311,7 @@ class parser_t
\return 0 on success, 1 otherwise
*/
int eval(const wcstring &cmd_str, const io_chain_t &io, enum block_type_t block_type);
int eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type);
/** Evaluates a block node at the given node offset in the topmost execution context */
int eval_block_node(node_offset_t node_idx, const io_chain_t &io, enum block_type_t block_type);
@@ -332,15 +326,6 @@ class parser_t
*/
void expand_argument_list(const wcstring &arg_src, std::vector<completion_t> &output);
/**
Sets the current evaluation error. This function should only be used by libraries that are called by
\param ec The new error code
\param p The character offset at which the error occured
\param str The printf-style error message filter
*/
void error(int ec, size_t p, const wchar_t *str, ...);
/**
Returns a string describing the current parser pisition in the format 'FILENAME (line LINE_NUMBER): LINE'.
Example: