@@ -395,14 +395,11 @@ _tokenize( const SyntaxDefinition& syntax, const std::string& text, const Syntax
395
395
while ( currentBytePos < fullMatchEnd ) {
396
396
size_t currentCaptureIndex =
397
397
priorityMap[currentBytePos - fullMatchStart];
398
- SyntaxStyleType currentType = SyntaxStyleEmpty ();
399
-
400
- if ( currentCaptureIndex < pattern.types .size () ) {
401
- currentType = pattern.types [currentCaptureIndex];
402
- } else {
403
- currentType = pattern.types .empty () ? SyntaxStyleTypes::Normal
404
- : pattern.types [0 ];
405
- }
398
+ SyntaxStyleType currentType =
399
+ currentCaptureIndex < pattern.types .size ()
400
+ ? pattern.types [currentCaptureIndex]
401
+ : ( pattern.types .empty () ? SyntaxStyleTypes::Normal
402
+ : pattern.types [0 ] );
406
403
407
404
int segmentEndBytePos = currentBytePos + 1 ;
408
405
while ( segmentEndBytePos < fullMatchEnd &&
@@ -416,30 +413,26 @@ _tokenize( const SyntaxDefinition& syntax, const std::string& text, const Syntax
416
413
417
414
if ( currentType == SyntaxStyleTypes::Symbol ||
418
415
currentType == SyntaxStyleTypes::Normal ) {
419
- patternTextStr = segmentText; // Need a std::string for lookup
420
- SyntaxStyleType symbolType =
421
- curState.currentSyntax ->getSymbol ( patternTextStr );
416
+ SyntaxStyleType symbolType = curState.currentSyntax ->getSymbol (
417
+ ( patternTextStr = segmentText ) );
422
418
if ( symbolType != SyntaxStyleEmpty () ) {
423
419
currentType = symbolType;
424
420
} else if ( currentType == SyntaxStyleTypes::Symbol ) {
425
421
currentType = SyntaxStyleTypes::Normal;
426
422
}
427
423
}
428
424
429
- bool skipThisToken = skipSubSyntaxSeparator && pattern.hasSyntax ();
430
-
431
- if ( !skipThisToken )
425
+ if ( !( skipSubSyntaxSeparator && pattern.hasSyntax () ) )
432
426
pushToken ( tokens, currentType, segmentText );
433
427
434
428
currentBytePos = segmentEndBytePos;
435
429
}
436
430
437
- patternTextStr =
438
- textv.substr ( fullMatchStart, fullMatchEnd - fullMatchStart );
439
-
440
431
if ( pattern.hasSyntax () ) {
441
432
pushSubsyntax ( curState, retState, pattern, patternIndex + 1 ,
442
- patternTextStr );
433
+ ( patternTextStr =
434
+ textv.substr ( fullMatchStart,
435
+ fullMatchEnd - fullMatchStart ) ) );
443
436
} else if ( pattern.patterns .size () > 1 ) {
444
437
setSubsyntaxPatternIdx ( curState, retState, patternIndex + 1 );
445
438
}
0 commit comments