MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / isEndDeclareSectionSQL

Method isEndDeclareSectionSQL

other_src/astyle/src/ASEnhancer.cpp:434–473  ·  view source on GitHub ↗

* check for SQL "END DECLARE SECTION". * must compare case insensitive and allow any spacing between words. * * @param line a reference to the line to indent. * @param index the current line index. * @return true if a hit. */

Source from the content-addressed store, hash-verified

432 * @return true if a hit.
433 */
434bool ASEnhancer::isEndDeclareSectionSQL(string& line, size_t index) const
435{
436 string word;
437 size_t hits = 0;
438 size_t i;
439 for (i = index; i < line.length(); i++)
440 {
441 i = line.find_first_not_of(" \t", i);
442 if (i == string::npos)
443 return false;
444 if (line[i] == ';')
445 break;
446 if (!isCharPotentialHeader(line, i))
447 continue;
448 word = getCurrentWord(line, i);
449 for (size_t j = 0; j < word.length(); j++)
450 word[j] = (char) toupper(word[j]);
451 if (word == "EXEC" || word == "SQL")
452 {
453 i += word.length() - 1;
454 continue;
455 }
456 if (word == "DECLARE" || word == "SECTION")
457 {
458 hits++;
459 i += word.length() - 1;
460 continue;
461 }
462 if (word == "END")
463 {
464 hits++;
465 i += word.length() - 1;
466 continue;
467 }
468 return false;
469 }
470 if (hits == 3)
471 return true;
472 return false;
473}
474
475/**
476 * check if a one-line bracket has been reached,

Callers

nothing calls this directly

Calls 2

toupperFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected