MCPcopy Create free account
hub / github.com/WheretIB/nullc / ColorText

Method ColorText

Colorer.cpp:756–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754void (*ColorFunc)(HWND, unsigned int, unsigned int, int);
755
756bool Colorer::ColorText(HWND wnd, char *text, void (*ColFunc)(HWND, unsigned int, unsigned int, int))
757{
758 richEdit = wnd;
759 ColorFunc = ColFunc;
760
761 lastError = "";
762
763 ColorerGrammar::typeInfo.clear();
764
765 ColorerGrammar::typeInfo.push_back(GetStringHash("void"));
766 ColorerGrammar::typeInfo.push_back(GetStringHash("char"));
767 ColorerGrammar::typeInfo.push_back(GetStringHash("short"));
768 ColorerGrammar::typeInfo.push_back(GetStringHash("int"));
769 ColorerGrammar::typeInfo.push_back(GetStringHash("long"));
770 ColorerGrammar::typeInfo.push_back(GetStringHash("float"));
771 ColorerGrammar::typeInfo.push_back(GetStringHash("double"));
772 ColorerGrammar::typeInfo.push_back(GetStringHash("typeid"));
773 ColorerGrammar::typeInfo.push_back(GetStringHash("const_string"));
774 ColorerGrammar::typeInfo.push_back(GetStringHash("generic"));
775 ColorerGrammar::typeInfo.push_back(GetStringHash("bool"));
776
777 ColorerGrammar::logStream.str("");
778
779 ColorerGrammar::codeStart = text;
780
781 errUnderline = false;
782 //ColorCode(COLOR_ERR, text, text+strlen(text));
783
784 ParseResult pRes = Parse(syntax->code, text, ColorerGrammar::ParseSpace);
785 if(pRes == PARSE_ABORTED)
786 {
787 lastError = ColorerGrammar::lastError;
788 return false;
789 }
790 if(pRes != PARSE_OK)
791 ColorerGrammar::logStream << "ERROR: syntax error, unable to continue";
792
793 if(ColorerGrammar::logStream.str().length() != 0)
794 {
795 lastError = ColorerGrammar::logStream.str();
796 return false;
797 }
798 return true;
799}
800
801std::string Colorer::GetError()
802{

Callers 2

AddTabWithFileFunction · 0.80
WndProcFunction · 0.80

Calls 5

ParseFunction · 0.85
lengthMethod · 0.80
GetStringHashFunction · 0.50
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected