@Override
	public void markOccurrences( RSyntaxDocument doc, Token t, RSyntaxTextAreaHighlighter h, SmartHighlightPainter p ) {
		char[] lexeme = t.getLexeme().toCharArray();
		int type = t.getType();
		int lineCount = doc.getDefaultRootElement().getElementCount();

		// make a copy of the token because it is overwritten in getTokenListForLine()
		Token t2 = new TokenImpl( t );

		// check whether token occurs more than once
		boolean mark = false;
		for( int i = 0; i < lineCount && !mark; i++ ) {
			Token temp = doc.getTokenListForLine( i );
			while( temp != null && temp.isPaintable() ) {
				if( temp.is( type, lexeme ) && temp.getOffset() != t2.getOffset() ) {
					mark = true;
					break;
				}
				temp = temp.getNextToken();
			}
		}

		if( mark )
			delegate.markOccurrences( doc, t2, h, p );
	}
Delegating occurrence marker that does not mark token at caret if it does
not occur elsewhere.

@author Karl Tauber
flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatOccurrenceMarker.java