Ali Mohammad Pur
33a3f0e134
Shell: Implement close redirections in POSIX mode
...
Fixes #20631 .
2023-08-31 11:02:57 +03:30
Lucas CHOLLET
3f35ffb648
Userland: Prefer _string
over _short_string
...
As `_string` can't fail anymore (since 3434412
), there are no real
benefits to use the short variant in most cases.
2023-08-08 07:37:21 +02:00
Andreas Kling
34344120f2
AK: Make "foo"_string infallible
...
Stop worrying about tiny OOMs.
Work towards #20405 .
2023-08-07 16:03:27 +02:00
Ali Mohammad Pur
da7bf5f785
Shell: Add support for the '!' POSIX pipeline prefix
...
This prefix simply inverts the exit code of the pipeline, which we
implement using the 'not' builtin.
2023-08-04 13:28:59 +03:30
Ali Mohammad Pur
1c1aa2c0d0
Shell: Handle (most) errors in the parsers
...
This turns all errors into either "OOM" or a proper shell error (if
propagation is impossible or meaningless).
Fixes `echo -en '\xfe\x4a' | $SHELL` crashing.
2023-07-01 17:01:54 +03:30
Ali Mohammad Pur
0d8b90aec6
Shell: Allow newlines before do
in POSIX for loops
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
fca5a34ad3
Shell: Allow assignment-prefixed commands to run builtins
...
`env` is not capable of running shell builtins, so make a simple
builtin in its place.
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
aecd91aedc
Shell: Correctly handle escaped quote characters in strings
...
Previously "foo\`bar" was treated literally, but \` is a valid escape
character.
This commit makes that string correctly evaluate as "foo`bar".
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
bbfedf17b7
Shell: Actually execute loop/case bodies when running them
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
7b031138fc
Shell: Correctly handle commands after heredoc contents
...
Previously we did not emit a newline after the ending heredoc key, which
wreaked havoc on the parser logic, leading to parse errors.
2023-05-05 09:35:24 +03:30
Ali Mohammad Pur
93413f8682
Shell: Use the correct range for named variable expansions
...
Previously we were starting the variable expansions before the starting
'$' and calculating the wrong length, this commit makes it so we
calculate the right range for them.
2023-05-05 09:35:24 +03:30
Tim Schumacher
9a6b5a53a7
Shell: Correctly mark the end line of a parsed list
2023-03-29 03:39:09 +03:30
Tim Schumacher
46c22ee49d
Shell: Allow appending empty string literals
...
Otherwise, we just silently drop arguments that are empty strings.
2023-03-29 03:39:09 +03:30
Tim Schumacher
c26639eac2
Shell: Properly skip POSIX Fi
tokens
2023-03-29 03:39:09 +03:30
Ali Mohammad Pur
7c312980b0
Shell: Implement arithmetic expansions for POSIX mode
...
This also adds a 'math' immediate function that can be used in Shell
proper to do arithmetic stuff.
2023-03-22 09:46:16 +01:00
Andreas Kling
8a48246ed1
Everywhere: Stop using NonnullRefPtrVector
...
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.
This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Linus Groh
51c3967516
Everywhere: Use '_{short_,}string' literals more
...
This mostly updates code what was written before but merged after these
were added.
2023-02-28 15:15:36 +00:00
Ali Mohammad Pur
b2b851b361
Shell: Convert the POSIX parser/lexer to ErrorOr
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
beeb58bd93
Shell+LibCodeComprehension: Start replacing {Deprecated => }String
...
This starts by switching all AST members to Strings, and dealing with
the fallout.
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
99d264afbe
Shell: Correct the out-of-bounds expansion bailing condition
...
Also adds a couple (useful) debug prints which helped track down the
problem.
2023-02-18 06:55:46 +03:30
Ali Mohammad Pur
2881bb4c3a
Shell: Add support for heredocs to the POSIX parser
2023-02-18 06:55:46 +03:30
Ali Mohammad Pur
2a276c86d4
Shell: Start implementing a POSIX-compliant parser
...
The parser is still very much a work-in-progress, but it can currently
parse most of the basic bits, the only *completely* unimplemented things
in the parser are:
- heredocs (io_here)
- alias expansion
- arithmetic expansion
There are a whole suite of bugs, and syntax highlighting is unreliable
at best.
For now, this is not attached anywhere, a future commit will enable it
for /bin/sh or a `Shell --posix` invocation.
2023-02-13 23:00:15 +03:30