Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pablo Winant
preprocessor
Commits
18c68bf2
Commit
18c68bf2
authored
2 years ago
by
MichelJuillard
Browse files
Options
Downloads
Patches
Plain Diff
fix previous commit
parent
1dfd9448
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Statement.cc
+74
-72
74 additions, 72 deletions
src/Statement.cc
with
74 additions
and
72 deletions
src/Statement.cc
+
74
−
72
View file @
18c68bf2
...
...
@@ -185,82 +185,84 @@ void
OptionsList
::
writeOutputCommon
(
ostream
&
output
,
const
string
&
option_group
)
const
{
for
(
const
auto
&
[
name
,
val
]
:
options
)
auto
name1
=
name
;
std
::
visit
([
&
]
<
class
T
>
(
const
T
&
v
)
{
if
constexpr
(
is_same_v
<
T
,
SymbolListVal
>
)
v
.
writeOutput
(
option_group
+
"."
+
name1
,
output
);
else
{
output
<<
option_group
<<
"."
<<
name1
<<
" = "
;
if
constexpr
(
is_same_v
<
T
,
NumVal
>
||
is_same_v
<
T
,
DateVal
>
)
output
<<
v
;
else
if
constexpr
(
is_same_v
<
T
,
pair
<
string
,
string
>>
)
output
<<
'['
<<
v
.
first
<<
"; "
<<
v
.
second
<<
']'
;
else
if
constexpr
(
is_same_v
<
T
,
StringVal
>
)
output
<<
"'"
<<
v
<<
"'"
;
else
if
constexpr
(
is_same_v
<
T
,
vector
<
int
>>
)
{
if
(
v
.
size
()
>
1
)
auto
name1
=
name
;
std
::
visit
([
&
]
<
class
T
>
(
const
T
&
v
)
{
if
constexpr
(
is_same_v
<
T
,
SymbolListVal
>
)
v
.
writeOutput
(
option_group
+
"."
+
name1
,
output
);
else
{
output
<<
option_group
<<
"."
<<
name1
<<
" = "
;
if
constexpr
(
is_same_v
<
T
,
NumVal
>
||
is_same_v
<
T
,
DateVal
>
)
output
<<
v
;
else
if
constexpr
(
is_same_v
<
T
,
pair
<
string
,
string
>>
)
output
<<
'['
<<
v
.
first
<<
"; "
<<
v
.
second
<<
']'
;
else
if
constexpr
(
is_same_v
<
T
,
StringVal
>
)
output
<<
"'"
<<
v
<<
"'"
;
else
if
constexpr
(
is_same_v
<
T
,
vector
<
int
>>
)
{
if
(
v
.
size
()
>
1
)
{
output
<<
'['
;
for
(
int
it
:
v
)
output
<<
it
<<
";"
;
output
<<
']'
;
}
else
output
<<
v
.
front
();
}
else
if
constexpr
(
is_same_v
<
T
,
VecStrVal
>
)
{
output
<<
'['
;
for
(
int
it
:
v
)
output
<<
it
<<
";"
;
output
<<
']'
;
}
else
output
<<
v
.
front
();
}
else
if
constexpr
(
is_same_v
<
T
,
VecStrVal
>
)
{
if
(
v
.
size
()
>
1
)
if
(
v
.
size
()
>
1
)
{
output
<<
'{'
;
for
(
const
auto
&
it
:
v
)
output
<<
"'"
<<
it
<<
"';"
;
output
<<
'}'
;
}
else
output
<<
v
.
front
();
}
else
if
constexpr
(
is_same_v
<
T
,
VecCellStrVal
>
)
{
output
<<
'{'
;
for
(
const
auto
&
it
:
v
)
output
<<
"'"
<<
it
<<
"';"
;
output
<<
'}'
;
}
else
output
<<
v
.
front
();
}
else
if
constexpr
(
is_same_v
<
T
,
VecCellStrVal
>
)
{
/* VecCellStrVal should ideally be merged into VecStrVal.
only difference is treatment of v.size==1, where VecStrVal
does not add quotes and curly brackets, i.e. allows for type conversion of
'2' into the number 2 */
output
<<
'{'
;
for
(
const
auto
&
it
:
v
)
output
<<
"'"
<<
it
<<
"';"
;
output
<<
'}'
;
}
else
if
constexpr
(
is_same_v
<
T
,
VecValueVal
>
)
{
/* For historical reason, those vectors are output as row vectors (contrary
to vectors of integers which are output as column vectors) */
output
<<
'['
;
for
(
const
auto
&
it
:
v
)
output
<<
it
<<
','
;
output
<<
']'
;
}
else
if
constexpr
(
is_same_v
<
T
,
vector
<
vector
<
string
>>>
)
{
// Same remark as for VecValueVal
output
<<
'{'
;
for
(
const
auto
&
v2
:
v
)
/* VecCellStrVal should ideally be merged into VecStrVal.
only difference is treatment of v.size==1, where VecStrVal
does not add quotes and curly brackets, i.e. allows for type conversion of
'2' into the number 2 */
output
<<
'{'
;
for
(
const
auto
&
it
:
v
)
output
<<
"'"
<<
it
<<
"';"
;
output
<<
'}'
;
}
else
if
constexpr
(
is_same_v
<
T
,
VecValueVal
>
)
{
output
<<
'['
;
for
(
const
auto
&
it
:
v2
)
output
<<
it
<<
','
;
output
<<
"], "
;
}
output
<<
'}'
;
}
else
static_assert
(
always_false_v
<
T
>
,
"Non-exhaustive visitor!"
);
output
<<
";"
<<
endl
;
}
},
val
);
/* For historical reason, those vectors are output as row vectors (contrary
to vectors of integers which are output as column vectors) */
output
<<
'['
;
for
(
const
auto
&
it
:
v
)
output
<<
it
<<
','
;
output
<<
']'
;
}
else
if
constexpr
(
is_same_v
<
T
,
vector
<
vector
<
string
>>>
)
{
// Same remark as for VecValueVal
output
<<
'{'
;
for
(
const
auto
&
v2
:
v
)
{
output
<<
'['
;
for
(
const
auto
&
it
:
v2
)
output
<<
it
<<
','
;
output
<<
"], "
;
}
output
<<
'}'
;
}
else
static_assert
(
always_false_v
<
T
>
,
"Non-exhaustive visitor!"
);
output
<<
";"
<<
endl
;
}
},
val
);
}
}
void
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment