22#include "../../common/Options.h"
23#include "../../kernel/core/ui/language.hpp"
24#include "../../kernel/core/procedure/includer.hpp"
26#define ANNOTATION_NOTE wxSTC_NSCR_PROCEDURE_COMMANDS+1
27#define ANNOTATION_WARN wxSTC_NSCR_PROCEDURE_COMMANDS+2
28#define ANNOTATION_ERROR wxSTC_NSCR_PROCEDURE_COMMANDS+3
30#define HIGHLIGHT_ANNOTATION 12
37 sStr.replace(sStr.find_first_of(
" ("), std::string::npos,
"()");
97 m_editor->AnnotationSetVisible(wxSTC_ANNOTATION_BOXED);
102 bool isContinuedLine =
false;
103 bool isAlreadyMeasured =
false;
104 bool isSuppressed =
false;
109 string sFirstLine =
"";
110 string sFirstStyles =
"";
125 if (m_nCurrentLine < m_editor->LineFromPosition(
m_nCurPos))
134 && sLine.find_first_not_of(
"\n\r\t") != string::npos
135 && sLine.find_first_not_of(
"0123456789eE+-*/.,;^(){} \t\r\n") == string::npos)
139 if (sLine.find(
"\\\\") != string::npos)
140 isContinuedLine =
true;
143 isContinuedLine =
false;
152 if (nFirstLine < 0 && m_nCurrentLine >= 0)
171 if (sLine.rfind(
"##") != string::npos)
172 sLine.erase(sLine.rfind(
"##"));
175 size_t nBlockStart = 0;
177 while ((nBlockStart = sLine.find(
"#*")) != string::npos)
179 if (sLine.find(
"*#", nBlockStart+2) == string::npos)
181 sLine.erase(nBlockStart);
186 sLine.erase(nBlockStart, sLine.find(
"*#", nBlockStart+2)+2 - nBlockStart);
191 size_t lastVisibleChar = sLine.find_last_not_of(
" \t\r\n");
194 if (lastVisibleChar != string::npos
195 && (sLine[lastVisibleChar] ==
';' || (lastVisibleChar > 0 && sLine.substr(lastVisibleChar-1, 2) ==
"\\\\")))
198 isSuppressed =
false;
209 if (sLine.length() && sLine.find_first_not_of(
" \n\r\t") != string::npos)
212 isAlreadyMeasured =
true;
225 double dCommentDensity = (double)nNumberOfComments / (
double)nLinesOfCode;
252 if (sWord !=
"matop" && sWord !=
"mtrxop")
334 else if (sFirstLine.length())
360 bool canContinue =
false;
365 string sSyntaxElement =
m_editor->GetTextRange(wordstart, wordend).ToStdString();
368 if (sSyntaxElement ==
"throw")
372 if (
m_editor->GetStyleAt(j) == wxSTC_NSCR_STRING
373 ||
m_editor->GetStyleAt(j) == wxSTC_NSCR_STRING_PARSER
374 ||
m_editor->GetStyleAt(j) == wxSTC_NSCR_CLUSTER
375 ||
m_editor->GetStyleAt(j) == wxSTC_NSCR_IDENTIFIER)
390 if (sSyntaxElement ==
"namespace")
393 while (sArgs.back() ==
'\r' || sArgs.back() ==
'\n')
417 if (sSyntaxElement ==
"install" || sSyntaxElement ==
"uninstall" || sSyntaxElement ==
"start")
423 if (sSyntaxElement ==
"matop" || sSyntaxElement ==
"mtrxop")
425 else if (sSyntaxElement ==
"draw" || sSyntaxElement ==
"draw3d")
429 if (sSyntaxElement ==
"clear" || sSyntaxElement ==
"delete" || sSyntaxElement ==
"remove")
432 if (sSyntaxElement ==
"remove" &&
m_editor->GetStyleAt(
m_editor->WordStartPosition(wordend + 1,
true)) == wxSTC_NSCR_PREDEFS)
437 while (sArgs.back() ==
'\r' || sArgs.back() ==
'\n' || sArgs.back() ==
';')
443 && (sSyntaxElement !=
"remove" ||
m_editor->GetStyleAt(
m_editor->WordStartPosition(wordend + 1,
true)) != wxSTC_NSCR_CUSTOM_FUNCTION))
449 if (sSyntaxElement !=
"hline"
450 && sSyntaxElement !=
"continue"
451 && sSyntaxElement !=
"break"
452 && sSyntaxElement !=
"else"
454 && sSyntaxElement !=
"about"
455 && sSyntaxElement !=
"abort"
456 && sSyntaxElement !=
"compose"
457 && sSyntaxElement !=
"layout"
458 && sSyntaxElement !=
"group"
459 && sSyntaxElement !=
"help"
460 && sSyntaxElement !=
"quit"
461 && sSyntaxElement !=
"return"
462 && sSyntaxElement !=
"subplot"
463 && sSyntaxElement !=
"try"
464 && sSyntaxElement !=
"catch"
465 && sSyntaxElement !=
"otherwise"
466 && sSyntaxElement !=
"throw"
467 && sSyntaxElement !=
"rethrow"
468 && sSyntaxElement !=
"namespace"
475 while (sArgs.back() ==
'\r' || sArgs.back() ==
'\n')
497 if (sSyntaxElement ==
"zeroes"
498 || sSyntaxElement ==
"extrema"
499 || sSyntaxElement ==
"integrate"
500 || sSyntaxElement ==
"load"
501 || sSyntaxElement ==
"reload"
502 || sSyntaxElement ==
"append"
503 || sSyntaxElement ==
"imread"
504 || sSyntaxElement ==
"eval"
505 || sSyntaxElement ==
"taylor"
506 || sSyntaxElement ==
"get"
507 || sSyntaxElement ==
"read"
508 || sSyntaxElement ==
"pulse"
509 || sSyntaxElement ==
"diff")
529 if (sSyntaxElement ==
"if" || sSyntaxElement ==
"elseif" || sSyntaxElement ==
"while" || sSyntaxElement ==
"switch")
553 string sArgument =
m_editor->GetTextRange(j + 1, nPos).ToStdString();
557 if (!sArgument.length())
564 if (sArgument ==
"true" || (sArgument.find_first_not_of(
"1234567890.") == string::npos && sArgument !=
"0"))
566 if (sSyntaxElement ==
"while")
568 else if (sSyntaxElement ==
"switch")
573 else if (sArgument ==
"false" || sArgument ==
"0")
575 if (sSyntaxElement ==
"while")
577 else if (sSyntaxElement ==
"switch")
598 if (vBlock.back() != wxSTC_INVALID_POSITION)
606 for (
int pos = wordend; pos <= vBlock.back(); pos++)
608 if (
m_editor->GetStyleAt(pos) == wxSTC_NSCR_COMMAND
620 pos =
m_editor->WordEndPosition(pos,
true);
634 if (sSyntaxElement ==
"switch")
639 for (
size_t i = 1; i < vBlock.size(); i++)
642 if (vBlock[i] == wxSTC_INVALID_POSITION)
646 if (
m_editor->GetTextRange(vBlock[i],
m_editor->WordEndPosition(vBlock[i],
true)) ==
"case")
651 else if (
m_editor->GetTextRange(vBlock[i],
m_editor->WordEndPosition(vBlock[i],
true)) ==
"default")
657 else if (
m_editor->GetTextRange(vBlock[i],
m_editor->WordEndPosition(vBlock[i],
true)) ==
"endswitch")
675 for (
size_t i = 0; i < vBlock.size(); i++)
678 if (vBlock[i] == wordstart)
680 if (vBlock[i+1] != wxSTC_INVALID_POSITION
681 &&
m_editor->GetTextRange(vBlock[i+1],
m_editor->WordEndPosition(vBlock[i+1],
true)) !=
"endswitch")
688 if (!vMatches.size())
708 if (sLine.find_first_not_of(
":\r\n#* ") == string::npos || sLine.find(
':') == string::npos)
727 size_t nOpPos = std::string::npos;
739 string sArgument =
m_editor->GetTextRange(j + 1, nPos).ToStdString();
744 if (!sArgument.length())
753 if ((nOpPos = sArgument.find(
"->")) != std::string::npos)
756 if (nOpPos >= sArgument.length()-2
757 || (!isalpha(sArgument.front()) && sArgument.front() !=
'_' && sArgument.front() !=
'{'))
767 nOpPos = sArgument.find(
'=');
770 if (nOpPos >= sArgument.length()-1
771 || (!isalpha(sArgument.front()) && sArgument.front() !=
'_'))
786 for (
int i = j+1; i < (int)nOpPos; i++)
788 if (
m_editor->GetStyleAt(i) == wxSTC_NPRC_IDENTIFIER
789 ||
m_editor->GetStyleAt(i) == wxSTC_NPRC_CUSTOM_FUNCTION
790 ||
m_editor->GetStyleAt(i) == wxSTC_NPRC_CLUSTER)
794 m_editor->WordEndPosition(i,
true)).ToStdString(),
797 i =
m_editor->WordEndPosition(i,
true);
810 && (sSyntaxElement ==
"var" || sSyntaxElement ==
"str" || sSyntaxElement ==
"tab" || sSyntaxElement ==
"cst"))
813 if (sSyntaxElement ==
"var"
824 int nProcedureEndPosition =
m_editor->FindText(nNextLineStartPosition,
827 wxSTC_FIND_MATCHCASE | wxSTC_FIND_WHOLEWORD);
829 int nStyle = wxSTC_NSCR_IDENTIFIER;
831 if (sSyntaxElement ==
"tab")
832 nStyle = wxSTC_NSCR_CUSTOM_FUNCTION;
833 else if (sSyntaxElement ==
"cst")
834 nStyle = wxSTC_NSCR_CLUSTER;
839 while (sArgs.back() ==
'\r' || sArgs.back() ==
'\n')
845 if (nProcedureEndPosition == -1)
847 nProcedureEndPosition =
m_editor->GetLastPosition();
865 if (currentArg.find(
'=') != string::npos)
866 currentArg.erase(currentArg.find(
'='));
868 if (currentArg.find_first_of(
"({;") != string::npos)
869 currentArg.erase(currentArg.find_first_of(
"({;"));
873 if (!currentArg.length())
887 if (sSyntaxElement ==
"str")
889 else if (sSyntaxElement ==
"var")
894 && sChars.find(cType) == std::string::npos)
904 && !
m_editor->
m_search->
FindAll(currentArg, nStyle, nNextLineStartPosition, nProcedureEndPosition,
false).size())
908 highlightFoundOccurence(currentArg,
m_editor->FindText(wordstart, nProcedureEndPosition, currentArg, wxSTC_FIND_MATCHCASE | wxSTC_FIND_WHOLEWORD), currentArg.length()),
922 if (sSyntaxElement ==
"define"
923 || sSyntaxElement ==
"ifndefined"
924 || sSyntaxElement ==
"lclfunc"
925 || sSyntaxElement ==
"def"
926 || sSyntaxElement ==
"ifndef")
929 int definitionStart =
m_editor->WordEndPosition(wordend,
false);
930 int definitionEnd =
m_editor->WordEndPosition(definitionStart,
true);
931 std::string sDefinitionName =
m_editor->GetTextRange(definitionStart, definitionEnd).ToStdString();
933 if (
m_editor->GetStyleAt(definitionStart) == wxSTC_NSCR_FUNCTION)
944 m_vLocalVariables.push_back(pair<string,int>(sDefinitionName, wxSTC_NSCR_CUSTOM_FUNCTION));
960 while (sDefinition.back() ==
'\r' || sDefinition.back() ==
'\n')
961 sDefinition.pop_back();
974 if (sSyntaxElement ==
"include")
993 if (_mMatch.
sString ==
"define"
994 || _mMatch.
sString ==
"ifndefined"
995 || _mMatch.
sString ==
"lclfunc"
997 || _mMatch.
sString ==
"ifndef")
999 std::string sDefinition = sLine.substr(_mMatch.
nPos + _mMatch.
sString.length());
1003 if (sDefinition.length())
1006 if (sDefinition.find(
'=') != string::npos)
1007 sDefinition.erase(sDefinition.find(
'='));
1009 if (sDefinition.find_first_of(
"({") != string::npos)
1010 sDefinition.erase(sDefinition.find_first_of(
"({"));
1014 m_vLocalVariables.push_back(pair<string,int>(sDefinition, wxSTC_NSCR_CUSTOM_FUNCTION));
1044 int nArgumentParensEnd =
m_editor->BraceMatch(nArgumentParensStart);
1046 if (nArgumentParensStart != -1 && nArgumentParensEnd != -1)
1049 for (
int i = nArgumentParensStart+1; i < nArgumentParensEnd; i++)
1051 if (
m_editor->GetStyleAt(i) == wxSTC_NPRC_IDENTIFIER
1052 ||
m_editor->GetStyleAt(i) == wxSTC_NPRC_CUSTOM_FUNCTION
1053 ||
m_editor->GetStyleAt(i) == wxSTC_NPRC_CLUSTER)
1062 i =
m_editor->WordEndPosition(i,
true);
1068 if (vBlock.back() != wxSTC_INVALID_POSITION)
1070 int nProcedureEnd = vBlock.back();
1078 if (nNamingProcedure == wxNOT_FOUND)
1098 double dCommentDensity = (double)nNumberOfComments / (
double)nLinesOfCode;
1124 int nProcedureEnd =
m_editor->FindText(
m_nCurPos,
m_editor->GetLastPosition(),
"endprocedure", wxSTC_FIND_MATCHCASE | wxSTC_FIND_WHOLEWORD);
1128 while (sArgs.back() ==
'\r' || sArgs.back() ==
'\n')
1133 if (nProcedureEnd == -1)
1158 if (vMatch.size() > 1)
1161 if (vMatch.front() == wxSTC_INVALID_POSITION || vMatch.back() == wxSTC_INVALID_POSITION)
1166 if (sSyntaxElement ==
"endprocedure")
1192 bool canContinue =
false;
1197 string sSyntaxElement =
m_editor->GetTextRange(wordstart, wordend).ToStdString();
1206 static string sMODIFIER =
",len,cols,lines,rows,grid,avg,std,min,max,med,sum,prd,cnt,num,norm,and,or,xor,name,size,minpos,maxpos,description,";
1208 if (sMODIFIER.find(
"," + sSyntaxElement +
",") == string::npos)
1209 sSyntaxElement +=
"()";
1211 sSyntaxElement.insert(0,
"VAR.");
1214 sSyntaxElement +=
"()";
1222 else if (sSyntaxElement !=
"sleep()")
1241 if (
m_editor->BraceMatch(wordend) < wordend && sSyntaxElement.find(
'(') != string::npos)
1250 else if (sSyntaxElement !=
"time()"
1251 && sSyntaxElement !=
"clock()"
1252 && sSyntaxElement !=
"version()"
1253 && sSyntaxElement !=
"getlasterror()"
1254 && sSyntaxElement !=
"getversioninfo()"
1255 && sSyntaxElement.find(
'(') != string::npos)
1258 int nPos =
m_editor->BraceMatch(wordend);
1259 string sArgument =
m_editor->GetTextRange(wordend + 1, nPos).ToStdString();
1261 if (!sArgument.length())
1301 if (!sSyntaxElement.length())
1309 for (
size_t i = 0; i < sSyntaxElement.length(); i++)
1311 if (!isalnum(sSyntaxElement[i])
1312 && sSyntaxElement[i] !=
'$'
1313 && sSyntaxElement[i] !=
'/'
1314 && sSyntaxElement[i] !=
':'
1315 && sSyntaxElement[i] !=
'_'
1316 && sSyntaxElement[i] !=
'\''
1317 && sSyntaxElement[i] !=
'('
1318 && sSyntaxElement[i] !=
')'
1319 && sSyntaxElement[i] !=
'~')
1353 if (
m_editor->GetCharAt(wordend) ==
'.' &&
m_editor->GetStyleAt(wordend + 1) != wxSTC_NSCR_METHOD)
1354 wordend =
m_editor->WordEndPosition(wordend + 1,
true);
1357 std::string sSyntaxElement =
m_editor->GetTextRange(wordstart, wordend).ToStdString();
1385 if (currentline.substr(currentline.find_first_not_of(
" \t"), 9) !=
"odesolve " || !(sSyntaxElement[0] ==
'y' && sSyntaxElement.length() > 1 && sSyntaxElement.find_first_not_of(
"0123456789", 1) == string::npos))
1395 &&
m_editor->GetStyleAt(wordstart) == wxSTC_NSCR_CUSTOM_FUNCTION
1396 &&
m_editor->GetCharAt(wordstart-1) !=
'&'
1397 &&
m_editor->GetTextRange(wordend, wordend+3) !=
"()&")
1407 if (sSyntaxElement.length() < 4 && sSyntaxElement.length() > 1 && sSyntaxElement.find_first_not_of(
"\r\n") != string::npos && sSyntaxElement.find(
'.') == string::npos)
1415 if (sSyntaxElement.length() > 2 && sSyntaxElement.find_first_not_of(
"\r\n") != string::npos && sSyntaxElement.find(
'.') == string::npos)
1420 while (sSyntaxElement[shift] ==
'_')
1518 string sCurrentNumber =
m_editor->GetTextRange(nNumberStart,
m_nCurPos + 1).ToStdString();
1521 for (
int i = nNumberStart; i >= nLineStartPos; i--)
1528 &&
m_editor->GetCharAt(i - 1) !=
'<'
1529 &&
m_editor->GetCharAt(i - 1) !=
'>'
1530 &&
m_editor->GetCharAt(i - 1) !=
'!'
1531 &&
m_editor->GetCharAt(i - 1) !=
'~'
1532 &&
m_editor->GetCharAt(i - 1) !=
'=')
1561 std::string sSyntaxElement =
m_editor->GetTextRange(wordstart, wordend).ToStdString();
1563 int contextPoint = 0;
1569 && (
m_editor->GetStyleAt(i - 1) == wxSTC_NSCR_CLUSTER
1570 ||
m_editor->GetStyleAt(i - 1) == wxSTC_NSCR_CUSTOM_FUNCTION
1571 ||
m_editor->GetStyleAt(i - 1) == wxSTC_NSCR_PREDEFS))
1584 if (sSyntaxElement ==
"nlen"
1585 || sSyntaxElement ==
"nrows"
1586 || sSyntaxElement ==
"ncols"
1587 || sSyntaxElement ==
"nlines")
1592 _guilang.
get(
"GUI_ANALYZER_DIMVAR_MISUSE", sSyntaxElement)),
1601 if (sSyntaxElement ==
"nlen")
1604 if (
m_editor->GetStyleAt(contextPoint - 1) != wxSTC_NSCR_CLUSTER)
1608 _guilang.
get(
"GUI_ANALYZER_DIMVAR_MISUSE", sSyntaxElement)),
1611 else if (sSyntaxElement ==
"nrows"
1612 || sSyntaxElement ==
"ncols"
1613 || sSyntaxElement ==
"nlines")
1617 if (
m_editor->GetStyleAt(contextPoint - 1) != wxSTC_NSCR_CUSTOM_FUNCTION
1618 &&
m_editor->GetStyleAt(contextPoint - 1) != wxSTC_NSCR_PREDEFS)
1622 _guilang.
get(
"GUI_ANALYZER_DIMVAR_MISUSE", sSyntaxElement)),
1626 int contextEnd =
m_editor->BraceMatch(contextPoint);
1628 if (contextEnd == wxNOT_FOUND)
1633 std::string sContext =
m_editor->GetTextRange(contextPoint+1, contextEnd).ToStdString();
1643 _guilang.
get(
"GUI_ANALYZER_DIMVAR_MIXUP", sSyntaxElement)),
1692 m_sStyles.append(sMessage.length() + chartoadd, nStyle);
1718 if (sCurrentLine.find(
'=') == string::npos)
1723 for (
size_t i = 1; i < sCurrentLine.length() - 1; i++)
1725 if (sCurrentLine[i] ==
'='
1726 && sCurrentLine[i - 1] !=
'<'
1727 && sCurrentLine[i - 1] !=
'>'
1728 && sCurrentLine[i - 1] !=
'!'
1729 && sCurrentLine[i - 1] !=
'='
1730 && sCurrentLine[i + 1] !=
'='
1753 m_editor->IndicatorFillRange(nPos, nLength);
1775 for (
int i =
m_editor->PositionFromLine(startline); i < m_editor->GetLineEndPosition(endline); i++)
1781 int wordstart =
m_editor->WordStartPosition(i,
true);
1782 int wordend =
m_editor->WordEndPosition(i,
true);
1784 if (
m_editor->GetTextRange(wordstart, wordend) ==
"if"
1785 ||
m_editor->GetTextRange(wordstart, wordend) ==
"elseif"
1786 ||
m_editor->GetTextRange(wordstart, wordend) ==
"while"
1787 ||
m_editor->GetTextRange(wordstart, wordend) ==
"case"
1788 ||
m_editor->GetTextRange(wordstart, wordend) ==
"try"
1789 ||
m_editor->GetTextRange(wordstart, wordend) ==
"for")
1799 int wordstart =
m_editor->WordStartPosition(i,
true);
1800 int wordend =
m_editor->WordEndPosition(i,
true);
1802 if (
m_editor->GetTextRange(wordstart, wordend) ==
"and"
1803 ||
m_editor->GetTextRange(wordstart, wordend) ==
"or"
1804 ||
m_editor->GetTextRange(wordstart, wordend) ==
"xor")
1818 if (
m_editor->GetTextRange(i, j) ==
"&"
1819 ||
m_editor->GetTextRange(i, j) ==
"&&"
1820 ||
m_editor->GetTextRange(i, j) ==
"|"
1821 ||
m_editor->GetTextRange(i, j) ==
"||"
1822 ||
m_editor->GetTextRange(i, j) ==
"|||")
1846 int nLinesOfCode = 0;
1851 for (
int i = startline; i <= endline; i++)
1853 currentline =
m_editor->GetLine(i).ToStdString();
1856 if (currentline.find(
"##") != string::npos)
1857 currentline.erase(currentline.find(
"##"));
1861 if (currentline.find_first_not_of(
" \t\r\n") != string::npos)
1864 for (
size_t j =
m_editor->PositionFromLine(i); j < currentline.length() +
m_editor->PositionFromLine(i); j++)
1880 return nLinesOfCode;
1901 for (
int i =
m_editor->PositionFromLine(startline); i < m_editor->GetLineEndPosition(endline); i++)
1909 for (
int j = i; j <
m_editor->GetLineEndPosition(endline); j++)
1918 if (j > i + 1 &&
m_editor->PositionFromLine(
m_editor->LineFromPosition(j)) == j)
1942 if (sVarName.length() <= 2
1943 || sVarName.find_first_not_of(
"\r\n") == std::string::npos
1944 || sVarName.find(
'.') != std::string::npos)
1950 while (sVarName[shift] ==
'_')
1954 static std::string sFirstChars =
"nsfbdxyzt";
1956 if (sVarName.length() > shift+1
1957 && (std::isupper(sVarName[shift+1]) || sVarName[shift+1] ==
'_')
1958 && sFirstChars.find(sVarName[shift]) != std::string::npos)
1959 return sVarName[shift];
1975 return c ==
'n' || c ==
'd' || c ==
'f' || c ==
't';
1993 if (currentType == type
2000 while (sVarName[shift] ==
'_')
2005 sVarName[shift] = type;
2008 if (!std::isupper(sVarName[shift]))
2009 sVarName[shift] = std::toupper(sVarName[shift]);
2011 sVarName.insert(shift, 1, type);
int calculateCyclomaticComplexity(int startline, int endline)
Calculates the cyclomatic complexity between both lines.
std::string m_sCurrentLine
bool m_hasProcedureDefinition
AnnotationCount analyseNumbers()
Analyses occurences of numerical literals.
AnnotationCount analyseFunctions(bool isContinuedLine)
Analyses calls to standard functions.
int calculateLinesOfCode(int startline, int endline)
Calculates the lines of code between both lines.
const double MINCOMMENTDENSITY
AnnotationCount analysePreDefs()
Analyses occurences of special predefined variables.
std::vector< std::pair< std::string, int > > m_vLocalVariables
std::vector< std::string > m_STRING_METHODS
const int MAXCOMPLEXITYWARN
std::string m_currentMode
void run()
Starts the code analysis. Requires a pointer to the editor and to the options.
AnnotationCount analyseCommands()
Analyses commands in the code.
AnnotationCount analyseOperators()
Analyses occurences of operators.
bool containsAssignment(const std::string &sCurrentLine)
Checks for assignments.
const int MAXCOMPLEXITYNOTIFY
const double MAXCOMMENTDENSITY
std::vector< std::string > m_STRING_FUNCS
std::vector< std::string > m_MATOP_FUNCS
static void changeVariableType(std::string &sVarName, char type)
Change the variable's type to the passed type.
AnnotationCount analyseProcedures()
Analyses calls to procedures.
AnnotationCount addToAnnotation(const std::string &sMessage, int nStyle)
Adds the passed sMessage with the style to the internal cache.
std::vector< std::string > m_DRAW_FUNCS
CodeAnalyzer(NumeReEditor *parent, Options *opts)
AnnotationCount analyseIdentifiers()
Analyses occurences of identifiers.
std::string highlightFoundOccurence(const std::string &sElement, int nPos, int nLength)
Highlights the occurence in the editor.
int countNumberOfComments(int startline, int endline)
Counts the number of comment lines between both lines.
static char getVariableType(const std::string &sVarName)
Returns the leading character, which indicates the type of this variable or a null character,...
This class extends the std::vector for endlessness.
This class represents a file, which can be included into other files using the @ syntax.
bool is_open() const
Determine, if the internal included file is open and valid.
std::string getNextLine()
Return the next line of the included string.
This class handles the internal language system and returns the language strings of the selected lang...
std::vector< std::string > getList(const std::string &sMessageScheme) const
This member function returns a vector of language strings matching to the passed identifier containin...
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
The class of the editor window.
bool isStyleType(StyleType _type, int nPos)
Determine the syntax style type at the selected position.
wxString GetFilenameString()
int isBlockStart(const wxString &sWord, bool allowIntermediate=false)
This function returns true, if a passed word corresponds to a control flow statement block start.
bool getEditorSetting(EditorSettings _setting)
Returns true, if the selected setting is active.
SearchController * m_search
std::vector< int > BlockMatch(int nPos)
Finds all matching flow control statements.
FileFilterType m_fileType
int isBlockEnd(const wxString &sWord)
This function returns true, if a passed word corresponds to a control flow statement block end.
int countUmlauts(const std::string &sStr)
Counts the german umlauts in the current string.
This class implements an interface of the internal Settings object adapted to be usable from the GUI.
int GetAnalyzerOption(AnalyzerOptions opt) const
Return the value of the selected static code analyzer option.
std::vector< int > FindAll(const wxString &sSymbol, int nStyle, int nStartPos=0, int nEndPos=-1, bool bSearchInComments=false)
Finds all occurences of a code symbol considering the style.
int FindNamingProcedure()
Searches the file for the naming procedure.
wxString FindMarkedProcedure(int charpos, bool ignoreDefinitions=true)
Extracts the procedure call at the selected position.
wxString FindProcedureDefinition()
Searches the definition below the cursor.
SettingsValue & getSetting(const std::string &value)
Returns a reference to the setting value, which corresponds to the passed string. Throws an exception...
bool & active()
Returns a reference to a boolean value type setting.
void clear()
Remove all file-static constant declarations.
bool isSymbol(const std::string &sSymbol) const
Check, whether the passed string is a defined symbol (will be used by the static code analyzer).
void createSymbol(const std::string &sCommandLine)
Create one or more new file-static constant declarations for the current file.
Common exception class for all exceptions thrown in NumeRe.
std::string getToken() const
Returns the error token containing additional information about the error.
static bool isNumericType(char c)
Checks, whether the passed type is a numeric type.
static void replaceDocStrings(std::string &sStr)
#define HIGHLIGHT_ANNOTATION
size_t findVariableInExpression(const std::string &sExpr, const std::string &sVarName, size_t nPosStart)
This function searches for the selected variable in the passed string and returns the position of the...
void StripSpaces(std::string &)
Removes leading and trailing white spaces and tabulator characters.
int findParameter(const std::string &sCmd, const std::string &sParam, const char cFollowing)
This function searches the passed parameter in the passed command string. If something is found,...
#define SETTING_B_TABLEREFS
Stores the number of annotations for displaying a summary.
Structure for the findCommand function.
std::string toString(int)
Converts an integer to a string without the Settings bloat.