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