mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -49,7 +49,7 @@ ErrorOr<void> AK::Formatter<Shell::AST::Command>::format(FormatBuilder& builder,
|
|||
for (auto& redir : value.redirections) {
|
||||
TRY(builder.put_padding(' ', 1));
|
||||
if (redir.is_path_redirection()) {
|
||||
auto path_redir = (const Shell::AST::PathRedirection*)&redir;
|
||||
auto path_redir = (Shell::AST::PathRedirection const*)&redir;
|
||||
TRY(builder.put_i64(path_redir->fd));
|
||||
switch (path_redir->direction) {
|
||||
case Shell::AST::PathRedirection::Read:
|
||||
|
@ -67,12 +67,12 @@ ErrorOr<void> AK::Formatter<Shell::AST::Command>::format(FormatBuilder& builder,
|
|||
}
|
||||
TRY(builder.put_literal(path_redir->path));
|
||||
} else if (redir.is_fd_redirection()) {
|
||||
auto* fdredir = (const Shell::AST::FdRedirection*)&redir;
|
||||
auto* fdredir = (Shell::AST::FdRedirection const*)&redir;
|
||||
TRY(builder.put_i64(fdredir->new_fd));
|
||||
TRY(builder.put_literal(">"));
|
||||
TRY(builder.put_i64(fdredir->old_fd));
|
||||
} else if (redir.is_close_redirection()) {
|
||||
auto close_redir = (const Shell::AST::CloseRedirection*)&redir;
|
||||
auto close_redir = (Shell::AST::CloseRedirection const*)&redir;
|
||||
TRY(builder.put_i64(close_redir->fd));
|
||||
TRY(builder.put_literal(">&-"));
|
||||
} else {
|
||||
|
@ -111,7 +111,7 @@ static inline void print_indented(StringView str, int indent)
|
|||
dbgln("{}{}", String::repeated(' ', indent * 2), str);
|
||||
}
|
||||
|
||||
static inline Optional<Position> merge_positions(const Optional<Position>& left, const Optional<Position>& right)
|
||||
static inline Optional<Position> merge_positions(Optional<Position> const& left, Optional<Position> const& right)
|
||||
{
|
||||
if (!left.has_value())
|
||||
return right;
|
||||
|
@ -260,7 +260,7 @@ void Node::clear_syntax_error()
|
|||
m_syntax_error_node->clear_syntax_error();
|
||||
}
|
||||
|
||||
void Node::set_is_syntax_error(const SyntaxError& error_node)
|
||||
void Node::set_is_syntax_error(SyntaxError const& error_node)
|
||||
{
|
||||
if (!m_syntax_error_node) {
|
||||
m_syntax_error_node = error_node;
|
||||
|
@ -331,7 +331,7 @@ Node::Node(Position position)
|
|||
{
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> Node::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> Node::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (matching_node) {
|
||||
|
@ -747,7 +747,7 @@ HitTestResult CastToCommand::hit_test_position(size_t offset) const
|
|||
return result;
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> CastToCommand::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> CastToCommand::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (!matching_node || !matching_node->is_bareword())
|
||||
|
@ -1107,7 +1107,7 @@ HitTestResult FunctionDeclaration::hit_test_position(size_t offset) const
|
|||
return result;
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> FunctionDeclaration::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> FunctionDeclaration::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (!matching_node)
|
||||
|
@ -1438,7 +1438,7 @@ void HistoryEvent::dump(int level) const
|
|||
print_indented(String::formatted("{}({})", m_selector.event.index, m_selector.event.text), level + 3);
|
||||
|
||||
print_indented("Word Selector", level + 1);
|
||||
auto print_word_selector = [&](const HistorySelector::WordSelector& selector) {
|
||||
auto print_word_selector = [&](HistorySelector::WordSelector const& selector) {
|
||||
switch (selector.kind) {
|
||||
case HistorySelector::WordSelectorKind::Index:
|
||||
print_indented(String::formatted("Index {}", selector.selector), level + 3);
|
||||
|
@ -1798,7 +1798,7 @@ HitTestResult Execute::hit_test_position(size_t offset) const
|
|||
return result;
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> Execute::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> Execute::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (!matching_node || !matching_node->is_bareword())
|
||||
|
@ -1851,7 +1851,7 @@ RefPtr<Value> IfCond::run(RefPtr<Shell> shell)
|
|||
|
||||
// The condition could be a builtin, in which case it has already run and exited.
|
||||
if (cond->is_job()) {
|
||||
auto cond_job_value = static_cast<const JobValue*>(cond.ptr());
|
||||
auto cond_job_value = static_cast<JobValue const*>(cond.ptr());
|
||||
auto cond_job = cond_job_value->job();
|
||||
|
||||
shell->block_on_job(cond_job);
|
||||
|
@ -1978,7 +1978,7 @@ void ImmediateExpression::highlight_in_editor(Line::Editor& editor, Shell& shell
|
|||
editor.stylize({ m_closing_brace_position->start_offset, m_closing_brace_position->end_offset }, { Line::Style::Foreground(Line::Style::XtermColor::Green) });
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> ImmediateExpression::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> ImmediateExpression::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (!matching_node || matching_node != this)
|
||||
|
@ -2455,7 +2455,7 @@ HitTestResult PathRedirectionNode::hit_test_position(size_t offset) const
|
|||
return result;
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> PathRedirectionNode::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> PathRedirectionNode::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (!matching_node || !matching_node->is_bareword())
|
||||
|
@ -2796,7 +2796,7 @@ HitTestResult Slice::hit_test_position(size_t offset) const
|
|||
return m_selector->hit_test_position(offset);
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> Slice::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> Slice::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
// TODO: Maybe intercept this, and suggest values in range?
|
||||
return m_selector->complete_for_editor(shell, offset, hit_test_result);
|
||||
|
@ -2855,7 +2855,7 @@ HitTestResult SimpleVariable::hit_test_position(size_t offset) const
|
|||
return { this, this, nullptr };
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> SimpleVariable::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> SimpleVariable::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (!matching_node)
|
||||
|
@ -2909,7 +2909,7 @@ void SpecialVariable::highlight_in_editor(Line::Editor& editor, Shell& shell, Hi
|
|||
m_slice->highlight_in_editor(editor, shell, metadata);
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> SpecialVariable::complete_for_editor(Shell&, size_t, const HitTestResult&)
|
||||
Vector<Line::CompletionSuggestion> SpecialVariable::complete_for_editor(Shell&, size_t, HitTestResult const&)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
@ -3013,7 +3013,7 @@ void Juxtaposition::highlight_in_editor(Line::Editor& editor, Shell& shell, High
|
|||
}
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> Juxtaposition::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> Juxtaposition::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (m_left->would_execute() || m_right->would_execute()) {
|
||||
|
@ -3190,7 +3190,7 @@ SyntaxError::SyntaxError(Position position, String error, bool is_continuable)
|
|||
{
|
||||
}
|
||||
|
||||
const SyntaxError& SyntaxError::syntax_error_node() const
|
||||
SyntaxError const& SyntaxError::syntax_error_node() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
@ -3242,7 +3242,7 @@ HitTestResult Tilde::hit_test_position(size_t offset) const
|
|||
return { this, this, nullptr };
|
||||
}
|
||||
|
||||
Vector<Line::CompletionSuggestion> Tilde::complete_for_editor(Shell& shell, size_t offset, const HitTestResult& hit_test_result)
|
||||
Vector<Line::CompletionSuggestion> Tilde::complete_for_editor(Shell& shell, size_t offset, HitTestResult const& hit_test_result)
|
||||
{
|
||||
auto matching_node = hit_test_result.matching_node;
|
||||
if (!matching_node)
|
||||
|
|
|
@ -39,7 +39,7 @@ struct Position {
|
|||
size_t line_number { 0 };
|
||||
size_t line_column { 0 };
|
||||
|
||||
bool operator==(const Line& other) const
|
||||
bool operator==(Line const& other) const
|
||||
{
|
||||
return line_number == other.line_number && line_column == other.line_column;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
const RefPtr<Job> job() const { return m_job; }
|
||||
RefPtr<Job> const job() const { return m_job; }
|
||||
|
||||
private:
|
||||
RefPtr<Job> m_job;
|
||||
|
@ -314,7 +314,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
const NonnullRefPtrVector<Value>& values() const { return m_contained_values; }
|
||||
NonnullRefPtrVector<Value> const& values() const { return m_contained_values; }
|
||||
NonnullRefPtrVector<Value>& values() { return m_contained_values; }
|
||||
|
||||
private:
|
||||
|
@ -416,7 +416,7 @@ public:
|
|||
virtual void for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(NonnullRefPtr<Value>)> callback);
|
||||
virtual RefPtr<Value> run(RefPtr<Shell>) = 0;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) = 0;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&);
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&);
|
||||
Vector<Line::CompletionSuggestion> complete_for_editor(Shell& shell, size_t offset);
|
||||
virtual HitTestResult hit_test_position(size_t offset) const
|
||||
{
|
||||
|
@ -441,10 +441,10 @@ public:
|
|||
virtual bool would_execute() const { return false; }
|
||||
virtual bool should_override_execution_in_current_process() const { return false; }
|
||||
|
||||
const Position& position() const { return m_position; }
|
||||
Position const& position() const { return m_position; }
|
||||
virtual void clear_syntax_error();
|
||||
virtual void set_is_syntax_error(const SyntaxError& error_node);
|
||||
virtual const SyntaxError& syntax_error_node() const
|
||||
virtual void set_is_syntax_error(SyntaxError const& error_node);
|
||||
virtual SyntaxError const& syntax_error_node() const
|
||||
{
|
||||
VERIFY(is_syntax_error());
|
||||
return *m_syntax_error_node;
|
||||
|
@ -520,13 +520,13 @@ public:
|
|||
PathRedirectionNode(Position, int, NonnullRefPtr<Node>);
|
||||
virtual ~PathRedirectionNode();
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual HitTestResult hit_test_position(size_t offset) const override;
|
||||
virtual bool is_command() const override { return true; }
|
||||
virtual bool is_list() const override { return true; }
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& path() const { return m_path; }
|
||||
NonnullRefPtr<Node> const& path() const { return m_path; }
|
||||
int fd() const { return m_fd; }
|
||||
|
||||
protected:
|
||||
|
@ -540,9 +540,9 @@ public:
|
|||
virtual ~And() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& left() const { return m_left; }
|
||||
const NonnullRefPtr<Node>& right() const { return m_right; }
|
||||
const Position& and_position() const { return m_and_position; }
|
||||
NonnullRefPtr<Node> const& left() const { return m_left; }
|
||||
NonnullRefPtr<Node> const& right() const { return m_right; }
|
||||
Position const& and_position() const { return m_and_position; }
|
||||
|
||||
private:
|
||||
NODE(And);
|
||||
|
@ -561,7 +561,7 @@ public:
|
|||
ListConcatenate(Position, Vector<NonnullRefPtr<Node>>);
|
||||
virtual ~ListConcatenate() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
const Vector<NonnullRefPtr<Node>> list() const { return m_list; }
|
||||
Vector<NonnullRefPtr<Node>> const list() const { return m_list; }
|
||||
|
||||
private:
|
||||
NODE(ListConcatenate);
|
||||
|
@ -582,7 +582,7 @@ public:
|
|||
virtual ~Background() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& command() const { return m_command; }
|
||||
NonnullRefPtr<Node> const& command() const { return m_command; }
|
||||
|
||||
private:
|
||||
NODE(Background);
|
||||
|
@ -600,7 +600,7 @@ public:
|
|||
virtual ~BarewordLiteral() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const String& text() const { return m_text; }
|
||||
String const& text() const { return m_text; }
|
||||
|
||||
private:
|
||||
NODE(BarewordLiteral);
|
||||
|
@ -619,7 +619,7 @@ public:
|
|||
virtual ~BraceExpansion() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtrVector<Node>& entries() const { return m_entries; }
|
||||
NonnullRefPtrVector<Node> const& entries() const { return m_entries; }
|
||||
|
||||
private:
|
||||
NODE(BraceExpansion);
|
||||
|
@ -637,7 +637,7 @@ public:
|
|||
virtual ~CastToCommand() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& inner() const { return m_inner; }
|
||||
NonnullRefPtr<Node> const& inner() const { return m_inner; }
|
||||
|
||||
private:
|
||||
NODE(CastToCommand);
|
||||
|
@ -645,7 +645,7 @@ private:
|
|||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual bool is_command() const override { return true; }
|
||||
virtual bool is_list() const override { return true; }
|
||||
virtual RefPtr<Node> leftmost_trivial_literal() const override;
|
||||
|
@ -659,7 +659,7 @@ public:
|
|||
virtual ~CastToList() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const RefPtr<Node>& inner() const { return m_inner; }
|
||||
RefPtr<Node> const& inner() const { return m_inner; }
|
||||
|
||||
private:
|
||||
NODE(CastToList);
|
||||
|
@ -698,7 +698,7 @@ public:
|
|||
virtual ~CommandLiteral();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const Command& command() const { return m_command; }
|
||||
Command const& command() const { return m_command; }
|
||||
|
||||
private:
|
||||
NODE(CommandLiteral);
|
||||
|
@ -717,7 +717,7 @@ public:
|
|||
virtual ~Comment();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const String& text() const { return m_text; }
|
||||
String const& text() const { return m_text; }
|
||||
|
||||
private:
|
||||
NODE(Comment);
|
||||
|
@ -760,7 +760,7 @@ public:
|
|||
virtual ~DynamicEvaluate();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& inner() const { return m_inner; }
|
||||
NonnullRefPtr<Node> const& inner() const { return m_inner; }
|
||||
|
||||
private:
|
||||
NODE(DynamicEvaluate);
|
||||
|
@ -787,7 +787,7 @@ public:
|
|||
virtual ~DoubleQuotedString();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const RefPtr<Node>& inner() const { return m_inner; }
|
||||
RefPtr<Node> const& inner() const { return m_inner; }
|
||||
|
||||
private:
|
||||
NODE(DoubleQuotedString);
|
||||
|
@ -825,9 +825,9 @@ public:
|
|||
virtual ~FunctionDeclaration();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NameWithPosition& name() const { return m_name; }
|
||||
const Vector<NameWithPosition> arguments() const { return m_arguments; }
|
||||
const RefPtr<Node>& block() const { return m_block; }
|
||||
NameWithPosition const& name() const { return m_name; }
|
||||
Vector<NameWithPosition> const arguments() const { return m_arguments; }
|
||||
RefPtr<Node> const& block() const { return m_block; }
|
||||
|
||||
private:
|
||||
NODE(FunctionDeclaration);
|
||||
|
@ -835,7 +835,7 @@ private:
|
|||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual bool would_execute() const override { return true; }
|
||||
virtual bool should_override_execution_in_current_process() const override { return true; }
|
||||
|
||||
|
@ -850,12 +850,12 @@ public:
|
|||
virtual ~ForLoop();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const Optional<NameWithPosition>& variable() const { return m_variable; }
|
||||
const Optional<NameWithPosition>& index_variable() const { return m_index_variable; }
|
||||
const RefPtr<Node>& iterated_expression() const { return m_iterated_expression; }
|
||||
const RefPtr<Node>& block() const { return m_block; }
|
||||
const Optional<Position> index_keyword_position() const { return m_index_kw_position; }
|
||||
const Optional<Position> in_keyword_position() const { return m_in_kw_position; }
|
||||
Optional<NameWithPosition> const& variable() const { return m_variable; }
|
||||
Optional<NameWithPosition> const& index_variable() const { return m_index_variable; }
|
||||
RefPtr<Node> const& iterated_expression() const { return m_iterated_expression; }
|
||||
RefPtr<Node> const& block() const { return m_block; }
|
||||
Optional<Position> const index_keyword_position() const { return m_index_kw_position; }
|
||||
Optional<Position> const in_keyword_position() const { return m_in_kw_position; }
|
||||
|
||||
private:
|
||||
NODE(ForLoop);
|
||||
|
@ -880,7 +880,7 @@ public:
|
|||
virtual ~Glob();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const String& text() const { return m_text; }
|
||||
String const& text() const { return m_text; }
|
||||
|
||||
private:
|
||||
NODE(Glob);
|
||||
|
@ -939,7 +939,7 @@ public:
|
|||
virtual ~HistoryEvent();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const HistorySelector& selector() const { return m_selector; }
|
||||
HistorySelector const& selector() const { return m_selector; }
|
||||
|
||||
private:
|
||||
NODE(HistoryEvent);
|
||||
|
@ -959,7 +959,7 @@ public:
|
|||
virtual void for_each_entry(RefPtr<Shell> shell, Function<IterationDecision(NonnullRefPtr<Value>)> callback) override;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& command() const { return m_command; }
|
||||
NonnullRefPtr<Node> const& command() const { return m_command; }
|
||||
bool does_capture_stdout() const { return m_capture_stdout; }
|
||||
|
||||
private:
|
||||
|
@ -968,7 +968,7 @@ private:
|
|||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual bool is_execute() const override { return true; }
|
||||
virtual bool would_execute() const override { return true; }
|
||||
|
||||
|
@ -982,10 +982,10 @@ public:
|
|||
virtual ~IfCond();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& condition() const { return m_condition; }
|
||||
const RefPtr<Node>& true_branch() const { return m_true_branch; }
|
||||
const RefPtr<Node>& false_branch() const { return m_false_branch; }
|
||||
const Optional<Position> else_position() const { return m_else_position; }
|
||||
NonnullRefPtr<Node> const& condition() const { return m_condition; }
|
||||
RefPtr<Node> const& true_branch() const { return m_true_branch; }
|
||||
RefPtr<Node> const& false_branch() const { return m_false_branch; }
|
||||
Optional<Position> const else_position() const { return m_else_position; }
|
||||
|
||||
private:
|
||||
NODE(IfCond);
|
||||
|
@ -1008,10 +1008,10 @@ public:
|
|||
virtual ~ImmediateExpression();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtrVector<Node>& arguments() const { return m_arguments; }
|
||||
const auto& function() const { return m_function; }
|
||||
const String& function_name() const { return m_function.name; }
|
||||
const Position& function_position() const { return m_function.position; }
|
||||
NonnullRefPtrVector<Node> const& arguments() const { return m_arguments; }
|
||||
auto const& function() const { return m_function; }
|
||||
String const& function_name() const { return m_function.name; }
|
||||
Position const& function_position() const { return m_function.position; }
|
||||
bool has_closing_brace() const { return m_closing_brace_position.has_value(); }
|
||||
|
||||
private:
|
||||
|
@ -1019,7 +1019,7 @@ private:
|
|||
virtual void dump(int level) const override;
|
||||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
|
||||
NonnullRefPtrVector<AST::Node> m_arguments;
|
||||
|
@ -1033,8 +1033,8 @@ public:
|
|||
virtual ~Join();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& left() const { return m_left; }
|
||||
const NonnullRefPtr<Node>& right() const { return m_right; }
|
||||
NonnullRefPtr<Node> const& left() const { return m_left; }
|
||||
NonnullRefPtr<Node> const& right() const { return m_right; }
|
||||
|
||||
private:
|
||||
NODE(Join);
|
||||
|
@ -1064,10 +1064,10 @@ public:
|
|||
virtual ~MatchExpr();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& matched_expr() const { return m_matched_expr; }
|
||||
const String& expr_name() const { return m_expr_name; }
|
||||
const Vector<MatchEntry>& entries() const { return m_entries; }
|
||||
const Optional<Position>& as_position() const { return m_as_position; }
|
||||
NonnullRefPtr<Node> const& matched_expr() const { return m_matched_expr; }
|
||||
String const& expr_name() const { return m_expr_name; }
|
||||
Vector<MatchEntry> const& entries() const { return m_entries; }
|
||||
Optional<Position> const& as_position() const { return m_as_position; }
|
||||
|
||||
private:
|
||||
NODE(MatchExpr);
|
||||
|
@ -1090,9 +1090,9 @@ public:
|
|||
virtual ~Or();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& left() const { return m_left; }
|
||||
const NonnullRefPtr<Node>& right() const { return m_right; }
|
||||
const Position& or_position() const { return m_or_position; }
|
||||
NonnullRefPtr<Node> const& left() const { return m_left; }
|
||||
NonnullRefPtr<Node> const& right() const { return m_right; }
|
||||
Position const& or_position() const { return m_or_position; }
|
||||
|
||||
private:
|
||||
NODE(Or);
|
||||
|
@ -1112,8 +1112,8 @@ public:
|
|||
virtual ~Pipe();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& left() const { return m_left; }
|
||||
const NonnullRefPtr<Node>& right() const { return m_right; }
|
||||
NonnullRefPtr<Node> const& left() const { return m_left; }
|
||||
NonnullRefPtr<Node> const& right() const { return m_right; }
|
||||
|
||||
private:
|
||||
NODE(Pipe);
|
||||
|
@ -1133,8 +1133,8 @@ public:
|
|||
virtual ~Range();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& start() const { return m_start; }
|
||||
const NonnullRefPtr<Node>& end() const { return m_end; }
|
||||
NonnullRefPtr<Node> const& start() const { return m_start; }
|
||||
NonnullRefPtr<Node> const& end() const { return m_end; }
|
||||
|
||||
private:
|
||||
NODE(Range);
|
||||
|
@ -1177,9 +1177,9 @@ public:
|
|||
virtual ~Sequence();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtrVector<Node>& entries() const { return m_entries; }
|
||||
NonnullRefPtrVector<Node> const& entries() const { return m_entries; }
|
||||
|
||||
const Vector<Position>& separator_positions() const { return m_separator_positions; }
|
||||
Vector<Position> const& separator_positions() const { return m_separator_positions; }
|
||||
|
||||
private:
|
||||
NODE(Sequence);
|
||||
|
@ -1201,7 +1201,7 @@ public:
|
|||
virtual ~Subshell();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const RefPtr<Node>& block() const { return m_block; }
|
||||
RefPtr<Node> const& block() const { return m_block; }
|
||||
|
||||
private:
|
||||
NODE(Subshell);
|
||||
|
@ -1227,7 +1227,7 @@ public:
|
|||
virtual void dump(int level) const override;
|
||||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
|
||||
protected:
|
||||
|
@ -1250,7 +1250,7 @@ public:
|
|||
set_is_syntax_error(m_slice->syntax_error_node());
|
||||
}
|
||||
|
||||
const Slice* slice() const { return m_slice.ptr(); }
|
||||
Slice const* slice() const { return m_slice.ptr(); }
|
||||
|
||||
protected:
|
||||
RefPtr<Slice> m_slice;
|
||||
|
@ -1262,14 +1262,14 @@ public:
|
|||
virtual ~SimpleVariable();
|
||||
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
const String& name() const { return m_name; }
|
||||
String const& name() const { return m_name; }
|
||||
|
||||
private:
|
||||
NODE(SimpleVariable);
|
||||
virtual void dump(int level) const override;
|
||||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual bool is_simple_variable() const override { return true; }
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ private:
|
|||
virtual void dump(int level) const override;
|
||||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
|
||||
char m_name { 0 };
|
||||
|
@ -1301,8 +1301,8 @@ public:
|
|||
virtual ~Juxtaposition();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& left() const { return m_left; }
|
||||
const NonnullRefPtr<Node>& right() const { return m_right; }
|
||||
NonnullRefPtr<Node> const& left() const { return m_left; }
|
||||
NonnullRefPtr<Node> const& right() const { return m_right; }
|
||||
|
||||
private:
|
||||
NODE(Juxtaposition);
|
||||
|
@ -1310,7 +1310,7 @@ private:
|
|||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
|
||||
NonnullRefPtr<Node> m_left;
|
||||
NonnullRefPtr<Node> m_right;
|
||||
|
@ -1322,10 +1322,10 @@ public:
|
|||
virtual ~Heredoc();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const String& end() const { return m_end; }
|
||||
String const& end() const { return m_end; }
|
||||
bool allow_interpolation() const { return m_allows_interpolation; }
|
||||
bool deindent() const { return m_deindent; }
|
||||
const RefPtr<AST::Node>& contents() const { return m_contents; }
|
||||
RefPtr<AST::Node> const& contents() const { return m_contents; }
|
||||
void set_contents(RefPtr<AST::Node> contents)
|
||||
{
|
||||
m_contents = move(contents);
|
||||
|
@ -1361,7 +1361,7 @@ public:
|
|||
virtual ~StringLiteral();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const String& text() const { return m_text; }
|
||||
String const& text() const { return m_text; }
|
||||
EnclosureType enclosure_type() const { return m_enclosure_type; }
|
||||
|
||||
private:
|
||||
|
@ -1381,8 +1381,8 @@ public:
|
|||
virtual ~StringPartCompose();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const NonnullRefPtr<Node>& left() const { return m_left; }
|
||||
const NonnullRefPtr<Node>& right() const { return m_right; }
|
||||
NonnullRefPtr<Node> const& left() const { return m_left; }
|
||||
NonnullRefPtr<Node> const& right() const { return m_right; }
|
||||
|
||||
private:
|
||||
NODE(StringPartCompose);
|
||||
|
@ -1401,14 +1401,14 @@ public:
|
|||
virtual ~SyntaxError();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const String& error_text() const { return m_syntax_error_text; }
|
||||
String const& error_text() const { return m_syntax_error_text; }
|
||||
bool is_continuable() const { return m_is_continuable; }
|
||||
|
||||
virtual void clear_syntax_error() override
|
||||
{
|
||||
m_is_cleared = true;
|
||||
}
|
||||
virtual void set_is_syntax_error(const SyntaxError& error) override
|
||||
virtual void set_is_syntax_error(SyntaxError const& error) override
|
||||
{
|
||||
m_position = error.position();
|
||||
m_is_cleared = error.m_is_cleared;
|
||||
|
@ -1424,7 +1424,7 @@ private:
|
|||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override { return { nullptr, nullptr, nullptr }; }
|
||||
virtual const SyntaxError& syntax_error_node() const override;
|
||||
virtual SyntaxError const& syntax_error_node() const override;
|
||||
|
||||
String m_syntax_error_text;
|
||||
bool m_is_continuable { false };
|
||||
|
@ -1437,7 +1437,7 @@ public:
|
|||
virtual ~SyntheticNode() = default;
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const Value& value() const { return m_value; }
|
||||
Value const& value() const { return m_value; }
|
||||
|
||||
private:
|
||||
NODE(SyntheticValue);
|
||||
|
@ -1461,7 +1461,7 @@ private:
|
|||
virtual void dump(int level) const override;
|
||||
virtual RefPtr<Value> run(RefPtr<Shell>) override;
|
||||
virtual void highlight_in_editor(Line::Editor&, Shell&, HighlightMetadata = {}) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, const HitTestResult&) override;
|
||||
virtual Vector<Line::CompletionSuggestion> complete_for_editor(Shell&, size_t, HitTestResult const&) override;
|
||||
virtual HitTestResult hit_test_position(size_t) const override;
|
||||
virtual bool is_tilde() const override { return true; }
|
||||
|
||||
|
@ -1478,7 +1478,7 @@ public:
|
|||
virtual ~VariableDeclarations();
|
||||
virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); }
|
||||
|
||||
const Vector<Variable>& variables() const { return m_variables; }
|
||||
Vector<Variable> const& variables() const { return m_variables; }
|
||||
|
||||
private:
|
||||
NODE(VariableDeclarations);
|
||||
|
|
|
@ -25,12 +25,12 @@ extern char** environ;
|
|||
|
||||
namespace Shell {
|
||||
|
||||
int Shell::builtin_noop(int, const char**)
|
||||
int Shell::builtin_noop(int, char const**)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_dump(int argc, const char** argv)
|
||||
int Shell::builtin_dump(int argc, char const** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
return 1;
|
||||
|
@ -39,9 +39,9 @@ int Shell::builtin_dump(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_alias(int argc, const char** argv)
|
||||
int Shell::builtin_alias(int argc, char const** argv)
|
||||
{
|
||||
Vector<const char*> arguments;
|
||||
Vector<char const*> arguments;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(arguments, "List of name[=values]'s", "name[=value]", Core::ArgsParser::Required::No);
|
||||
|
@ -74,10 +74,10 @@ int Shell::builtin_alias(int argc, const char** argv)
|
|||
return fail ? 1 : 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_unalias(int argc, const char** argv)
|
||||
int Shell::builtin_unalias(int argc, char const** argv)
|
||||
{
|
||||
bool remove_all { false };
|
||||
Vector<const char*> arguments;
|
||||
Vector<char const*> arguments;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.set_general_help("Remove alias from the list of aliases");
|
||||
|
@ -113,7 +113,7 @@ int Shell::builtin_unalias(int argc, const char** argv)
|
|||
return failed ? 1 : 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_bg(int argc, const char** argv)
|
||||
int Shell::builtin_bg(int argc, char const** argv)
|
||||
{
|
||||
int job_id = -1;
|
||||
bool is_pid = false;
|
||||
|
@ -177,9 +177,9 @@ int Shell::builtin_bg(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_type(int argc, const char** argv)
|
||||
int Shell::builtin_type(int argc, char const** argv)
|
||||
{
|
||||
Vector<const char*> commands;
|
||||
Vector<char const*> commands;
|
||||
bool dont_show_function_source = false;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
|
@ -246,9 +246,9 @@ int Shell::builtin_type(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_cd(int argc, const char** argv)
|
||||
int Shell::builtin_cd(int argc, char const** argv)
|
||||
{
|
||||
const char* arg_path = nullptr;
|
||||
char const* arg_path = nullptr;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(arg_path, "Path to change to", "path", Core::ArgsParser::Required::No);
|
||||
|
@ -283,7 +283,7 @@ int Shell::builtin_cd(int argc, const char** argv)
|
|||
auto path_relative_to_current_directory = LexicalPath::relative_path(real_path, cwd);
|
||||
if (path_relative_to_current_directory.is_empty())
|
||||
path_relative_to_current_directory = real_path;
|
||||
const char* path = path_relative_to_current_directory.characters();
|
||||
char const* path = path_relative_to_current_directory.characters();
|
||||
|
||||
int rc = chdir(path);
|
||||
if (rc < 0) {
|
||||
|
@ -300,7 +300,7 @@ int Shell::builtin_cd(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_cdh(int argc, const char** argv)
|
||||
int Shell::builtin_cdh(int argc, char const** argv)
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
|
@ -326,12 +326,12 @@ int Shell::builtin_cdh(int argc, const char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
const char* path = cd_history.at(cd_history.size() - index).characters();
|
||||
const char* cd_args[] = { "cd", path, nullptr };
|
||||
char const* path = cd_history.at(cd_history.size() - index).characters();
|
||||
char const* cd_args[] = { "cd", path, nullptr };
|
||||
return Shell::builtin_cd(2, cd_args);
|
||||
}
|
||||
|
||||
int Shell::builtin_dirs(int argc, const char** argv)
|
||||
int Shell::builtin_dirs(int argc, char const** argv)
|
||||
{
|
||||
// The first directory in the stack is ALWAYS the current directory
|
||||
directory_stack.at(0) = cwd.characters();
|
||||
|
@ -341,7 +341,7 @@ int Shell::builtin_dirs(int argc, const char** argv)
|
|||
bool number_when_printing = false;
|
||||
char separator = ' ';
|
||||
|
||||
Vector<const char*> paths;
|
||||
Vector<char const*> paths;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_option(clear, "Clear the directory stack", "clear", 'c');
|
||||
|
@ -384,21 +384,21 @@ int Shell::builtin_dirs(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_exec(int argc, const char** argv)
|
||||
int Shell::builtin_exec(int argc, char const** argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
warnln("Shell: No command given to exec");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Vector<const char*> argv_vector;
|
||||
Vector<char const*> argv_vector;
|
||||
argv_vector.append(argv + 1, argc - 1);
|
||||
argv_vector.append(nullptr);
|
||||
|
||||
execute_process(move(argv_vector));
|
||||
}
|
||||
|
||||
int Shell::builtin_exit(int argc, const char** argv)
|
||||
int Shell::builtin_exit(int argc, char const** argv)
|
||||
{
|
||||
int exit_code = 0;
|
||||
Core::ArgsParser parser;
|
||||
|
@ -423,9 +423,9 @@ int Shell::builtin_exit(int argc, const char** argv)
|
|||
exit(exit_code);
|
||||
}
|
||||
|
||||
int Shell::builtin_export(int argc, const char** argv)
|
||||
int Shell::builtin_export(int argc, char const** argv)
|
||||
{
|
||||
Vector<const char*> vars;
|
||||
Vector<char const*> vars;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(vars, "List of variable[=value]'s", "values", Core::ArgsParser::Required::No);
|
||||
|
@ -469,9 +469,9 @@ int Shell::builtin_export(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_glob(int argc, const char** argv)
|
||||
int Shell::builtin_glob(int argc, char const** argv)
|
||||
{
|
||||
Vector<const char*> globs;
|
||||
Vector<char const*> globs;
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(globs, "Globs to resolve", "glob");
|
||||
|
||||
|
@ -486,7 +486,7 @@ int Shell::builtin_glob(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_fg(int argc, const char** argv)
|
||||
int Shell::builtin_fg(int argc, char const** argv)
|
||||
{
|
||||
int job_id = -1;
|
||||
bool is_pid = false;
|
||||
|
@ -557,7 +557,7 @@ int Shell::builtin_fg(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_disown(int argc, const char** argv)
|
||||
int Shell::builtin_disown(int argc, char const** argv)
|
||||
{
|
||||
Vector<int> job_ids;
|
||||
Vector<bool> id_is_pid;
|
||||
|
@ -594,7 +594,7 @@ int Shell::builtin_disown(int argc, const char** argv)
|
|||
id_is_pid.append(false);
|
||||
}
|
||||
|
||||
Vector<const Job*> jobs_to_disown;
|
||||
Vector<Job const*> jobs_to_disown;
|
||||
|
||||
for (size_t i = 0; i < job_ids.size(); ++i) {
|
||||
auto id = job_ids[i];
|
||||
|
@ -625,7 +625,7 @@ int Shell::builtin_disown(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_history(int, const char**)
|
||||
int Shell::builtin_history(int, char const**)
|
||||
{
|
||||
for (size_t i = 0; i < m_editor->history().size(); ++i) {
|
||||
printf("%6zu %s\n", i + 1, m_editor->history()[i].entry.characters());
|
||||
|
@ -633,7 +633,7 @@ int Shell::builtin_history(int, const char**)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_jobs(int argc, const char** argv)
|
||||
int Shell::builtin_jobs(int argc, char const** argv)
|
||||
{
|
||||
bool list = false, show_pid = false;
|
||||
|
||||
|
@ -660,7 +660,7 @@ int Shell::builtin_jobs(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_popd(int argc, const char** argv)
|
||||
int Shell::builtin_popd(int argc, char const** argv)
|
||||
{
|
||||
if (directory_stack.size() <= 1) {
|
||||
warnln("Shell: popd: directory stack empty");
|
||||
|
@ -688,7 +688,7 @@ int Shell::builtin_popd(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_pushd(int argc, const char** argv)
|
||||
int Shell::builtin_pushd(int argc, char const** argv)
|
||||
{
|
||||
StringBuilder path_builder;
|
||||
bool should_switch = true;
|
||||
|
@ -728,7 +728,7 @@ int Shell::builtin_pushd(int argc, const char** argv)
|
|||
} else if (argc == 3) {
|
||||
directory_stack.append(cwd.characters());
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char* arg = argv[i];
|
||||
char const* arg = argv[i];
|
||||
|
||||
if (arg[0] != '-') {
|
||||
if (arg[0] == '/') {
|
||||
|
@ -769,14 +769,14 @@ int Shell::builtin_pushd(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_pwd(int, const char**)
|
||||
int Shell::builtin_pwd(int, char const**)
|
||||
{
|
||||
print_path(cwd);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_setopt(int argc, const char** argv)
|
||||
int Shell::builtin_setopt(int argc, char const** argv)
|
||||
{
|
||||
if (argc == 1) {
|
||||
#define __ENUMERATE_SHELL_OPTION(name, default_, description) \
|
||||
|
@ -815,7 +815,7 @@ int Shell::builtin_setopt(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_shift(int argc, const char** argv)
|
||||
int Shell::builtin_shift(int argc, char const** argv)
|
||||
{
|
||||
int count = 1;
|
||||
|
||||
|
@ -849,10 +849,10 @@ int Shell::builtin_shift(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_source(int argc, const char** argv)
|
||||
int Shell::builtin_source(int argc, char const** argv)
|
||||
{
|
||||
const char* file_to_source = nullptr;
|
||||
Vector<const char*> args;
|
||||
char const* file_to_source = nullptr;
|
||||
Vector<char const*> args;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(file_to_source, "File to read commands from", "path");
|
||||
|
@ -880,9 +880,9 @@ int Shell::builtin_source(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_time(int argc, const char** argv)
|
||||
int Shell::builtin_time(int argc, char const** argv)
|
||||
{
|
||||
Vector<const char*> args;
|
||||
Vector<char const*> args;
|
||||
|
||||
int number_of_iterations = 1;
|
||||
|
||||
|
@ -938,9 +938,9 @@ int Shell::builtin_time(int argc, const char** argv)
|
|||
return exit_code;
|
||||
}
|
||||
|
||||
int Shell::builtin_umask(int argc, const char** argv)
|
||||
int Shell::builtin_umask(int argc, char const** argv)
|
||||
{
|
||||
const char* mask_text = nullptr;
|
||||
char const* mask_text = nullptr;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(mask_text, "New mask (omit to get current mask)", "octal-mask", Core::ArgsParser::Required::No);
|
||||
|
@ -966,7 +966,7 @@ int Shell::builtin_umask(int argc, const char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int Shell::builtin_wait(int argc, const char** argv)
|
||||
int Shell::builtin_wait(int argc, char const** argv)
|
||||
{
|
||||
Vector<int> job_ids;
|
||||
Vector<bool> id_is_pid;
|
||||
|
@ -1011,7 +1011,7 @@ int Shell::builtin_wait(int argc, const char** argv)
|
|||
}
|
||||
|
||||
if (job_ids.is_empty()) {
|
||||
for (const auto& it : jobs)
|
||||
for (auto const& it : jobs)
|
||||
jobs_to_wait_for.append(it.value);
|
||||
}
|
||||
|
||||
|
@ -1023,9 +1023,9 @@ int Shell::builtin_wait(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_unset(int argc, const char** argv)
|
||||
int Shell::builtin_unset(int argc, char const** argv)
|
||||
{
|
||||
Vector<const char*> vars;
|
||||
Vector<char const*> vars;
|
||||
|
||||
Core::ArgsParser parser;
|
||||
parser.add_positional_argument(vars, "List of variables", "variables", Core::ArgsParser::Required::Yes);
|
||||
|
@ -1051,7 +1051,7 @@ int Shell::builtin_unset(int argc, const char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_not(int argc, const char** argv)
|
||||
int Shell::builtin_not(int argc, char const** argv)
|
||||
{
|
||||
// FIXME: Use ArgsParser when it can collect unrelated -arguments too.
|
||||
if (argc == 1)
|
||||
|
@ -1075,7 +1075,7 @@ int Shell::builtin_not(int argc, const char** argv)
|
|||
return exit_code == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
int Shell::builtin_kill(int argc, const char** argv)
|
||||
int Shell::builtin_kill(int argc, char const** argv)
|
||||
{
|
||||
// Simply translate the arguments and pass them to `kill'
|
||||
Vector<String> replaced_values;
|
||||
|
@ -1118,7 +1118,7 @@ int Shell::builtin_kill(int argc, const char** argv)
|
|||
return exit_code;
|
||||
}
|
||||
|
||||
bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<AST::Rewiring>& rewirings, int& retval)
|
||||
bool Shell::run_builtin(const AST::Command& command, NonnullRefPtrVector<AST::Rewiring> const& rewirings, int& retval)
|
||||
{
|
||||
if (command.argv.is_empty())
|
||||
return false;
|
||||
|
@ -1126,7 +1126,7 @@ bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<A
|
|||
if (!has_builtin(command.argv.first()))
|
||||
return false;
|
||||
|
||||
Vector<const char*> argv;
|
||||
Vector<char const*> argv;
|
||||
for (auto& arg : command.argv)
|
||||
argv.append(arg.characters());
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ bool Shell::run_builtin(const AST::Command& command, const NonnullRefPtrVector<A
|
|||
return false;
|
||||
}
|
||||
|
||||
int Shell::builtin_argsparser_parse(int argc, const char** argv)
|
||||
int Shell::builtin_argsparser_parse(int argc, char const** argv)
|
||||
{
|
||||
// argsparser_parse
|
||||
// --add-option variable [--type (bool | string | i32 | u32 | double | size)] --help-string "" --long-name "" --short-name "" [--value-name "" <if not --type bool>] --list
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
|
||||
class SavedFileDescriptors {
|
||||
public:
|
||||
SavedFileDescriptors(const NonnullRefPtrVector<AST::Rewiring>&);
|
||||
SavedFileDescriptors(NonnullRefPtrVector<AST::Rewiring> const&);
|
||||
~SavedFileDescriptors();
|
||||
|
||||
private:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Shell {
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_length_impl(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments, bool across)
|
||||
RefPtr<AST::Node> Shell::immediate_length_impl(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments, bool across)
|
||||
{
|
||||
auto name = across ? "length_across" : "length";
|
||||
if (arguments.size() < 1 || arguments.size() > 2) {
|
||||
|
@ -37,7 +37,7 @@ RefPtr<AST::Node> Shell::immediate_length_impl(AST::ImmediateExpression& invokin
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const auto& mode_name = static_cast<const AST::BarewordLiteral&>(mode_arg).text();
|
||||
auto const& mode_name = static_cast<const AST::BarewordLiteral&>(mode_arg).text();
|
||||
if (mode_name == "list") {
|
||||
mode = List;
|
||||
} else if (mode_name == "string") {
|
||||
|
@ -189,17 +189,17 @@ RefPtr<AST::Node> Shell::immediate_length_impl(AST::ImmediateExpression& invokin
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_length(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_length(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
return immediate_length_impl(invoking_node, arguments, false);
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_length_across(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_length_across(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
return immediate_length_impl(invoking_node, arguments, true);
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_regex_replace(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_regex_replace(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
if (arguments.size() != 3) {
|
||||
raise_error(ShellError::EvaluatedSyntaxError, "Expected exactly 3 arguments to regex_replace", invoking_node.position());
|
||||
|
@ -231,7 +231,7 @@ RefPtr<AST::Node> Shell::immediate_regex_replace(AST::ImmediateExpression& invok
|
|||
return AST::make_ref_counted<AST::StringLiteral>(invoking_node.position(), move(result), AST::StringLiteral::EnclosureType::None);
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_remove_suffix(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_remove_suffix(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
if (arguments.size() != 2) {
|
||||
raise_error(ShellError::EvaluatedSyntaxError, "Expected exactly 2 arguments to remove_suffix", invoking_node.position());
|
||||
|
@ -262,7 +262,7 @@ RefPtr<AST::Node> Shell::immediate_remove_suffix(AST::ImmediateExpression& invok
|
|||
return AST::make_ref_counted<AST::ListConcatenate>(invoking_node.position(), move(nodes));
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_remove_prefix(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_remove_prefix(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
if (arguments.size() != 2) {
|
||||
raise_error(ShellError::EvaluatedSyntaxError, "Expected exactly 2 arguments to remove_prefix", invoking_node.position());
|
||||
|
@ -293,7 +293,7 @@ RefPtr<AST::Node> Shell::immediate_remove_prefix(AST::ImmediateExpression& invok
|
|||
return AST::make_ref_counted<AST::ListConcatenate>(invoking_node.position(), move(nodes));
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_split(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_split(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
if (arguments.size() != 2) {
|
||||
raise_error(ShellError::EvaluatedSyntaxError, "Expected exactly 2 arguments to split", invoking_node.position());
|
||||
|
@ -310,7 +310,7 @@ RefPtr<AST::Node> Shell::immediate_split(AST::ImmediateExpression& invoking_node
|
|||
|
||||
auto delimiter_str = delimiter->resolve_as_list(this)[0];
|
||||
|
||||
auto transform = [&](const auto& values) {
|
||||
auto transform = [&](auto const& values) {
|
||||
// Translate to a list of applications of `split <delimiter>`
|
||||
Vector<NonnullRefPtr<AST::Node>> resulting_nodes;
|
||||
resulting_nodes.ensure_capacity(values.size());
|
||||
|
@ -360,7 +360,7 @@ RefPtr<AST::Node> Shell::immediate_split(AST::ImmediateExpression& invoking_node
|
|||
return transform(AST::make_ref_counted<AST::ListValue>(list)->values());
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_concat_lists(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_concat_lists(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
NonnullRefPtrVector<AST::Node> result;
|
||||
|
||||
|
@ -383,7 +383,7 @@ RefPtr<AST::Node> Shell::immediate_concat_lists(AST::ImmediateExpression& invoki
|
|||
return AST::make_ref_counted<AST::ListConcatenate>(invoking_node.position(), move(result));
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_filter_glob(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_filter_glob(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
// filter_glob string list
|
||||
if (arguments.size() != 2) {
|
||||
|
@ -427,7 +427,7 @@ RefPtr<AST::Node> Shell::immediate_filter_glob(AST::ImmediateExpression& invokin
|
|||
return AST::make_ref_counted<AST::ListConcatenate>(invoking_node.position(), move(result));
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::immediate_join(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::immediate_join(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
if (arguments.size() != 2) {
|
||||
raise_error(ShellError::EvaluatedSyntaxError, "Expected exactly 2 arguments to join", invoking_node.position());
|
||||
|
@ -453,7 +453,7 @@ RefPtr<AST::Node> Shell::immediate_join(AST::ImmediateExpression& invoking_node,
|
|||
return AST::make_ref_counted<AST::StringLiteral>(invoking_node.position(), builder.to_string(), AST::StringLiteral::EnclosureType::None);
|
||||
}
|
||||
|
||||
RefPtr<AST::Node> Shell::run_immediate_function(StringView str, AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>& arguments)
|
||||
RefPtr<AST::Node> Shell::run_immediate_function(StringView str, AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const& arguments)
|
||||
{
|
||||
#define __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(name) \
|
||||
if (str == #name) \
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
pid_t pgid() const { return m_pgid; }
|
||||
pid_t pid() const { return m_pid; }
|
||||
const String& cmd() const { return m_cmd; }
|
||||
String const& cmd() const { return m_cmd; }
|
||||
const AST::Command& command() const { return *m_command; }
|
||||
AST::Command* command_ptr() { return m_command; }
|
||||
u64 job_id() const { return m_job_id; }
|
||||
|
|
|
@ -152,7 +152,7 @@ private:
|
|||
AST::Position::Line line;
|
||||
};
|
||||
|
||||
void restore_to(const ScopedOffset& offset) { restore_to(offset.offset, offset.line); }
|
||||
void restore_to(ScopedOffset const& offset) { restore_to(offset.offset, offset.line); }
|
||||
|
||||
OwnPtr<ScopedOffset> push_start();
|
||||
Offset current_position();
|
||||
|
|
|
@ -155,7 +155,7 @@ String Shell::expand_tilde(StringView expression)
|
|||
path.append(expression[i]);
|
||||
|
||||
if (login_name.is_empty()) {
|
||||
const char* home = getenv("HOME");
|
||||
char const* home = getenv("HOME");
|
||||
if (!home) {
|
||||
auto passwd = getpwuid(getuid());
|
||||
VERIFY(passwd && passwd->pw_dir);
|
||||
|
@ -385,7 +385,7 @@ RefPtr<AST::Value> Shell::get_argument(size_t index) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
String Shell::local_variable_or(StringView name, const String& replacement) const
|
||||
String Shell::local_variable_or(StringView name, String const& replacement) const
|
||||
{
|
||||
auto value = lookup_local_variable(name);
|
||||
if (value) {
|
||||
|
@ -396,7 +396,7 @@ String Shell::local_variable_or(StringView name, const String& replacement) cons
|
|||
return replacement;
|
||||
}
|
||||
|
||||
void Shell::set_local_variable(const String& name, RefPtr<AST::Value> value, bool only_in_current_frame)
|
||||
void Shell::set_local_variable(String const& name, RefPtr<AST::Value> value, bool only_in_current_frame)
|
||||
{
|
||||
if (!only_in_current_frame) {
|
||||
if (auto* frame = find_frame_containing_local_variable(name)) {
|
||||
|
@ -700,7 +700,7 @@ ErrorOr<RefPtr<Job>> Shell::run_command(const AST::Command& command)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Vector<const char*> argv;
|
||||
Vector<char const*> argv;
|
||||
Vector<String> copy_argv = command.argv;
|
||||
argv.ensure_capacity(command.argv.size() + 1);
|
||||
|
||||
|
@ -842,7 +842,7 @@ ErrorOr<RefPtr<Job>> Shell::run_command(const AST::Command& command)
|
|||
return *job;
|
||||
}
|
||||
|
||||
void Shell::execute_process(Vector<const char*>&& argv)
|
||||
void Shell::execute_process(Vector<char const*>&& argv)
|
||||
{
|
||||
#ifdef __serenity__
|
||||
for (auto& promise : m_active_promises) {
|
||||
|
@ -1008,7 +1008,7 @@ NonnullRefPtrVector<Job> Shell::run_commands(Vector<AST::Command>& commands)
|
|||
return spawned_jobs;
|
||||
}
|
||||
|
||||
bool Shell::run_file(const String& filename, bool explicitly_invoked)
|
||||
bool Shell::run_file(String const& filename, bool explicitly_invoked)
|
||||
{
|
||||
TemporaryChange script_change { current_script, filename };
|
||||
TemporaryChange interactive_change { m_is_interactive, false };
|
||||
|
@ -1062,7 +1062,7 @@ void Shell::block_on_pipeline(RefPtr<AST::Pipeline> pipeline)
|
|||
|
||||
void Shell::block_on_job(RefPtr<Job> job)
|
||||
{
|
||||
TemporaryChange<const Job*> current_job { m_current_job, job.ptr() };
|
||||
TemporaryChange<Job const*> current_job { m_current_job, job.ptr() };
|
||||
|
||||
if (!job)
|
||||
return;
|
||||
|
@ -1310,7 +1310,7 @@ String Shell::find_in_path(StringView program_name)
|
|||
String path = getenv("PATH");
|
||||
if (!path.is_empty()) {
|
||||
auto directories = path.split(':');
|
||||
for (const auto& directory : directories) {
|
||||
for (auto const& directory : directories) {
|
||||
Core::DirIterator programs(directory.characters(), Core::DirIterator::SkipDots);
|
||||
while (programs.has_next()) {
|
||||
auto program = programs.next_path();
|
||||
|
@ -1335,7 +1335,7 @@ void Shell::cache_path()
|
|||
cached_path.clear_with_capacity();
|
||||
|
||||
// Add shell builtins to the cache.
|
||||
for (const auto& builtin_name : builtin_names)
|
||||
for (auto const& builtin_name : builtin_names)
|
||||
cached_path.append(escape_token(builtin_name));
|
||||
|
||||
// Add functions to the cache.
|
||||
|
@ -1347,7 +1347,7 @@ void Shell::cache_path()
|
|||
}
|
||||
|
||||
// Add aliases to the cache.
|
||||
for (const auto& alias : m_aliases) {
|
||||
for (auto const& alias : m_aliases) {
|
||||
auto name = escape_token(alias.key);
|
||||
if (cached_path.contains_slow(name))
|
||||
continue;
|
||||
|
@ -1357,7 +1357,7 @@ void Shell::cache_path()
|
|||
String path = getenv("PATH");
|
||||
if (!path.is_empty()) {
|
||||
auto directories = path.split(':');
|
||||
for (const auto& directory : directories) {
|
||||
for (auto const& directory : directories) {
|
||||
Core::DirIterator programs(directory.characters(), Core::DirIterator::SkipDots);
|
||||
while (programs.has_next()) {
|
||||
auto program = programs.next_path();
|
||||
|
@ -1374,7 +1374,7 @@ void Shell::cache_path()
|
|||
quick_sort(cached_path);
|
||||
}
|
||||
|
||||
void Shell::add_entry_to_cache(const String& entry)
|
||||
void Shell::add_entry_to_cache(String const& entry)
|
||||
{
|
||||
size_t index = 0;
|
||||
auto match = binary_search(cached_path.span(), entry, &index);
|
||||
|
@ -2223,7 +2223,7 @@ u64 Shell::find_last_job_id() const
|
|||
return job_id;
|
||||
}
|
||||
|
||||
const Job* Shell::find_job(u64 id, bool is_pid)
|
||||
Job const* Shell::find_job(u64 id, bool is_pid)
|
||||
{
|
||||
for (auto& entry : jobs) {
|
||||
if (is_pid) {
|
||||
|
@ -2237,7 +2237,7 @@ const Job* Shell::find_job(u64 id, bool is_pid)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Shell::kill_job(const Job* job, int sig)
|
||||
void Shell::kill_job(Job const* job, int sig)
|
||||
{
|
||||
if (!job)
|
||||
return;
|
||||
|
@ -2441,7 +2441,7 @@ void FileDescriptionCollector::add(int fd)
|
|||
m_fds.append(fd);
|
||||
}
|
||||
|
||||
SavedFileDescriptors::SavedFileDescriptors(const NonnullRefPtrVector<AST::Rewiring>& intended_rewirings)
|
||||
SavedFileDescriptors::SavedFileDescriptors(NonnullRefPtrVector<AST::Rewiring> const& intended_rewirings)
|
||||
{
|
||||
for (auto& rewiring : intended_rewirings) {
|
||||
int new_fd = dup(rewiring.new_fd);
|
||||
|
|
|
@ -96,10 +96,10 @@ public:
|
|||
bool is_runnable(StringView);
|
||||
ErrorOr<RefPtr<Job>> run_command(const AST::Command&);
|
||||
NonnullRefPtrVector<Job> run_commands(Vector<AST::Command>&);
|
||||
bool run_file(const String&, bool explicitly_invoked = true);
|
||||
bool run_builtin(const AST::Command&, const NonnullRefPtrVector<AST::Rewiring>&, int& retval);
|
||||
bool run_file(String const&, bool explicitly_invoked = true);
|
||||
bool run_builtin(const AST::Command&, NonnullRefPtrVector<AST::Rewiring> const&, int& retval);
|
||||
bool has_builtin(StringView) const;
|
||||
RefPtr<AST::Node> run_immediate_function(StringView name, AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>&);
|
||||
RefPtr<AST::Node> run_immediate_function(StringView name, AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const&);
|
||||
static bool has_immediate_function(StringView);
|
||||
void block_on_job(RefPtr<Job>);
|
||||
void block_on_pipeline(RefPtr<AST::Pipeline>);
|
||||
|
@ -118,8 +118,8 @@ public:
|
|||
|
||||
RefPtr<AST::Value> get_argument(size_t) const;
|
||||
RefPtr<AST::Value> lookup_local_variable(StringView) const;
|
||||
String local_variable_or(StringView, const String&) const;
|
||||
void set_local_variable(const String&, RefPtr<AST::Value>, bool only_in_current_frame = false);
|
||||
String local_variable_or(StringView, String const&) const;
|
||||
void set_local_variable(String const&, RefPtr<AST::Value>, bool only_in_current_frame = false);
|
||||
void unset_local_variable(StringView, bool only_in_current_frame = false);
|
||||
|
||||
void define_function(String name, Vector<String> argnames, RefPtr<AST::Node> body);
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
};
|
||||
|
||||
struct Frame {
|
||||
Frame(NonnullOwnPtrVector<LocalFrame>& frames, const LocalFrame& frame)
|
||||
Frame(NonnullOwnPtrVector<LocalFrame>& frames, LocalFrame const& frame)
|
||||
: frames(frames)
|
||||
, frame(frame)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
|
||||
private:
|
||||
NonnullOwnPtrVector<LocalFrame>& frames;
|
||||
const LocalFrame& frame;
|
||||
LocalFrame const& frame;
|
||||
bool should_destroy_frame { true };
|
||||
};
|
||||
|
||||
|
@ -235,9 +235,9 @@ public:
|
|||
void restore_ios();
|
||||
|
||||
u64 find_last_job_id() const;
|
||||
const Job* find_job(u64 id, bool is_pid = false);
|
||||
const Job* current_job() const { return m_current_job; }
|
||||
void kill_job(const Job*, int sig);
|
||||
Job const* find_job(u64 id, bool is_pid = false);
|
||||
Job const* current_job() const { return m_current_job; }
|
||||
void kill_job(Job const*, int sig);
|
||||
|
||||
String get_history_path();
|
||||
void print_path(StringView path);
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
}
|
||||
bool has_error(ShellError err) const { return m_error == err; }
|
||||
bool has_any_error() const { return !has_error(ShellError::None); }
|
||||
const String& error_description() const { return m_error_description; }
|
||||
String const& error_description() const { return m_error_description; }
|
||||
ShellError take_error()
|
||||
{
|
||||
auto err = m_error;
|
||||
|
@ -344,12 +344,12 @@ private:
|
|||
|
||||
Optional<int> resolve_job_spec(StringView);
|
||||
void cache_path();
|
||||
void add_entry_to_cache(const String&);
|
||||
void add_entry_to_cache(String const&);
|
||||
void remove_entry_from_cache(StringView);
|
||||
void stop_all_jobs();
|
||||
const Job* m_current_job { nullptr };
|
||||
Job const* m_current_job { nullptr };
|
||||
LocalFrame* find_frame_containing_local_variable(StringView name);
|
||||
const LocalFrame* find_frame_containing_local_variable(StringView name) const
|
||||
LocalFrame const* find_frame_containing_local_variable(StringView name) const
|
||||
{
|
||||
return const_cast<Shell*>(this)->find_frame_containing_local_variable(name);
|
||||
}
|
||||
|
@ -357,21 +357,21 @@ private:
|
|||
void run_tail(RefPtr<Job>);
|
||||
void run_tail(const AST::Command&, const AST::NodeWithAction&, int head_exit_code);
|
||||
|
||||
[[noreturn]] void execute_process(Vector<const char*>&& argv);
|
||||
[[noreturn]] void execute_process(Vector<char const*>&& argv);
|
||||
|
||||
virtual void custom_event(Core::CustomEvent&) override;
|
||||
|
||||
#define __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(name) \
|
||||
RefPtr<AST::Node> immediate_##name(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>&);
|
||||
RefPtr<AST::Node> immediate_##name(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const&);
|
||||
|
||||
ENUMERATE_SHELL_IMMEDIATE_FUNCTIONS();
|
||||
|
||||
#undef __ENUMERATE_SHELL_IMMEDIATE_FUNCTION
|
||||
|
||||
RefPtr<AST::Node> immediate_length_impl(AST::ImmediateExpression& invoking_node, const NonnullRefPtrVector<AST::Node>&, bool across);
|
||||
RefPtr<AST::Node> immediate_length_impl(AST::ImmediateExpression& invoking_node, NonnullRefPtrVector<AST::Node> const&, bool across);
|
||||
|
||||
#define __ENUMERATE_SHELL_BUILTIN(builtin) \
|
||||
int builtin_##builtin(int argc, const char** argv);
|
||||
int builtin_##builtin(int argc, char const** argv);
|
||||
|
||||
ENUMERATE_SHELL_BUILTINS();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ enum class AugmentedTokenKind : u32 {
|
|||
|
||||
class HighlightVisitor : public AST::NodeVisitor {
|
||||
public:
|
||||
HighlightVisitor(Vector<GUI::TextDocumentSpan>& spans, const Gfx::Palette& palette, const GUI::TextDocument& document)
|
||||
HighlightVisitor(Vector<GUI::TextDocumentSpan>& spans, Gfx::Palette const& palette, const GUI::TextDocument& document)
|
||||
: m_spans(spans)
|
||||
, m_palette(palette)
|
||||
, m_document(document)
|
||||
|
@ -516,7 +516,7 @@ private:
|
|||
}
|
||||
|
||||
Vector<GUI::TextDocumentSpan>& m_spans;
|
||||
const Gfx::Palette& m_palette;
|
||||
Gfx::Palette const& m_palette;
|
||||
const GUI::TextDocument& m_document;
|
||||
bool m_is_first_in_command { false };
|
||||
};
|
||||
|
@ -537,7 +537,7 @@ bool SyntaxHighlighter::is_navigatable(u64) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void SyntaxHighlighter::rehighlight(const Palette& palette)
|
||||
void SyntaxHighlighter::rehighlight(Palette const& palette)
|
||||
{
|
||||
auto text = m_client->get_text();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual bool is_navigatable(u64) const override;
|
||||
|
||||
virtual Syntax::Language language() const override { return Syntax::Language::Shell; }
|
||||
virtual void rehighlight(const Palette&) override;
|
||||
virtual void rehighlight(Palette const&) override;
|
||||
|
||||
protected:
|
||||
virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override;
|
||||
|
|
|
@ -157,11 +157,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
};
|
||||
|
||||
const char* command_to_run = nullptr;
|
||||
const char* file_to_read_from = nullptr;
|
||||
Vector<const char*> script_args;
|
||||
char const* command_to_run = nullptr;
|
||||
char const* file_to_read_from = nullptr;
|
||||
Vector<char const*> script_args;
|
||||
bool skip_rc_files = false;
|
||||
const char* format = nullptr;
|
||||
char const* format = nullptr;
|
||||
bool should_format_live = false;
|
||||
bool keep_open = false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue