Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Méso-NH code
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Méso-NH
Méso-NH code
Commits
e3756854
Commit
e3756854
authored
2 years ago
by
RIETTE Sébastien
Browse files
Options
Downloads
Patches
Plain Diff
Additional controls in verify_mnh_expand
No WHERE statement in mnh_expand_array bloc Closing brackets for directives
parent
fef6380b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
verify_mnh_expand.py
+9
-0
9 additions, 0 deletions
verify_mnh_expand.py
with
9 additions
and
0 deletions
verify_mnh_expand.py
+
9
−
0
View file @
e3756854
...
@@ -41,6 +41,9 @@ def verify_mnh_expand(path):
...
@@ -41,6 +41,9 @@ def verify_mnh_expand(path):
open_directive
=
line
[
13
:].
split
(
b
'
(
'
)[
0
]
open_directive
=
line
[
13
:].
split
(
b
'
(
'
)[
0
]
open_args
=
line
[
13
:].
split
(
b
'
(
'
)[
1
].
split
(
b
'
)
'
)[
0
].
replace
(
b
'
'
,
b
''
)
open_args
=
line
[
13
:].
split
(
b
'
(
'
)[
1
].
split
(
b
'
)
'
)[
0
].
replace
(
b
'
'
,
b
''
)
dim
=
len
(
line
.
split
(
b
'
(
'
)[
1
].
split
(
b
'
,
'
))
dim
=
len
(
line
.
split
(
b
'
(
'
)[
1
].
split
(
b
'
,
'
))
if
line
[
-
1
:]
!=
b
'
)
'
:
logging
.
error
(
'
Open directive must end with a closing bracket.
'
+
'
Line {line} of file {filename}
'
.
format
(
line
=
iline
+
1
,
filename
=
path
))
elif
line
[:
17
]
==
b
'
!$mnh_end_expand_
'
:
elif
line
[:
17
]
==
b
'
!$mnh_end_expand_
'
:
#End of a mnh_expand bloc
#End of a mnh_expand bloc
logging
.
debug
(
'
Closing directive found. Line {line} of file {filename}
'
.
format
(
line
=
iline
+
1
,
filename
=
path
))
logging
.
debug
(
'
Closing directive found. Line {line} of file {filename}
'
.
format
(
line
=
iline
+
1
,
filename
=
path
))
...
@@ -61,6 +64,9 @@ def verify_mnh_expand(path):
...
@@ -61,6 +64,9 @@ def verify_mnh_expand(path):
'
Line {line} of file {filename}
'
.
format
(
endargs
=
end_args
.
decode
(
'
UTF-8
'
),
'
Line {line} of file {filename}
'
.
format
(
endargs
=
end_args
.
decode
(
'
UTF-8
'
),
openargs
=
open_args
.
decode
(
'
UTF-8
'
),
openargs
=
open_args
.
decode
(
'
UTF-8
'
),
line
=
iline
+
1
,
filename
=
path
))
line
=
iline
+
1
,
filename
=
path
))
if
line
[
-
1
:]
!=
b
'
)
'
:
logging
.
error
(
'
Closing directive must end with a closing bracket.
'
+
'
Line {line} of file {filename}
'
.
format
(
line
=
iline
+
1
,
filename
=
path
))
elif
inside
:
elif
inside
:
#We do not want to implement a full fortran parser, we are only interested in the left hand side of
#We do not want to implement a full fortran parser, we are only interested in the left hand side of
#affectation instructions. If left hand side is correct (an array element) the right hand side
#affectation instructions. If left hand side is correct (an array element) the right hand side
...
@@ -76,6 +82,9 @@ def verify_mnh_expand(path):
...
@@ -76,6 +82,9 @@ def verify_mnh_expand(path):
line
=
line
[
1
:].
strip
()
line
=
line
[
1
:].
strip
()
if
line
.
upper
()[:
5
]
in
(
b
'
THEN
'
,
b
'
THEN!
'
):
line
=
line
[
5
:]
if
line
.
upper
()[:
5
]
in
(
b
'
THEN
'
,
b
'
THEN!
'
):
line
=
line
[
5
:]
elif
line
[:
6
].
upper
()
in
(
b
'
WHERE
'
,
b
'
WHERE(
'
):
elif
line
[:
6
].
upper
()
in
(
b
'
WHERE
'
,
b
'
WHERE(
'
):
if
open_directive
!=
b
'
where
'
:
logging
.
error
(
'
There is a WHERE statement in a mnh_expand array bloc.
'
'
Line {line} of file {filename}
'
.
format
(
line
=
iline
+
1
,
filename
=
path
))
line
=
line
[
line
.
index
(
b
'
(
'
)
+
1
:]
line
=
line
[
line
.
index
(
b
'
(
'
)
+
1
:]
nb
=
1
nb
=
1
while
nb
>=
1
and
(
len
(
line
)
>
0
):
while
nb
>=
1
and
(
len
(
line
)
>
0
):
...
...
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