diff options
| author | nyamatongwe <unknown> | 2001-01-18 11:04:33 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2001-01-18 11:04:33 +0000 | 
| commit | c9e16e4c1635bf87b774babcec00c6e66ecb0ec5 (patch) | |
| tree | d9f8a350d17f569656a6efb8805aa92dd27e399a | |
| parent | 55ebbc8553e3abe46dcfad610630905fbbd9df90 (diff) | |
| download | scintilla-mirror-c9e16e4c1635bf87b774babcec00c6e66ecb0ec5.tar.gz | |
Patch from Steffen to simplify handling of quoted strings by reusing the
code developed for the complex strings.
| -rw-r--r-- | src/LexPerl.cxx | 53 | 
1 files changed, 17 insertions, 36 deletions
| diff --git a/src/LexPerl.cxx b/src/LexPerl.cxx index 82e2e2345..443aad8f5 100644 --- a/src/LexPerl.cxx +++ b/src/LexPerl.cxx @@ -258,6 +258,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,  			} else if (ch == '\"') {  				styler.ColourTo(i - 1, state);  				state = SCE_PL_STRING; +				Quote.New(1); +				Quote.Open(ch);  			} else if (ch == '\'') {  				if (chPrev == '&') {  					// Archaic call @@ -265,10 +267,14 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,  				} else {  					styler.ColourTo(i - 1, state);  					state = SCE_PL_CHARACTER; +					Quote.New(1); +					Quote.Open(ch);  				}  			} else if (ch == '`') {  				styler.ColourTo(i - 1, state);  				state = SCE_PL_BACKTICKS; +				Quote.New(1); +				Quote.Open(ch);  			} else if (ch == '$') {  				preferRE = false;  				styler.ColourTo(i - 1, state); @@ -360,8 +366,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,  						state = SCE_PL_COMMENTLINE;  					} else if (ch == '\"') {  						state = SCE_PL_STRING; +						Quote.New(1); +						Quote.Open(ch);  					} else if (ch == '\'') {  						state = SCE_PL_CHARACTER; +						Quote.New(1); +						Quote.Open(ch);  					} else if (ch == '<' && chNext == '<') {  						state = SCE_PL_HERE_DELIM;  						HereDoc.State = 0; @@ -467,42 +477,6 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,  					ch = chNext;  					chNext = styler.SafeGetCharAt(i + 1);  				} -			} else if (state == SCE_PL_STRING) { -				if (ch == '\\') { -					if (chNext == '\"' || chNext == '\'' || chNext == '\\') { -						i++; -						ch = chNext; -						chNext = styler.SafeGetCharAt(i + 1); -					} -				} else if (ch == '\"') { -					styler.ColourTo(i, state); -					state = SCE_PL_DEFAULT; -					i++; -					ch = chNext; -					chNext = styler.SafeGetCharAt(i + 1); -				} -			} else if (state == SCE_PL_CHARACTER) { -				if (ch == '\\') { -					if (chNext == '\"' || chNext == '\'' || chNext == '\\') { -						i++; -						ch = chNext; -						chNext = styler.SafeGetCharAt(i + 1); -					} -				} else if (ch == '\'') { -					styler.ColourTo(i, state); -					state = SCE_PL_DEFAULT; -					i++; -					ch = chNext; -					chNext = styler.SafeGetCharAt(i + 1); -				} -			} else if (state == SCE_PL_BACKTICKS) { -				if (ch == '`') { -					styler.ColourTo(i, state); -					state = SCE_PL_DEFAULT; -					i++; -					ch = chNext; -					chNext = styler.SafeGetCharAt(i + 1); -				}  			} else if (state == SCE_PL_POD) {  				if (ch == '=' && isEOLChar(chPrev)) {  					if (isMatch(styler, lengthDoc, i, "=cut")) { @@ -631,6 +605,9 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,  				|| state == SCE_PL_STRING_QQ  				|| state == SCE_PL_STRING_QX  				|| state == SCE_PL_STRING_QW +				|| state == SCE_PL_STRING +				|| state == SCE_PL_CHARACTER +				|| state == SCE_PL_BACKTICKS  				) {  				if (!Quote.Down && !isspace(ch)) {  					Quote.Open(ch); @@ -661,8 +638,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,  					state = SCE_PL_COMMENTLINE;  				} else if (ch == '\"') {  					state = SCE_PL_STRING; +					Quote.New(1); +					Quote.Open(ch);  				} else if (ch == '\'') {  					state = SCE_PL_CHARACTER; +					Quote.New(1); +					Quote.Open(ch);  				} else if (iswordstart(ch)) {  					state = SCE_PL_WORD;  					preferRE = false; | 
