Skip to content
Permalink
Browse files

Update expression parser sources

  • Loading branch information
m-kuhn committed Dec 20, 2018
1 parent c72e99a commit 1f3cbb49a87e6cfc7e207679349f4bbf89c15f20
Showing with 9 additions and 9 deletions.
  1. +9 −9 src/core/qgsexpressionparser.yy
@@ -218,7 +218,7 @@ expression:
{
QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionUnknown;
parser_ctx->currentErrorType = errorType;
exp_error(&yyloc, parser_ctx, "Function is not known");
exp_error(&yyloc, parser_ctx, QObject::tr( "Function is not known" ).toUtf8().constData() );
delete $3;
YYERROR;
}
@@ -241,13 +241,13 @@ expression:
QString expectedMessage;
if ( func->params() == func->minParams() )
{
expectedMessage = QStringLiteral( "Expected %1 but got %2." ).arg( QString::number( func->params() ), QString::number( $3->count() ) );
expectedMessage = QObject::tr( "Expected %1 but got %2." ).arg( QString::number( func->params() ), QString::number( $3->count() ) );
}
else
{
expectedMessage = QStringLiteral( "Expected between %1 and %2 parameters but %3 were provided." ).arg( QString::number( func->minParams() ), QString::number( func->params() ), QString::number( $3->count() ) );
expectedMessage = QObject::tr( "Expected between %1 and %2 parameters but %3 were provided." ).arg( QString::number( func->minParams() ), QString::number( func->params() ), QString::number( $3->count() ) );
}
exp_error(&yyloc, parser_ctx, QStringLiteral( "%1 function is called with wrong number of arguments. %2" ).arg( QgsExpression::Functions()[fnIndex]->name(), expectedMessage ).toUtf8().constData() );
exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is called with wrong number of arguments. %2" ).arg( QgsExpression::Functions()[fnIndex]->name(), expectedMessage ).toUtf8().constData() );
delete $3;
YYERROR;
}
@@ -264,7 +264,7 @@ expression:
{
QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionUnknown;
parser_ctx->currentErrorType = errorType;
exp_error(&yyloc, parser_ctx, "Function is not known");
exp_error(&yyloc, parser_ctx, QObject::tr( "Function is not known" ).toUtf8().constData() );
YYERROR;
}
// 0 parameters is expected, -1 parameters means leave it to the
@@ -273,7 +273,7 @@ expression:
{
QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionWrongArgs;
parser_ctx->currentErrorType = errorType;
exp_error(&yyloc, parser_ctx, QString( "%1 function is called with wrong number of arguments" ).arg( QgsExpression::Functions()[fnIndex]->name() ).toLocal8Bit().constData() );
exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is called with wrong number of arguments" ).arg( QgsExpression::Functions()[fnIndex]->name() ).toLocal8Bit().constData() );
YYERROR;
}
$$ = new QgsExpressionNodeFunction(fnIndex, new QgsExpressionNode::NodeList());
@@ -307,7 +307,7 @@ expression:
{
QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionUnknown;
parser_ctx->currentErrorType = errorType;
exp_error(&yyloc, parser_ctx, QString("%1 function is not known").arg(*$1).toLocal8Bit().constData());
exp_error(&yyloc, parser_ctx, QObject::tr( "%1 function is not known" ).arg( *$1 ).toLocal8Bit().constData());
YYERROR;
}
delete $1;
@@ -318,7 +318,7 @@ expression:
{
// @var is equivalent to var( "var" )
QgsExpressionNode::NodeList* args = new QgsExpressionNode::NodeList();
QgsExpressionNodeLiteral* literal = new QgsExpressionNodeLiteral( QString(*$1).mid(1) );
QgsExpressionNodeLiteral* literal = new QgsExpressionNodeLiteral( QString( *$1 ).mid( 1 ) );
args->append( literal );
$$ = new QgsExpressionNodeFunction( QgsExpression::functionIndex( "var" ), args );
delete $1;
@@ -343,7 +343,7 @@ exp_list:
{
QgsExpression::ParserError::ParserErrorType errorType = QgsExpression::ParserError::FunctionNamedArgsError;
parser_ctx->currentErrorType = errorType;
exp_error(&yyloc, parser_ctx, "All parameters following a named parameter must also be named.");
exp_error(&yyloc, parser_ctx, QObject::tr( "All parameters following a named parameter must also be named." ).toUtf8().constData() );
delete $1;
YYERROR;
}

0 comments on commit 1f3cbb4

Please sign in to comment.
You can’t perform that action at this time.