aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2009-05-03 09:30:56 +0000
committernyamatongwe <unknown>2009-05-03 09:30:56 +0000
commit333ea3c38156a54b7de9cc5c826dc3fa6d77887a (patch)
treebba9fdaef281b9e9f9621379ac06f590dd74c935
parent14e262a08fdf37ad19b1aa27752087a87a010b84 (diff)
downloadscintilla-mirror-333ea3c38156a54b7de9cc5c826dc3fa6d77887a.tar.gz
Patch from Nic Jansma enables recognition of batch file variables delimited
by ! as used when ENABLEDELAYEDEXPANSION set.
-rw-r--r--doc/ScintillaHistory.html1
-rw-r--r--src/LexOthers.cxx27
2 files changed, 28 insertions, 0 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index c5ec27d84..2e33a319b 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -332,6 +332,7 @@
<td>James Moffatt</td>
</tr><tr>
<td>Yuzhou Xin</td>
+ <td>Nic Jansma</td>
</tr>
</table>
<p>
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx
index 3c6940bfc..1869014f8 100644
--- a/src/LexOthers.cxx
+++ b/src/LexOthers.cxx
@@ -213,6 +213,7 @@ static void ColouriseBatchLine(
// No need to Reset Offset
// Check for Special Keyword in list, External Command / Program, or Default Text
} else if ((wordBuffer[0] != '%') &&
+ (wordBuffer[0] != '!') &&
(!IsBOperator(wordBuffer[0])) &&
(continueProcessing)) {
// Check for Special Keyword
@@ -249,6 +250,7 @@ static void ColouriseBatchLine(
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
+ (wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
@@ -298,6 +300,7 @@ static void ColouriseBatchLine(
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
+ (wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
@@ -370,6 +373,29 @@ static void ColouriseBatchLine(
// Reset Offset to re-process remainder of word
offset -= (wbl - 3);
}
+ // Check for Environment Variable (!x...!)
+ } else if (wordBuffer[0] == '!') {
+ // Colorize Default Text
+ styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
+ wbo++;
+ // Search to end of word for second ! (can be a long path)
+ while ((wbo < wbl) &&
+ (wordBuffer[wbo] != '!') &&
+ (!IsBOperator(wordBuffer[wbo])) &&
+ (!IsBSeparator(wordBuffer[wbo]))) {
+ wbo++;
+ }
+ if (wordBuffer[wbo] == '!') {
+ wbo++;
+ // Check for External Command / Program
+ if (cmdLoc == offset - wbl) {
+ cmdLoc = offset - (wbl - wbo);
+ }
+ // Colorize Environment Variable
+ styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
+ // Reset Offset to re-process remainder of word
+ offset -= (wbl - wbo);
+ }
// Check for Operator
} else if (IsBOperator(wordBuffer[0])) {
// Colorize Default Text
@@ -417,6 +443,7 @@ static void ColouriseBatchLine(
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
+ (wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;