aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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 /src
parent14e262a08fdf37ad19b1aa27752087a87a010b84 (diff)
downloadscintilla-mirror-333ea3c38156a54b7de9cc5c826dc3fa6d77887a.tar.gz
Patch from Nic Jansma enables recognition of batch file variables delimited
by ! as used when ENABLEDELAYEDEXPANSION set.
Diffstat (limited to 'src')
-rw-r--r--src/LexOthers.cxx27
1 files changed, 27 insertions, 0 deletions
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++;