MCPcopy Create free account
hub / github.com/SpartanJ/eepp / isAlreadyClosedTag

Function isAlreadyClosedTag

src/eepp/ui/uicodeeditor.cpp:5461–5486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5459}
5460
5461static bool isAlreadyClosedTag( TextDocument* doc, TextPosition start,
5462 size_t maxSearchTokens = 1000 ) {
5463 SyntaxHighlighter* highlighter = doc->getHighlighter();
5464 TextPosition endOfDoc = doc->endOfDoc();
5465 do {
5466 String::StringBaseType ch = doc->getChar( start );
5467 switch ( ch ) {
5468 case '>': {
5469 auto tokenType = highlighter->getTokenTypeAt( start );
5470 if ( tokenType != "comment"_sst && tokenType != "string"_sst )
5471 return true;
5472 break;
5473 }
5474 case '<': {
5475 auto tokenType = highlighter->getTokenTypeAt( start );
5476 if ( tokenType != "comment"_sst && tokenType != "string"_sst )
5477 return false;
5478 break;
5479 }
5480 default:
5481 break;
5482 }
5483 start = doc->positionOffset( start, 1 );
5484 } while ( start.isValid() && start != endOfDoc && --maxSearchTokens );
5485 return false;
5486}
5487
5488bool UICodeEditor::checkAutoCloseXMLTag( const String& text ) {
5489 if ( !mAutoCloseXMLTags || text.empty() || text.size() > 1 || text[0] != '>' ||

Callers 1

checkAutoCloseXMLTagMethod · 0.70

Calls 6

getHighlighterMethod · 0.80
endOfDocMethod · 0.80
getCharMethod · 0.80
getTokenTypeAtMethod · 0.80
positionOffsetMethod · 0.80
isValidMethod · 0.45

Tested by

no test coverage detected