@@ -158,6 +158,7 @@ static const tchar_t * s_apszFsKeywordList[] =
158
158
_T (" Char" ),
159
159
_T (" DateTime" ),
160
160
_T (" Decimal" ),
161
+ _T (" Guid" ),
161
162
_T (" Int16" ),
162
163
_T (" Int32" ),
163
164
_T (" Int64" ),
@@ -197,17 +198,20 @@ unsigned
197
198
CrystalLineParser::ParseLineFSharp (unsigned dwCookie, const tchar_t *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems)
198
199
{
199
200
if (nLength == 0 )
200
- return dwCookie & COOKIE_EXT_COMMENT;
201
+ return dwCookie & ( COOKIE_EXT_COMMENT | COOKIE_RAWSTRING) ;
201
202
202
- bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT) == 0 ;
203
+ bool bFirstChar = (dwCookie & ~COOKIE_EXT_COMMENT & ~COOKIE_RAWSTRING ) == 0 ;
203
204
const tchar_t * pszCommentBegin = nullptr ;
204
205
const tchar_t * pszCommentEnd = nullptr ;
206
+ const tchar_t * pszTextBegin = nullptr ;
207
+ const tchar_t * pszTextEnd = nullptr ;
205
208
bool bRedefineBlock = true ;
206
209
bool bDecIndex = false ;
207
210
int nIdentBegin = -1 ;
208
211
int nPrevI = -1 ;
212
+ int nPrevII = -2 ;
209
213
int I = 0 ;
210
- for (I = 0 ;; nPrevI = I, I = static_cast <int >(tc::tcharnext (pszChars + I) - pszChars))
214
+ for (I = 0 ;; nPrevII=nPrevI, nPrevI = I, I = static_cast <int >(tc::tcharnext (pszChars + I) - pszChars))
211
215
{
212
216
if (I == nPrevI)
213
217
{
@@ -225,7 +229,7 @@ CrystalLineParser::ParseLineFSharp (unsigned dwCookie, const tchar_t *pszChars,
225
229
{
226
230
DEFINE_BLOCK (nPos, COLORINDEX_COMMENT);
227
231
}
228
- else if (dwCookie & (COOKIE_CHAR | COOKIE_STRING))
232
+ else if (dwCookie & (COOKIE_CHAR | COOKIE_STRING | COOKIE_RAWSTRING ))
229
233
{
230
234
DEFINE_BLOCK (nPos, COLORINDEX_STRING);
231
235
}
@@ -305,6 +309,25 @@ CrystalLineParser::ParseLineFSharp (unsigned dwCookie, const tchar_t *pszChars,
305
309
break ;
306
310
}
307
311
312
+ // Multi-line string constant """...."""
313
+ if (dwCookie & COOKIE_RAWSTRING)
314
+ {
315
+ if ((pszTextBegin < pszChars + I) && (I > 1 && pszChars[I] == ' "' && pszChars[nPrevI] == ' "' && pszChars[nPrevII] == ' "' ))
316
+ {
317
+ dwCookie &= ~COOKIE_RAWSTRING;
318
+ bRedefineBlock = true ;
319
+ pszTextEnd = pszChars + I + 2 ;
320
+ }
321
+ continue ;
322
+ }
323
+
324
+ if ((pszTextEnd < pszChars + I) && (I > 1 && pszChars[I] == ' "' && pszChars[nPrevI] == ' "' && pszChars[nPrevII] == ' "' ))
325
+ {
326
+ DEFINE_BLOCK (nPrevII, COLORINDEX_STRING);
327
+ dwCookie |= COOKIE_RAWSTRING;
328
+ break ;
329
+ }
330
+
308
331
// Preprocessor directive #....
309
332
if (dwCookie & COOKIE_PREPROCESSOR)
310
333
{
@@ -313,11 +336,17 @@ CrystalLineParser::ParseLineFSharp (unsigned dwCookie, const tchar_t *pszChars,
313
336
DEFINE_BLOCK (nPrevI, COLORINDEX_COMMENT);
314
337
dwCookie |= COOKIE_EXT_COMMENT;
315
338
}
339
+ if ((pszTextEnd < pszChars + I) && (I > 1 && pszChars[I] == ' "' && pszChars[nPrevI] == ' "' && pszChars[nPrevII] == ' "' ))
340
+ {
341
+ DEFINE_BLOCK (nPrevII, COLORINDEX_STRING);
342
+ dwCookie |= COOKIE_RAWSTRING;
343
+ break ;
344
+ }
316
345
continue ;
317
346
}
318
347
319
348
// Normal text
320
- if (pszChars[I] == ' "' )
349
+ if (pszChars[I] == ' "' && (I < 2 || pszChars[nPrevI] != ' " ' || pszChars[nPrevII] != ' " ' ) )
321
350
{
322
351
DEFINE_BLOCK (I, COLORINDEX_STRING);
323
352
dwCookie |= COOKIE_STRING;
@@ -340,6 +369,13 @@ CrystalLineParser::ParseLineFSharp (unsigned dwCookie, const tchar_t *pszChars,
340
369
pszCommentBegin = pszChars + I + 1 ;
341
370
continue ;
342
371
}
372
+ if ((pszTextEnd < pszChars + I) && (I > 1 && pszChars[I] == ' "' && pszChars[nPrevI] == ' "' && pszChars[nPrevII] == ' "' ))
373
+ {
374
+ DEFINE_BLOCK (nPrevII, COLORINDEX_STRING);
375
+ dwCookie |= COOKIE_RAWSTRING;
376
+ pszTextBegin = pszChars + I + 1 ;
377
+ continue ;
378
+ }
343
379
344
380
if (bFirstChar)
345
381
{
@@ -443,6 +479,7 @@ CrystalLineParser::ParseLineFSharp (unsigned dwCookie, const tchar_t *pszChars,
443
479
}
444
480
445
481
if (pszChars[nLength - 1 ] != ' \\ ' || IsMBSTrail (pszChars, nLength - 1 ))
446
- dwCookie &= COOKIE_EXT_COMMENT;
482
+ dwCookie &= (COOKIE_EXT_COMMENT | COOKIE_RAWSTRING);
483
+
447
484
return dwCookie;
448
485
}
0 commit comments