Skip to content

Commit

Permalink
[Bash] Don't nest ${} parameter expansion on {.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Dec 3, 2023
1 parent 65354fe commit 4ed2335
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scintilla/lexers/LexBash.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ enum {
#define HERE_DELIM_MAX 256

// state constants for parts of a bash command segment
enum class CmdState {
enum class CmdState : uint8_t {
Body,
Start,
Word,
Expand All @@ -57,7 +57,7 @@ enum class CmdState {

// state constants for nested delimiter pairs, used by
// SCE_SH_STRING, SCE_SH_PARAM and SCE_SH_BACKTICKS processing
enum class QuoteStyle {
enum class QuoteStyle : uint8_t {
Literal, // ''
CString, // $''
String, // ""
Expand Down Expand Up @@ -203,7 +203,7 @@ class QuoteCls { // Class to manage quote pairs (simplified vs LexPerl)
int Up = '\0';
int Down = '\0';
QuoteStyle Style = QuoteStyle::Literal;
int Outer = SCE_SH_DEFAULT;
uint8_t Outer = SCE_SH_DEFAULT;
CmdState State = CmdState::Body;
void Clear() noexcept {
Count = 0;
Expand All @@ -218,7 +218,7 @@ class QuoteCls { // Class to manage quote pairs (simplified vs LexPerl)
Up = u;
Down = opposite(Up);
Style = s;
Outer = outer;
Outer = static_cast<uint8_t>(outer);
State = state;
}
};
Expand Down Expand Up @@ -651,7 +651,9 @@ void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int initStyle
continue;
}
} else if (sc.ch == QuoteStack.Current.Up) {
QuoteStack.Current.Count++;
if (QuoteStack.Current.Style != QuoteStyle::Parameter) {
QuoteStack.Current.Count++;
}
} else {
if (QuoteStack.Current.Style == QuoteStyle::String ||
QuoteStack.Current.Style == QuoteStyle::HereDoc ||
Expand Down

0 comments on commit 4ed2335

Please sign in to comment.