mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:38:10 +00:00
Shell: Treat '(' and '{' as operators in POSIX mode
This commit is contained in:
parent
9e978c6cd1
commit
764ea6104e
3 changed files with 28 additions and 17 deletions
|
@ -197,6 +197,7 @@ struct State {
|
|||
StringBuilder buffer {};
|
||||
Reduction previous_reduction { Reduction::Start };
|
||||
bool escaping { false };
|
||||
bool in_skip_mode { false };
|
||||
AST::Position position {
|
||||
.start_offset = 0,
|
||||
.end_offset = 0,
|
||||
|
@ -320,6 +321,14 @@ struct Token {
|
|||
return Token::Type::Less;
|
||||
if (name == "\n"sv)
|
||||
return Token::Type::Newline;
|
||||
if (name == "("sv)
|
||||
return Token::Type::OpenParen;
|
||||
if (name == "{"sv)
|
||||
return Token::Type::OpenBrace;
|
||||
if (name == ")"sv)
|
||||
return Token::Type::CloseParen;
|
||||
if (name == "}"sv)
|
||||
return Token::Type::CloseBrace;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -431,6 +440,7 @@ private:
|
|||
explicit SkipTokens(Lexer& lexer)
|
||||
: m_state_change(lexer.m_state, lexer.m_state)
|
||||
{
|
||||
lexer.m_state.in_skip_mode = true;
|
||||
}
|
||||
|
||||
TemporaryChange<State> m_state_change;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue