mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 11:21:15 -03:00
Rename Rust-side parser_t/io_streams_t to Parser/IoStreams
This reduces noise in the upcoming "Port execution" commit. I accidentally made IoStreams a "class" instead of a "struct". Would be easy to correct that but this will be deleted soon, so I don't think we care.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
class autoload_file_cache_t;
|
||||
class environment_t;
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
struct autoload_tester_t;
|
||||
|
||||
/// autoload_t is a class that knows how to autoload .fish files from a list of directories. This
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#include "maybe.h"
|
||||
#include "wutil.h"
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class proc_status_t;
|
||||
class output_stream_t;
|
||||
struct io_streams_t;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
using completion_list_t = std::vector<completion_t>;
|
||||
|
||||
/// Data structure to describe a builtin.
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
maybe_t<int> builtin_bind(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_commandline(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_complete(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_disown(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_eval(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_fg(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_history(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "../io.h"
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
maybe_t<int> builtin_jobs(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_read(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
maybe_t<int> builtin_set(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_source(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "../wgetopt.h"
|
||||
#include "../wutil.h" // IWYU pragma: keep
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
/// Struct describing a resource limit.
|
||||
struct resource_t {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "../maybe.h"
|
||||
|
||||
class parser_t;
|
||||
struct io_streams_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
|
||||
maybe_t<int> builtin_ulimit(parser_t &parser, io_streams_t &streams, const wchar_t **argv);
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ struct completion_mode_t {
|
||||
/// Character that separates the completion and description on programmable completions.
|
||||
#define PROG_COMPLETE_SEP L'\t'
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
enum {
|
||||
/// Do not insert space afterwards if this is the only completion. (The default is to try insert
|
||||
|
||||
@@ -201,7 +201,7 @@ class null_environment_t : public environment_t {
|
||||
|
||||
/// A mutable environment which allows scopes to be pushed and popped.
|
||||
class env_stack_t final : public environment_t {
|
||||
friend class parser_t;
|
||||
friend class Parser;
|
||||
|
||||
/// \return whether we are the principal stack.
|
||||
bool is_principal() const;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "global_safety.h"
|
||||
#include "wutil.h"
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
#if INCLUDE_RUST_HEADERS
|
||||
#include "event.rs.h"
|
||||
#else
|
||||
@@ -32,7 +32,7 @@ struct Event;
|
||||
// TODO: Remove after porting functions.cpp
|
||||
extern const wchar_t *const event_filter_names[];
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
void event_fire_generic(parser_t &parser, const wcstring &name,
|
||||
const std::vector<wcstring> &args = g_empty_string_list);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "io.h"
|
||||
#include "proc.h"
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
/// Execute the processes specified by \p j in the parser \p.
|
||||
/// On a true return, the job was successfully launched and the parser will take responsibility for
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "maybe.h"
|
||||
|
||||
struct function_properties_t;
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
#if INCLUDE_RUST_HEADERS
|
||||
#include "function.rs.h"
|
||||
|
||||
@@ -115,7 +115,7 @@ void highlight_shell(const wcstring &buffstr, std::vector<highlight_spec_t> &col
|
||||
const operation_context_t &ctx, bool io_ok = false,
|
||||
maybe_t<size_t> cursor = {});
|
||||
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
/// Wrapper around colorize(highlight_shell)
|
||||
wcstring colorize_shell(const wcstring &text, parser_t &parser);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "maybe.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
struct io_streams_t;
|
||||
class IoStreams; using io_streams_t = IoStreams;
|
||||
class env_stack_t;
|
||||
class environment_t;
|
||||
class operation_context_t;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#define DEFAULT_BIND_MODE L"default"
|
||||
|
||||
class event_queue_peeker_t;
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
wcstring describe_char(wint_t c);
|
||||
|
||||
|
||||
15
src/io.h
15
src/io.h
@@ -473,7 +473,11 @@ class buffered_output_stream_t final : public output_stream_t {
|
||||
std::shared_ptr<io_buffer_t> buffer_;
|
||||
};
|
||||
|
||||
struct io_streams_t : noncopyable_t {
|
||||
class IoStreams;
|
||||
using io_streams_t = IoStreams;
|
||||
|
||||
class IoStreams : noncopyable_t {
|
||||
public:
|
||||
// Streams for out and err.
|
||||
output_stream_t &out;
|
||||
output_stream_t &err;
|
||||
@@ -505,13 +509,13 @@ struct io_streams_t : noncopyable_t {
|
||||
// FIXME: this is awkwardly placed.
|
||||
std::shared_ptr<job_group_t> job_group{};
|
||||
|
||||
io_streams_t(output_stream_t &out, output_stream_t &err) : out(out), err(err) {}
|
||||
virtual ~io_streams_t() = default;
|
||||
IoStreams(output_stream_t &out, output_stream_t &err) : out(out), err(err) {}
|
||||
virtual ~IoStreams() = default;
|
||||
|
||||
/// autocxx junk.
|
||||
output_stream_t &get_out() { return out; };
|
||||
output_stream_t &get_err() { return err; };
|
||||
io_streams_t(const io_streams_t &) = delete;
|
||||
IoStreams(const io_streams_t &) = delete;
|
||||
bool get_out_redirected() { return out_is_redirected; };
|
||||
bool get_err_redirected() { return err_is_redirected; };
|
||||
bool ffi_stdin_is_directly_redirected() const { return stdin_is_directly_redirected; };
|
||||
@@ -519,7 +523,8 @@ struct io_streams_t : noncopyable_t {
|
||||
};
|
||||
|
||||
/// FFI helper.
|
||||
struct owning_io_streams_t : io_streams_t {
|
||||
class owning_io_streams_t : public io_streams_t {
|
||||
public:
|
||||
string_output_stream_t out_storage;
|
||||
null_output_stream_t err_storage;
|
||||
owning_io_streams_t() : io_streams_t(out_storage, err_storage) {}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "common.h"
|
||||
|
||||
class environment_t;
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
struct job_group_t;
|
||||
|
||||
/// A common helper which always returns false.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
class block_t;
|
||||
class operation_context_t;
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
/// An eval_result represents evaluation errors including wildcards which failed to match, syntax
|
||||
/// errors, or other expansion errors. It also tracks when evaluation was skipped due to signal
|
||||
|
||||
@@ -40,7 +40,7 @@ static wcstring user_presentable_path(const wcstring &path, const environment_t
|
||||
return replace_home_directory_with_tilde(path, vars);
|
||||
}
|
||||
|
||||
parser_t::parser_t(std::shared_ptr<env_stack_t> vars, bool is_principal)
|
||||
parser_t::Parser(std::shared_ptr<env_stack_t> vars, bool is_principal)
|
||||
: wait_handles(new_wait_handle_store_ffi()),
|
||||
variables(std::move(vars)),
|
||||
is_principal_(is_principal) {
|
||||
@@ -54,7 +54,7 @@ parser_t::parser_t(std::shared_ptr<env_stack_t> vars, bool is_principal)
|
||||
}
|
||||
|
||||
// Out of line destructor to enable forward declaration of parse_execution_context_t
|
||||
parser_t::~parser_t() = default;
|
||||
parser_t::~Parser() = default;
|
||||
|
||||
parser_t &parser_t::principal_parser() {
|
||||
static const std::shared_ptr<parser_t> principal{
|
||||
@@ -590,7 +590,8 @@ eval_res_t parser_t::eval_with(const wcstring &cmd, const io_chain_t &io,
|
||||
|
||||
eval_res_t parser_t::eval_string_ffi1(const wcstring &cmd) { return eval(cmd, io_chain_t()); }
|
||||
|
||||
eval_res_t parser_t::eval_parsed_source_ffi1(const parsed_source_ref_t* ps, enum block_type_t block_type) {
|
||||
eval_res_t parser_t::eval_parsed_source_ffi1(const parsed_source_ref_t *ps,
|
||||
enum block_type_t block_type) {
|
||||
return eval_parsed_source(*ps, io_chain_t(), {}, block_type);
|
||||
}
|
||||
|
||||
@@ -698,8 +699,8 @@ template eval_res_t parser_t::eval_node(const parsed_source_ref_t &, const ast::
|
||||
template eval_res_t parser_t::eval_node(const parsed_source_ref_t &, const ast::job_list_t &,
|
||||
const io_chain_t &, const job_group_ref_t &, block_type_t);
|
||||
|
||||
void parser_t::get_backtrace_ffi(const wcstring &src, const parse_error_list_t* errors,
|
||||
wcstring &output) const {
|
||||
void parser_t::get_backtrace_ffi(const wcstring &src, const parse_error_list_t *errors,
|
||||
wcstring &output) const {
|
||||
return get_backtrace(src, *errors, output);
|
||||
};
|
||||
void parser_t::get_backtrace(const wcstring &src, const parse_error_list_t &errors,
|
||||
|
||||
20
src/parser.h
20
src/parser.h
@@ -29,7 +29,6 @@ class autoclose_fd_t;
|
||||
class io_chain_t;
|
||||
struct Event;
|
||||
struct job_group_t;
|
||||
class parser_t;
|
||||
|
||||
/// Types of blocks.
|
||||
enum class block_type_t : uint8_t {
|
||||
@@ -258,7 +257,10 @@ enum class parser_status_var_t : uint8_t {
|
||||
count_,
|
||||
};
|
||||
|
||||
class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
class Parser;
|
||||
using parser_t = Parser;
|
||||
|
||||
class Parser : public std::enable_shared_from_this<parser_t> {
|
||||
friend class parse_execution_context_t;
|
||||
|
||||
private:
|
||||
@@ -310,12 +312,12 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
bool is_command_substitution() const;
|
||||
|
||||
/// Create a parser
|
||||
parser_t(std::shared_ptr<env_stack_t> vars, bool is_principal = false);
|
||||
Parser(std::shared_ptr<env_stack_t> vars, bool is_principal = false);
|
||||
|
||||
public:
|
||||
// No copying allowed.
|
||||
parser_t(const parser_t &) = delete;
|
||||
parser_t &operator=(const parser_t &) = delete;
|
||||
Parser(const parser_t &) = delete;
|
||||
Parser &operator=(const parser_t &) = delete;
|
||||
|
||||
/// Get the "principal" parser, whatever that is.
|
||||
static parser_t &principal_parser();
|
||||
@@ -349,7 +351,7 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
eval_res_t eval_parsed_source(const parsed_source_ref_t &ps, const io_chain_t &io,
|
||||
const job_group_ref_t &job_group = {},
|
||||
block_type_t block_type = block_type_t::top);
|
||||
eval_res_t eval_parsed_source_ffi1(const parsed_source_ref_t* ps, block_type_t block_type);
|
||||
eval_res_t eval_parsed_source_ffi1(const parsed_source_ref_t *ps, block_type_t block_type);
|
||||
/// Evaluates a node.
|
||||
/// The node type must be ast_t::statement_t or ast::job_list_t.
|
||||
template <typename T>
|
||||
@@ -466,8 +468,8 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
/// Output profiling data to the given filename.
|
||||
void emit_profiling(const char *path) const;
|
||||
|
||||
void get_backtrace_ffi(const wcstring &src, const parse_error_list_t* errors,
|
||||
wcstring &output) const;
|
||||
void get_backtrace_ffi(const wcstring &src, const parse_error_list_t *errors,
|
||||
wcstring &output) const;
|
||||
void get_backtrace(const wcstring &src, const parse_error_list_t &errors,
|
||||
wcstring &output) const;
|
||||
|
||||
@@ -527,7 +529,7 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
/// autocxx junk.
|
||||
size_t ffi_blocks_size() const;
|
||||
|
||||
~parser_t();
|
||||
~Parser();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -362,7 +362,7 @@ class process_t {
|
||||
|
||||
using process_ptr_t = std::unique_ptr<process_t>;
|
||||
using process_list_t = std::vector<process_ptr_t>;
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
struct RustFFIProcList {
|
||||
process_ptr_t *procs;
|
||||
|
||||
@@ -22,7 +22,7 @@ class env_stack_t;
|
||||
class environment_t;
|
||||
class history_t;
|
||||
class io_chain_t;
|
||||
class parser_t;
|
||||
class Parser; using parser_t = Parser;
|
||||
|
||||
/// An edit action that can be undone.
|
||||
struct edit_t {
|
||||
|
||||
Reference in New Issue
Block a user