void operator()(const char *begin, const char *end) const { std::string symbol = std::string(begin, end); if (p_symbol_table->IsOpenPPLSymbol(symbol.c_str())) { // OpenPPL symbols and user-defined symbols // get translated to f$...OH-script-symbols. // So we prepend "f$" #ifdef DEBUG_SYMBOLS current_output << "\n// OpenPPL-symbol\n"; #endif DEBUG_SYMBOLS current_output << p_symbol_table->GetSymbolNameWithcorrectCases(symbol.c_str()); } else if (p_list_of_openholdem_symbol_prefixes->LooksLikeOpenHoldemSymbol(CString(symbol.c_str()))) { #ifdef DEBUG_SYMBOLS current_output << "\n// OpenHoldem-symbol\n"; #endif DEBUG_SYMBOLS current_output << symbol; } // Ubknown symbol else if (!p_symbol_table->GenerationOfSymboltableInProgress()) { CString c_symbol = symbol.c_str(); if (c_symbol.MakeLower().Left(4) == "user") { // User-defined variable // // Removing underscores, as they are used as separators // and would mix things up. c_symbol.Remove('_'); #ifdef DEBUG_SYMBOLS current_output << "\n// User-defined variable (me_re_)\n"; #endif DEBUG_SYMBOLS current_output << "me_re_" << c_symbol.MakeLower(); } else if (c_symbol.MakeLower().Right(6) == "suited") { ErrorMessage(k_error_unknown_symbol_ending_with_suited, ErroneousCodeSnippet(begin)); } else { ErrorMessage(k_error_unknown_symbol, ErroneousCodeSnippet(begin)); // Output anyway, as // * some symbols are missing, that will be removed soon // * some new symbols might be missing, but the translation // should work anyway. current_output << symbol; } } else { #ifdef DEBUG_SYMBOLS current_output << "\n// Nothing to do (generation of symbol table)\n"; #endif DEBUG_SYMBOLS } }
void operator()(const char *begin, const char *end) const { if ((preflop_section_found == false) || (flop_section_found == false) || (turn_section_found == false) || (river_section_found == false)) { ErrorMessage(k_error_missing_code_section, ErroneousCodeSnippet(begin)); } }
void operator()(const char *begin, const char *end) const { assert(when_conditions_since_last_action >= 0); when_conditions_since_last_action++; if (when_conditions_since_last_action == 1) { // 1st when-condition found // When-condition with action original_source_of_current_when_condition = string(begin, end); current_when_condition.str(""); current_when_condition.clear(); current_when_condition << current_output.str(); #ifdef DEBUG_WHEN_CONDITIONS cout << "WHEN CONDITION: " << current_when_condition.str() << endl; #endif current_output.str(""); current_output.clear(); } else if (when_conditions_since_last_action == 2) { // 2nd when-condition found // Open-ended when condition open_ended_when_condition_detected = true; original_source_of_current_open_ended_when_condition = original_source_of_current_when_condition; current_open_ended_when_condition.str(""); current_open_ended_when_condition.clear(); current_open_ended_when_condition << current_when_condition.str(); current_when_condition.str(""); current_when_condition.clear(); current_when_condition << current_output.str(); #ifdef DEBUG_WHEN_CONDITIONS cout << "WHEN CONDITION (OPEN ENDED): " << current_open_ended_when_condition.str() << endl; cout << "WHEN CONDITION: " << current_when_condition.str() << endl; #endif cout << "//" << endl; cout << "// Starting open-ended when-condition" << endl; cout << "// " << original_source_of_current_open_ended_when_condition << endl; cout << "//" << endl; current_output.str(""); current_output.clear(); } else { // More than 2 when-conditions found: // illegal Open-PPL-code ErrorMessage(k_error_too_many_open_ended_when_conditions, ErroneousCodeSnippet(begin)); } }
void CParseErrors::Error(CString short_message) { if (short_message.Right(1) != "\n") { short_message += "\n"; } CString message; message.Format("%s%s%s%s%s%i%s%s%i%s%s%s%s%s", "Error: ", short_message, "=====================================================\n" "Function: ", CFormulaParser::CurrentFunctionName(), "\n" "Line absolute: ", CTokenizer::LineAbsolute(), "\n", "Line relative: ", CTokenizer::LineRelative(), "\n", "=====================================================\n", ErroneousCodeSnippet(), "\n", "=====================================================\n"); OH_MessageBox_Interactive(message, "Parse Error", 0); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_invalid_list_content, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_missing_list_number, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_operator_instead_of_action, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_missing_brackets_for_when_condition, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_missing_closing_bracket, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_missing_code_section, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_action_without_force, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_invalid_card_expression, ErroneousCodeSnippet(begin)); }
void operator()(const char *begin, const char *end) const { ErrorMessage(k_error_beep_not_supported, ErroneousCodeSnippet(begin)); }