KSeExpr  4.0.4.0
ErrorMessages.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me>
2 // SPDX-License-Identifier: GPL-3.0-or-later
3 
4 #include "ErrorMessages.h"
5 
6 using namespace KSeExpr;
7 
9 {
10  switch (code)
11  {
12  case ErrorCode::None:
13  return QString();
15  return tr("Expected string or float[d]");
17  return tr("Expected float[d]");
19  return tr("Expected float[%1]");
21  return tr("Type mismatch, first: '%1'; second: '%2'");
23  return tr("Expected float or float[3]");
25  return tr("Expected '%1' for argument, got '%2'");
27  return tr("Wrong number of arguments, should be 1 to 7");
29  return tr("Wrong number of arguments, should be multiple of 3 plus 1");
31  return tr("Wrong number of arguments, should be 1 or more");
33  return tr("First argument must be a string");
35  return tr("Incomplete format specifier");
37  return tr("No variable named '%1'");
39  return tr("Function '%1' has no definition");
41  return tr("Assignment operation has incorrect type '%1'");
43  return tr("Types of conditional are not compatible");
45  return tr("Variable '%1' defined in conditionals inconsistently");
47  return tr("Too few arguments for function '%1'");
49  return tr("Too many arguments for function '%1'");
51  return tr("Expression generated type '%1', incompatible with desired type '%2'");
53  return tr("Syntax error near '%1'");
55  return tr("Unexpected end of expression near '%1'");
57  return tr("Unexpected end of format string");
59  return tr("Invalid format string, only %v or %f is allowed");
61  return tr("Wrong number of arguments for format string");
62  case ErrorCode::Unknown:
63  default:
64  return tr("Unknown error (message = %1)");
65  }
66 }
static QString message(KSeExpr::ErrorCode code)
ErrorCode
Definition: ErrorCode.h:7
@ InvalidFormatString
Invalid format string, only v or f is allowed.
Definition: ErrorCode.h:59
@ ConditionalTypesNotCompatible
"Types of conditional are not compatible",
Definition: ErrorCode.h:41
@ ExpectedStringOrFloatAnyD
"Expected String or Float[d]"
Definition: ErrorCode.h:12
@ UndeclaredFunction
"Function " << _name << " has no definition"
Definition: ErrorCode.h:37
@ ArgumentTypeMismatch
"Expected "<< type << " for argument, got " << childType
Definition: ErrorCode.h:22
@ BadAssignmentOperator
"Assignment operation has bad type: " << _type
Definition: ErrorCode.h:39
@ WrongNumberOfArgumentsMultiple3Plus1
"Wrong number of arguments, should be multiple of 3 plus 1"
Definition: ErrorCode.h:26
@ SyntaxError
Syntax error.
Definition: ErrorCode.h:53
@ ExpectedFloatAnyD
"Expected Float[d]"
Definition: ErrorCode.h:14
@ FirstArgumentNotString
"First argument must be a string."
Definition: ErrorCode.h:30
@ WrongNumberOfArguments
"Wrong number of arguments, should be 1 to 7"
Definition: ErrorCode.h:24
@ FunctionTooManyArguments
"Too many args for function " << _name
Definition: ErrorCode.h:47
@ ExpectedFloatOrFloat3
"Expected float or FP[3]"
Definition: ErrorCode.h:20
@ UndeclaredVariable
Definition: ErrorCode.h:35
@ Unknown
Unknown error (message = %1)
Definition: ErrorCode.h:64
@ ExpectedFloatD
"Expected Float[" << d << "]"
Definition: ErrorCode.h:16
@ None
OK.
Definition: ErrorCode.h:9
@ TypeMismatch12
"Type mismatch. First: " << first << " Second: " << second
Definition: ErrorCode.h:18
@ WrongNumberOfArguments1Plus
"Wrong number of arguments, should be >= 1"
Definition: ErrorCode.h:28
@ FunctionTooFewArguments
"Too few args for function " << _name
Definition: ErrorCode.h:45
@ UnexpectedEndOfFormatString
Unexpected end of format string.
Definition: ErrorCode.h:57
@ ExpressionIncompatibleTypes
"Expression generated type " << _parseTree->type() << " incompatible with desired type " << _desiredR...
Definition: ErrorCode.h:50
@ IncompleteFormatSpecifier
"incomplete format specifier"
Definition: ErrorCode.h:32
@ UnexpectedEndOfExpression
Unexpected end of expression.
Definition: ErrorCode.h:55
@ InconsistentDefinition
"Variable " << name() << " defined in conditionals inconsistently."
Definition: ErrorCode.h:43
@ WrongNumberOfArgumentsForFormatString
Wrong number of arguments for format string.
Definition: ErrorCode.h:61