From beb6b1b0ba5ee457523b07df184a50144d09d745 Mon Sep 17 00:00:00 2001 From: James Ribe Date: Thu, 29 Mar 2012 13:18:06 -0500 Subject: Fixed a bug with the bash lexer's handling of singly-quoted strings. SF Bug Tracker ID: 3512208 --- lexers/LexBash.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx index 165e10498..8cd6cc570 100644 --- a/lexers/LexBash.cxx +++ b/lexers/LexBash.cxx @@ -425,7 +425,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, } break; case SCE_SH_STRING: // delimited styles - case SCE_SH_CHARACTER: case SCE_SH_BACKTICKS: case SCE_SH_PARAM: if (sc.ch == '\\' && Quote.Up != '\\') { @@ -439,6 +438,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, Quote.Count++; } break; + case SCE_SH_CHARACTER: // singly-quoted strings + if (sc.ch == Quote.Down) { + Quote.Count--; + if (Quote.Count == 0) { + sc.ForwardSetState(SCE_SH_DEFAULT); + } + } + break; } // Must check end of HereDoc state 1 before default state is handled @@ -507,7 +514,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, if (sc.ch == '{') { sc.ChangeState(SCE_SH_PARAM); } else if (sc.ch == '\'') { - sc.ChangeState(SCE_SH_CHARACTER); + sc.ChangeState(SCE_SH_STRING); } else if (sc.ch == '"') { sc.ChangeState(SCE_SH_STRING); } else if (sc.ch == '(' || sc.ch == '`') { -- cgit v1.2.3