| 754 | void (*ColorFunc)(HWND, unsigned int, unsigned int, int); |
| 755 | |
| 756 | bool 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 | |
| 801 | std::string Colorer::GetError() |
| 802 | { |
no test coverage detected