mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
3048274f5e
Closes #4283. Heredocs are implemented in a way that makes them feel more like a string (and not a weird redirection, a la bash). There are two tunables, whether the string is dedented (`<<-` vs `<<~`) and whether it allows interpolation (quoted key vs not). To the familiar people, this is how Ruby handles them, and I feel is the most elegant heredoc syntax. Unlike the oddjob that is bash, heredocs are treated exactly as normal strings, and can be used _anywhere_ where a string can be used. They are *required* to appear in the same order as used after a newline is seen when parsing the sequence that the heredoc is used in. For instance: ```sh echo <<-doc1 <<-doc2 | blah blah contents for doc1 doc1 contents for doc2 doc2 ``` The typical nice errors are also implemented :^)
71 lines
1.1 KiB
C++
71 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
namespace Shell::AST {
|
|
|
|
struct Command;
|
|
class Node;
|
|
class Value;
|
|
class SyntaxError;
|
|
class Pipeline;
|
|
struct Rewiring;
|
|
class NodeVisitor;
|
|
|
|
class PathRedirectionNode;
|
|
class And;
|
|
class ListConcatenate;
|
|
class Background;
|
|
class BarewordLiteral;
|
|
class BraceExpansion;
|
|
class CastToCommand;
|
|
class CastToList;
|
|
class CloseFdRedirection;
|
|
class CommandLiteral;
|
|
class Comment;
|
|
class ContinuationControl;
|
|
class DynamicEvaluate;
|
|
class DoubleQuotedString;
|
|
class Fd2FdRedirection;
|
|
class FunctionDeclaration;
|
|
class ForLoop;
|
|
class Glob;
|
|
class Heredoc;
|
|
class HistoryEvent;
|
|
class Execute;
|
|
class IfCond;
|
|
class ImmediateExpression;
|
|
class Join;
|
|
class MatchExpr;
|
|
class Or;
|
|
class Pipe;
|
|
class Range;
|
|
class ReadRedirection;
|
|
class ReadWriteRedirection;
|
|
class Sequence;
|
|
class Subshell;
|
|
class Slice;
|
|
class SimpleVariable;
|
|
class SpecialVariable;
|
|
class Juxtaposition;
|
|
class StringLiteral;
|
|
class StringPartCompose;
|
|
class SyntaxError;
|
|
class SyntheticNode;
|
|
class Tilde;
|
|
class VariableDeclarations;
|
|
class WriteAppendRedirection;
|
|
class WriteRedirection;
|
|
|
|
}
|
|
|
|
namespace Shell {
|
|
|
|
class Shell;
|
|
|
|
}
|