summaryrefslogtreecommitdiffstats
path: root/src/constexp.y
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-02-06 19:57:02 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-02-06 20:26:55 (GMT)
commit38fdb5cf1193c792153c139800c92c37a555f9d1 (patch)
tree6ad236162bfec727bab18f1e254642cb8b3fc15d /src/constexp.y
parent0c612fec125124a062b1ba26244631e334e328b7 (diff)
downloadDoxygen-38fdb5cf1193c792153c139800c92c37a555f9d1.zip
Doxygen-38fdb5cf1193c792153c139800c92c37a555f9d1.tar.gz
Doxygen-38fdb5cf1193c792153c139800c92c37a555f9d1.tar.bz2
Refactoring: replace QCString with std::string in constexp
Diffstat (limited to 'src/constexp.y')
-rw-r--r--src/constexp.y43
1 files changed, 20 insertions, 23 deletions
diff --git a/src/constexp.y b/src/constexp.y
index c4110f9..560b3c3 100644
--- a/src/constexp.y
+++ b/src/constexp.y
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2021 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -28,8 +25,8 @@
int constexpYYerror(yyscan_t yyscanner, const char *s)
{
struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
- warn(yyextra->constExpFileName, yyextra->constExpLineNr,
- "preprocessing issue while doing constant expression evaluation: %s: input='%s'",s,yyextra->inputString);
+ warn(yyextra->constExpFileName.c_str(), yyextra->constExpLineNr,
+ "preprocessing issue while doing constant expression evaluation: %s: input='%s'",s,yyextra->inputString.c_str());
return 0;
}
@@ -81,8 +78,8 @@ start: constant_expression
constant_expression: logical_or_expression
{ $$ = $1; }
- | logical_or_expression
- TOK_QUESTIONMARK logical_or_expression
+ | logical_or_expression
+ TOK_QUESTIONMARK logical_or_expression
TOK_COLON logical_or_expression
{
bool c = ($1.isInt() ? ((long)$1 != 0) : ((double)$1 != 0.0));
@@ -108,9 +105,9 @@ logical_and_expression: inclusive_or_expression
inclusive_or_expression: exclusive_or_expression
{ $$ = $1; }
- | inclusive_or_expression TOK_BITWISEOR
+ | inclusive_or_expression TOK_BITWISEOR
exclusive_or_expression
- {
+ {
$$ = CPPValue( (long)$1 | (long)$3 );
}
;
@@ -126,7 +123,7 @@ exclusive_or_expression: and_expression
and_expression: equality_expression
{ $$ = $1; }
| and_expression TOK_AMPERSAND equality_expression
- {
+ {
$$ = CPPValue( (long)$1 & (long)$3 );
}
;
@@ -134,7 +131,7 @@ and_expression: equality_expression
equality_expression: relational_expression
{ $$ = $1; }
| equality_expression TOK_EQUAL relational_expression
- {
+ {
$$ = CPPValue( (long)((double)$1 == (double)$3) );
}
| equality_expression TOK_NOTEQUAL relational_expression
@@ -146,7 +143,7 @@ equality_expression: relational_expression
relational_expression: shift_expression
{ $$ = $1; }
| relational_expression TOK_LESSTHAN shift_expression
- {
+ {
$$ = CPPValue( (long)((double)$1 < (double)$3) );
}
| relational_expression TOK_GREATERTHAN shift_expression
@@ -169,7 +166,7 @@ shift_expression: additive_expression
{ $$ = $1; }
| shift_expression TOK_SHIFTLEFT additive_expression
{
- $$ = CPPValue( (long)$1 << (long)$3 );
+ $$ = CPPValue( (long)$1 << (long)$3 );
}
| shift_expression TOK_SHIFTRIGHT additive_expression
{
@@ -185,7 +182,7 @@ additive_expression: multiplicative_expression
{
$$ = CPPValue( (double)$1 + (double)$3 );
}
- else
+ else
{
$$ = CPPValue( (long)$1 + (long)$3 );
}
@@ -196,7 +193,7 @@ additive_expression: multiplicative_expression
{
$$ = CPPValue( (double)$1 - (double)$3 );
}
- else
+ else
{
$$ = CPPValue( (long)$1 - (long)$3 );
}
@@ -206,7 +203,7 @@ additive_expression: multiplicative_expression
multiplicative_expression: unary_expression
{ $$ = $1; }
| multiplicative_expression TOK_STAR unary_expression
- {
+ {
if (!$1.isInt() || !$3.isInt())
{
$$ = CPPValue( (double)$1 * (double)$3 );
@@ -217,7 +214,7 @@ multiplicative_expression: unary_expression
}
}
| multiplicative_expression TOK_DIVIDE unary_expression
- {
+ {
if (!$1.isInt() || !$3.isInt())
{
$$ = CPPValue( (double)$1 / (double)$3 );
@@ -230,7 +227,7 @@ multiplicative_expression: unary_expression
}
}
| multiplicative_expression TOK_MOD unary_expression
- {
+ {
long value = $3;
if (value==0) value=1;
$$ = CPPValue( (long)$1 % value );
@@ -242,8 +239,8 @@ unary_expression: primary_expression
| TOK_PLUS unary_expression
{ $$ = $1; }
| TOK_MINUS unary_expression
- {
- if ($2.isInt())
+ {
+ if ($2.isInt())
$$ = CPPValue(-(long)$2);
else
$$ = CPPValue(-(double)$2);