本文整理汇总了C++中ErrorHandler::error方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorHandler::error方法的具体用法?C++ ErrorHandler::error怎么用?C++ ErrorHandler::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: symbol
EnumeratedInputSymbolRef::EnumeratedInputSymbolRef(const Enumeration* enumeration,
InputSource& input,
ErrorHandler& errorHandler,
Symbols& symbols,
Option& option,
State& state) :
symbol(0), parameters(0)
{
char buf[100];
input.readString(buf, 99);
XABSL_DEBUG_INIT(errorHandler.message("creating reference to enumerated input symbol \"%s\"", buf));
if(!symbols.enumeratedInputSymbols.exists(buf))
{
errorHandler.error("XabslEnumeratedInputSymbolRef::XabslEnumeratedInputSymbolRef(): enumerated input symbol \"%s\" was not registered at the engine", buf);
return;
}
symbol = symbols.enumeratedInputSymbols[buf];
this->enumeration = symbol->enumeration;
if(enumeration != NULL && enumeration != this->enumeration)
{
errorHandler.error("XabslEnumeratedInputSymbolRef::XabslEnumeratedInputSymbolRef(): enumeration input symbol \"%s\" does not match enumeration type \"%s\"", buf, enumeration->n);
}
parameters = new ParameterAssignment(&symbol->parameters, errorHandler);
parameters->create(input, symbols, option, state);
}
示例2: createOperand
bool DecimalExpression::createOperand(DecimalExpression*& operand,
InputSource& input,
Array<Action*>& actions,
ErrorHandler& errorHandler,
OptionParameters& parameters,
Symbols& symbols,
unsigned long& timeOfOptionExecution,
unsigned long& timeOfStateExecution)
{
operand = DecimalExpression::create(input,actions,errorHandler,parameters, symbols,
timeOfOptionExecution,timeOfStateExecution);
if (operand == 0)
{
errorHandler.error("XabslDecimalExpression::createOperand(): created operand is 0");
return false;
}
if (errorHandler.errorsOccurred)
{
errorHandler.error("XabslDecimalExpression::createOperand(): could not create operand");
if (operand != 0) delete operand;
return false;
}
return true;
}
示例3: createOperand
bool EnumeratedExpression::createOperand(const EnumeratedExpression*& operand,
const Enumeration* enumeration,
InputSource& input,
ErrorHandler& errorHandler,
Symbols& symbols,
Option& option,
State& state)
{
operand = EnumeratedExpression::create(enumeration, input, errorHandler, symbols, option, state);
if(operand == 0)
{
errorHandler.error("XabslEnumeratedExpression::createOperand(): created operand is 0");
return false;
}
if(errorHandler.errorsOccurred)
{
errorHandler.error("XabslEnumeratedExpression::createOperand(): could not create operand");
if(operand != 0) delete operand;
return false;
}
return true;
}
示例4: ifCondition
IfElseBlock::IfElseBlock(InputSource& input,
ErrorHandler& errorHandler,
Symbols& symbols,
Option& option,
State& state) :
ifCondition(0), ifStatement(0), elseStatement(0)
{
// if case
XABSL_DEBUG_INIT(errorHandler.message("creating if statement"));
ifCondition = BooleanExpression::create(input, errorHandler, symbols, option, state);
if(errorHandler.errorsOccurred)
{
errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if condition");
return;
}
ifStatement = Statement::createStatement(input, errorHandler, symbols, option, state);
if(errorHandler.errorsOccurred)
{
errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if statement");
return;
}
// else case
XABSL_DEBUG_INIT(errorHandler.message("creating else statement"));
elseStatement = Statement::createStatement(input, errorHandler, symbols, option, state);
if(errorHandler.errorsOccurred)
errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create else statement");
}
示例5: symbol
DecimalInputSymbolRef::DecimalInputSymbolRef(InputSource& input,
Array<Action*>& actions,
ErrorHandler& errorHandler,
OptionParameters& optionParameters,
Symbols& symbols,
unsigned long& timeOfOptionExecution,
unsigned long& timeOfStateExecution) :
symbol(0), parameters(0)
{
char buf[100];
input.readString(buf,99);
XABSL_DEBUG_INIT(errorHandler.message("creating a reference to decimal input symbol \"%s\"",buf));
if (!symbols.decimalInputSymbols.exists(buf))
{
errorHandler.error("XabslDecimalInputSymbolRef::DecimalInputSymbolRef(): decimal input symbol \"%s\" was not registered",buf);
return;
}
symbol = symbols.decimalInputSymbols[buf];
parameters = new ParameterAssignment(&symbol->parameters, errorHandler);
parameters->create(input, optionParameters, symbols, timeOfOptionExecution, timeOfStateExecution, actions);
}
示例6:
EnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(InputSource& input,
ErrorHandler& errorHandler,
Symbols& symbols,
Option& option,
State& state)
{
if (!EnumeratedExpression::createOperand(operand1,NULL,input,errorHandler,symbols,option,state))
{
errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression");
operand1 = operand2 = 0;
return;
}
if (!EnumeratedExpression::createOperand(operand2,operand1->enumeration,input,errorHandler,symbols,option,state))
{
errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression");
operand2 = 0;
return;
}
}
示例7:
EnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(InputSource& input,
Array<Action*>& actions,
ErrorHandler& errorHandler,
OptionParameters& parameters,
Symbols& symbols,
unsigned long& timeOfOptionExecution,
unsigned long& timeOfStateExecution)
{
if (!EnumeratedExpression::createOperand(operand1,NULL,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution))
{
errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression");
operand1 = operand2 = 0;
return;
}
if (!EnumeratedExpression::createOperand(operand2,operand1->enumeration,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution))
{
errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression");
operand2 = 0;
return;
}
}
示例8: if
ConditionalEnumeratedExpression::ConditionalEnumeratedExpression(const Enumeration* enumeration,
InputSource& input,
Array<Action*>& actions,
ErrorHandler& errorHandler,
OptionParameters& parameters,
Symbols& symbols,
unsigned long& timeOfOptionExecution,
unsigned long& timeOfStateExecution)
{
XABSL_DEBUG_INIT(errorHandler.message("creating a question mark operator"));
condition = BooleanExpression::create(input,actions,errorHandler,parameters, symbols,
timeOfOptionExecution,timeOfStateExecution);
if (condition == 0)
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): created condition is 0");
return;
}
else if (errorHandler.errorsOccurred)
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create condition");
delete condition;
return;
}
if (!EnumeratedExpression::createOperand(expression1,enumeration,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution))
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression1");
return;
}
if (!EnumeratedExpression::createOperand(expression2,enumeration,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution))
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression2");
return;
}
this->enumeration = enumeration;
}
示例9:
EnumeratedValue::EnumeratedValue(const Enumeration* enumeration,
InputSource& input,
ErrorHandler& errorHandler)
{
char buf[100];
input.readString(buf, 99);
if(enumeration == NULL)
{
errorHandler.error("XabslEnumeratedValue::EnumeratedValue(): enumerated value can not be created without specifying enumeration");
return;
}
if(!enumeration->enumElements.exists(buf))
{
errorHandler.error("XabslEnumeratedValue::EnumeratedValue(): enum element \"%s\" of enumeration \"%s\" was not registered", buf, enumeration->n);
return;
}
value = enumeration->enumElements[buf]->v;
this->enumeration = enumeration;
}
示例10: ifStatement
IfElseBlock::IfElseBlock(InputSource& input,
Array<Action*>& actions,
ErrorHandler& errorHandler,
Array<State*>& states,
OptionParameters& parameters,
Symbols& symbols,
unsigned long& timeOfOptionExecution,
unsigned long& timeOfStateExecution) :
ifCondition(0), ifStatement(0), elseStatement(0)
{
// if case
XABSL_DEBUG_INIT(errorHandler.message("creating if statement"));
ifCondition = BooleanExpression::create(input, actions, errorHandler,
parameters, symbols, timeOfOptionExecution, timeOfStateExecution);
if (errorHandler.errorsOccurred)
{
errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if condition");
return;
}
ifStatement = Statement::createStatement(input,actions, errorHandler,
states,parameters, symbols, timeOfOptionExecution, timeOfStateExecution);
if (errorHandler.errorsOccurred)
{
errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if statement");
return;
}
// else case
XABSL_DEBUG_INIT(errorHandler.message("creating else statement"));
elseStatement = Statement::createStatement(input, actions,
errorHandler, states, parameters, symbols, timeOfOptionExecution, timeOfStateExecution);
if (errorHandler.errorsOccurred)
errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create else statement");
}
示例11: createOperand
bool BooleanExpression::createOperand(BooleanExpression*& operand,
InputSource& input,
ErrorHandler& errorHandler,
Symbols& symbols,
Option& option,
State& state)
{
operand = BooleanExpression::create(input,errorHandler,symbols,option,state);
if (operand == 0)
{
errorHandler.error("XabslBooleanExpression::createOperand(): created operand is 0");
return false;
}
if (errorHandler.errorsOccurred)
{
errorHandler.error("XabslBooleanExpression::createOperand(): could not create operand");
delete operand;
return false;
}
return true;
}
示例12: if
ConditionalEnumeratedExpression::ConditionalEnumeratedExpression(const Enumeration* enumeration,
InputSource& input,
ErrorHandler& errorHandler,
Symbols& symbols,
Option& option,
State& state)
{
XABSL_DEBUG_INIT(errorHandler.message("creating a question mark operator"));
condition = BooleanExpression::create(input, errorHandler, symbols, option, state);
if(condition == 0)
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): created condition is 0");
return;
}
else if(errorHandler.errorsOccurred)
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create condition");
delete condition;
return;
}
if(!EnumeratedExpression::createOperand(expression1, enumeration, input, errorHandler, symbols, option, state))
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression1");
return;
}
if(!EnumeratedExpression::createOperand(expression2, enumeration, input, errorHandler, symbols, option, state))
{
errorHandler.error("XabslQuestionMarkOperator::QuestionMarkOperator(): could not create decimal expression2");
return;
}
this->enumeration = enumeration;
}
示例13:
DecimalOptionParameterRef::DecimalOptionParameterRef(InputSource& input,
ErrorHandler& errorHandler,
OptionParameters& parameters)
{
char buf[100];
input.readString(buf,99);
XABSL_DEBUG_INIT(errorHandler.message("creating a reference to decimal option parameter \"%s\"",buf));
if (!parameters.decimal.exists(buf))
{
errorHandler.error("XabslDecimalOptionParameterRef::DecimalOptionParameterRef(): decimal option parameter \"%s\" does not exist",buf);
return;
}
parameter = parameters.decimal.getPElement(buf)->e;
}
示例14: symbol
BooleanInputSymbolRef::BooleanInputSymbolRef(InputSource& input,
ErrorHandler& errorHandler,
Symbols& symbols,
Option& option,
State& state) :
symbol(0), parameters(0)
{
char buf[100];
input.readString(buf,99);
XABSL_DEBUG_INIT(errorHandler.message("creating reference to boolean input symbol \"%s\"",buf));
if (!symbols.booleanInputSymbols.exists(buf))
{
errorHandler.error("XabslBooleanInputSymbolRef::XabslBooleanInputSymbolRef(): boolean input symbol \"%s\" was not registered at the engine",buf);
return;
}
symbol = symbols.booleanInputSymbols[buf];
parameters = new ParameterAssignment(&symbol->parameters, errorHandler);
parameters->create(input, symbols, option, state);
}
示例15: main
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
/*QSettings test("test.ini", QSettings::IniFormat);
test.beginGroup("compiler");
test.setValue("test-value", "asd");
test.setValue("other-value", "val");
test.endGroup();
test.beginGroup("opt");
test.setValue("test-value2", "asd2");
test.setValue("other-value2", "val2");
test.endGroup();
test.sync();
return 0;*/
QTime bigTimer;
bigTimer.start();
QStringList params = a.arguments();
if (params.size() != 2) {
qCritical() << "Expecting file to compile";
return 0;
}
ErrorHandler errHandler;
Settings settings;
bool success = false;
success = settings.loadDefaults();
if (!success) {
errHandler.error(ErrorCodes::ecSettingsLoadingFailed, errHandler.tr("Loading the default settings \"%1\" failed").arg(settings.loadPath()), CodePoint());
return ErrorCodes::ecSettingsLoadingFailed;
}
Lexer lexer;
QObject::connect(&lexer, &Lexer::error, &errHandler, &ErrorHandler::error);
QObject::connect(&lexer, &Lexer::warning, &errHandler, &ErrorHandler::warning);
QTime timer;
timer.start();
if (lexer.tokenizeFile(params[1], settings) == Lexer::Success) {
qDebug() << "Lexical analysing took " << timer.elapsed() << "ms";
#ifdef DEBUG_OUTPUT
lexer.writeTokensToFile("tokens.txt");
#endif
}
else {
errHandler.error(ErrorCodes::ecLexicalAnalysingFailed, errHandler.tr("Lexical analysing failed"), CodePoint(lexer.files().first().first));
return ErrorCodes::ecLexicalAnalysingFailed;
}
Parser parser;
QObject::connect(&parser, &Parser::error, &errHandler, &ErrorHandler::error);
QObject::connect(&parser, &Parser::warning, &errHandler, &ErrorHandler::warning);
timer.start();
ast::Program *program = parser.parse(lexer.tokens(), settings);
qDebug() << "Parsing took " << timer.elapsed() << "ms";
if (!parser.success()) {
errHandler.error(ErrorCodes::ecParsingFailed, errHandler.tr("Parsing failed \"%1\"").arg(params[1]), CodePoint());
return ErrorCodes::ecParsingFailed;
}
#ifdef DEBUG_OUTPUT
if (program) {
QFile file("ast.txt");
if (file.open(QFile::WriteOnly)) {
QTextStream stream(&file);
program->write(stream);
file.close();
}
}
#endif
CodeGenerator codeGenerator;
//QObject::connect(&codeGenerator, &CodeGenerator::error, &errHandler, &ErrorHandler::error);
//QObject::connect(&codeGenerator, &CodeGenerator::warning, &errHandler, &ErrorHandler::warning);
QObject::connect(&codeGenerator, &CodeGenerator::error, &errHandler, &ErrorHandler::error);
QObject::connect(&codeGenerator, &CodeGenerator::warning, &errHandler, &ErrorHandler::warning);
timer.start();
if (!codeGenerator.initialize(settings)) {
return ErrorCodes::ecCodeGeneratorInitializationFailed;
}
qDebug() << "Code generator initialization took " << timer.elapsed() << "ms";
timer.start();
if (!codeGenerator.generate(program)) {
errHandler.error(ErrorCodes::ecCodeGenerationFailed, errHandler.tr("Code generation failed"), CodePoint());
return ErrorCodes::ecCodeGenerationFailed;
}
qDebug() << "Code generation took" << timer.elapsed() << "ms";
qDebug() << "LLVM-IR generated";
timer.start();
//.........这里部分代码省略.........