aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexPascal.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-01-27 06:19:32 +0000
committernyamatongwe <unknown>2001-01-27 06:19:32 +0000
commitb1dda3b3d051444939e3bc5bc47cd23b5d13c8c0 (patch)
tree2e32700a049f351c66f69b83319abacfab974df5 /src/LexPascal.cxx
parentba22db923ee18c31a0a8797dbe1e6c6c3ec2e4e0 (diff)
downloadscintilla-mirror-b1dda3b3d051444939e3bc5bc47cd23b5d13c8c0.tar.gz
Patch from Laurent to handle comments such as {} and { } correctly.
Diffstat (limited to 'src/LexPascal.cxx')
-rw-r--r--src/LexPascal.cxx26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/LexPascal.cxx b/src/LexPascal.cxx
index ee568c77f..458640767 100644
--- a/src/LexPascal.cxx
+++ b/src/LexPascal.cxx
@@ -42,7 +42,6 @@ static int classifyWordPascal(unsigned int start, unsigned int end, WordList &ke
static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
-
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
@@ -97,10 +96,15 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch) || (ch == '@')) {
styler.ColourTo(i-1, state);
- state = SCE_C_IDENTIFIER;
+ state = SCE_C_IDENTIFIER;
} else if (ch == '{' && chNext != '$' && chNext != '&') {
styler.ColourTo(i-1, state);
- state = SCE_C_COMMENT;
+ state = SCE_C_COMMENT;
+ } else if (ch == '(' && chNext == '*'
+ && styler.SafeGetCharAt(i + 2) != '$'
+ && styler.SafeGetCharAt(i + 2) != '&') {
+ styler.ColourTo(i-1, state);
+ state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i-1, state);
state = SCE_C_COMMENTLINE;
@@ -125,6 +129,11 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '{' && chNext != '$' && chNext != '&') {
state = SCE_C_COMMENT;
+ } else if (ch == '(' && chNext == '*'
+ && styler.SafeGetCharAt(i + 2) != '$'
+ && styler.SafeGetCharAt(i + 2) != '&') {
+ styler.ColourTo(i-1, state);
+ state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\"') {
@@ -149,11 +158,16 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
}
} else if (state == SCE_C_COMMENT) {
if (ch == '}' ) {
+ styler.ColourTo(i, state);
+ state = SCE_C_DEFAULT;
+ }
+ } else if (state == SCE_C_COMMENTDOC) {
+ if (ch == ')' && chPrev == '*') {
if (((i > styler.GetStartSegment() + 2) || (
- (initStyle == SCE_C_COMMENT) &&
+ (initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
- styler.ColourTo(i, state);
- state = SCE_C_DEFAULT;
+ styler.ColourTo(i, state);
+ state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {