Lines 17-25
Link Here
|
17 |
|
17 |
|
18 |
import java.text.CharacterIterator; |
18 |
import java.text.CharacterIterator; |
19 |
import java.util.HashMap; |
19 |
import java.util.HashMap; |
|
|
20 |
import java.util.HashSet; |
20 |
import java.util.Iterator; |
21 |
import java.util.Iterator; |
21 |
import java.util.Map; |
22 |
import java.util.Map; |
22 |
import java.util.ResourceBundle; |
23 |
import java.util.ResourceBundle; |
|
|
24 |
import java.util.Set; |
23 |
import java.util.Stack; |
25 |
import java.util.Stack; |
24 |
|
26 |
|
25 |
import org.eclipse.core.resources.IFile; |
27 |
import org.eclipse.core.resources.IFile; |
Lines 560-580
Link Here
|
560 |
private boolean isAngularIntroducer(String identifier) { |
562 |
private boolean isAngularIntroducer(String identifier) { |
561 |
return identifier.length() > 0 |
563 |
return identifier.length() > 0 |
562 |
&& (Character.isUpperCase(identifier.charAt(0)) |
564 |
&& (Character.isUpperCase(identifier.charAt(0)) |
563 |
|| identifier.equals("template") //$NON-NLS-1$ |
565 |
|| angularIntroducers.contains(identifier) |
564 |
|| identifier.equals("vector") //$NON-NLS-1$ |
566 |
|| identifier.endsWith("_ptr")); //$NON-NLS-1$ |
565 |
|| identifier.equals("list") //$NON-NLS-1$ |
|
|
566 |
|| identifier.equals("slist") //$NON-NLS-1$ |
567 |
|| identifier.equals("map") //$NON-NLS-1$ |
568 |
|| identifier.equals("set") //$NON-NLS-1$ |
569 |
|| identifier.equals("multimap") //$NON-NLS-1$ |
570 |
|| identifier.equals("multiset") //$NON-NLS-1$ |
571 |
|| identifier.equals("hash_map") //$NON-NLS-1$ |
572 |
|| identifier.equals("hash_set") //$NON-NLS-1$ |
573 |
|| identifier.equals("hash_multimap") //$NON-NLS-1$ |
574 |
|| identifier.equals("hash_multiset") //$NON-NLS-1$ |
575 |
|| identifier.equals("pair") //$NON-NLS-1$ |
576 |
|| identifier.endsWith("_ptr") //$NON-NLS-1$ |
577 |
|| identifier.endsWith("include")); //$NON-NLS-1$ |
578 |
} |
567 |
} |
579 |
|
568 |
|
580 |
/* |
569 |
/* |
Lines 607-613
Link Here
|
607 |
IRegion startLine = document.getLineInformationOfOffset(offset); |
596 |
IRegion startLine = document.getLineInformationOfOffset(offset); |
608 |
IRegion endLine = document.getLineInformationOfOffset(offset + length); |
597 |
IRegion endLine = document.getLineInformationOfOffset(offset + length); |
609 |
|
598 |
|
610 |
CHeuristicScanner scanner = new CHeuristicScanner(document); |
599 |
ITypedRegion partition = TextUtilities.getPartition(document, ICPartitions.C_PARTITIONING, offset, true); |
|
|
600 |
if (!IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType()) |
601 |
&& !ICPartitions.C_PREPROCESSOR.equals(partition.getType())) { |
602 |
return; |
603 |
} |
604 |
|
605 |
CHeuristicScanner scanner = new CHeuristicScanner(document, ICPartitions.C_PARTITIONING, partition.getType()); |
611 |
int nextToken = scanner.nextToken(offset + length, endLine.getOffset() + endLine.getLength()); |
606 |
int nextToken = scanner.nextToken(offset + length, endLine.getOffset() + endLine.getLength()); |
612 |
String next = nextToken == Symbols.TokenEOF ? null : document.get(offset, scanner.getPosition() - offset).trim(); |
607 |
String next = nextToken == Symbols.TokenEOF ? null : document.get(offset, scanner.getPosition() - offset).trim(); |
613 |
int prevToken = scanner.previousToken(offset - 1, startLine.getOffset()); |
608 |
int prevToken = scanner.previousToken(offset - 1, startLine.getOffset()); |
Lines 626-637
Link Here
|
626 |
case '<': |
621 |
case '<': |
627 |
if (!(fCloseAngularBrackets && fCloseBrackets) |
622 |
if (!(fCloseAngularBrackets && fCloseBrackets) |
628 |
|| nextToken == Symbols.TokenLESSTHAN |
623 |
|| nextToken == Symbols.TokenLESSTHAN |
629 |
|| prevToken != Symbols.TokenLBRACE |
624 |
|| prevToken != Symbols.TokenIDENT || !isAngularIntroducer(previous)) |
630 |
&& prevToken != Symbols.TokenRBRACE |
|
|
631 |
&& prevToken != Symbols.TokenSEMICOLON |
632 |
&& prevToken != Symbols.TokenSTATIC |
633 |
&& (prevToken != Symbols.TokenIDENT || !isAngularIntroducer(previous)) |
634 |
&& prevToken != Symbols.TokenEOF) |
635 |
return; |
625 |
return; |
636 |
break; |
626 |
break; |
637 |
|
627 |
|
Lines 657-667
Link Here
|
657 |
return; |
647 |
return; |
658 |
} |
648 |
} |
659 |
|
649 |
|
660 |
ITypedRegion partition = TextUtilities.getPartition(document, ICPartitions.C_PARTITIONING, offset, true); |
|
|
661 |
if (!IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType()) |
662 |
&& !ICPartitions.C_PREPROCESSOR.equals(partition.getType())) |
663 |
return; |
664 |
|
665 |
if (!validateEditorInputState()) |
650 |
if (!validateEditorInputState()) |
666 |
return; |
651 |
return; |
667 |
|
652 |
|
Lines 1555-1560
Link Here
|
1555 |
*/ |
1540 |
*/ |
1556 |
private SemanticHighlightingManager fSemanticManager; |
1541 |
private SemanticHighlightingManager fSemanticManager; |
1557 |
|
1542 |
|
|
|
1543 |
private static final Set angularIntroducers = new HashSet(); |
1544 |
static { |
1545 |
angularIntroducers.add("template"); //$NON-NLS-1$ |
1546 |
angularIntroducers.add("vector"); //$NON-NLS-1$ |
1547 |
angularIntroducers.add("deque"); //$NON-NLS-1$ |
1548 |
angularIntroducers.add("list"); //$NON-NLS-1$ |
1549 |
angularIntroducers.add("slist"); //$NON-NLS-1$ |
1550 |
angularIntroducers.add("map"); //$NON-NLS-1$ |
1551 |
angularIntroducers.add("set"); //$NON-NLS-1$ |
1552 |
angularIntroducers.add("multimap"); //$NON-NLS-1$ |
1553 |
angularIntroducers.add("multiset"); //$NON-NLS-1$ |
1554 |
angularIntroducers.add("hash_map"); //$NON-NLS-1$ |
1555 |
angularIntroducers.add("hash_set"); //$NON-NLS-1$ |
1556 |
angularIntroducers.add("hash_multimap"); //$NON-NLS-1$ |
1557 |
angularIntroducers.add("hash_multiset"); //$NON-NLS-1$ |
1558 |
angularIntroducers.add("pair"); //$NON-NLS-1$ |
1559 |
angularIntroducers.add("include"); //$NON-NLS-1$ |
1560 |
} |
1561 |
|
1558 |
|
1562 |
|
1559 |
/** |
1563 |
/** |
1560 |
* Default constructor. |
1564 |
* Default constructor. |