Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dynare
preprocessor
Commits
c6467af8
Verified
Commit
c6467af8
authored
Apr 10, 2019
by
Houtan Bastani
Browse files
Read options at top of .mod file as long as they exist on the first *non empty* line
In other words, allow newlines before these options
parent
2a9c4b23
Pipeline
#1116
passed with stage
in 1 minute and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/DynareMain.cc
View file @
c6467af8
...
...
@@ -74,19 +74,23 @@ vector<string>
parse_options_line
(
istream
&
modfile
)
{
vector
<
string
>
options
;
string
first_line
;
getline
(
modfile
,
first_line
);
string
first_nonempty_line
;
regex
pat
{
R"(^\s*//\s*--\+\s*options:([^\+]*)\+--)"
};
smatch
matches
;
if
(
regex_search
(
first_line
,
matches
,
pat
))
if
(
matches
.
size
()
>
1
&&
matches
[
1
].
matched
)
while
(
getline
(
modfile
,
first_nonempty_line
))
if
(
first_nonempty_line
!=
""
)
{
regex
pat2
{
R"(([^,\s]+))"
};
string
s
{
matches
[
1
]};
for
(
sregex_iterator
p
(
s
.
begin
(),
s
.
end
(),
pat2
);
p
!=
sregex_iterator
{};
++
p
)
options
.
push_back
((
*
p
)[
1
]);
if
(
regex_search
(
first_nonempty_line
,
matches
,
pat
))
if
(
matches
.
size
()
>
1
&&
matches
[
1
].
matched
)
{
regex
pat2
{
R"(([^,\s]+))"
};
string
s
{
matches
[
1
]};
for
(
sregex_iterator
p
(
s
.
begin
(),
s
.
end
(),
pat2
);
p
!=
sregex_iterator
{};
++
p
)
options
.
push_back
((
*
p
)[
1
]);
}
break
;
}
modfile
.
seekg
(
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment