Open RolfSander opened 9 months ago
@RolfSander, is this still an issue or was it addressed in PR #92? Maybe I can take a look if it's still an open issue.
The problem still exists :-(
I have created a temporary branch called issue91test with several test
cases in the ci-tests/F90_small_strato
directory. The
issue91test_ok*.kpp
files work fine, but the issue91test_err*.kpp
files crash. The only difference between them is the location of a
comment that starts with //
and has no space afterwards.
Can you reproduce the errors?
Hi @RolfSander, I am finally back after being away for a bit. Yes, I am able to replicate your results on my end. Also, I modified the ok1 case by adding the same comment after #STOICHMAT ON
:
//This is a comment without a space after the two slashes
#MODEL small_strato
#LANGUAGE Fortran90
#DOUBLE ON
#INTEGRATOR rosenbrock
#DRIVER general
#JACOBIAN SPARSE_LU_ROW
#HESSIAN ON
#STOICMAT ON
//This is a comment without a space after the two slashes
{This is the small_strato example from Chapter 2 of the KPP manual}
and I get this error:
KPP is parsing the equation file.Error :issue91test_ok1.kpp:11: Extra parameter on command line '//This'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'is'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'a'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'comment'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'without'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'a'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'space'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'after'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'the'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'two'
Error :issue91test_ok1.kpp:11: Extra parameter on command line 'slashes'
Then I tried:
//This is a comment without a space after the two slashes
#MODEL small_strato
#LANGUAGE Fortran90
#DOUBLE ON
#INTEGRATOR rosenbrock
#DRIVER general
#JACOBIAN SPARSE_LU_ROW
#HESSIAN ON
#STOICMAT ON
//This is a comment without a space after the two slashes
// This is a comment with a space after the two slashes
{This is the small_strato example from Chapter 2 of the KPP manual}
and I got the same error. I think it because it is expecting a #COMMAND
and not finding one, the parsing gets halted. Where in the parser would we look for this?
@yantosca, thanks for testing this!
Where in the parser would we look for this?
It is called COMMENT2
in scan.l
. I checked the file but couldn't
find any requirement for a space after the //
.
@RolfSander: I took a look at scan.l
. As is my understanding (and my understanding of Flex isn't that great), the line:
<COMMENT2>[^\n]* {
}
should ignore zero or more instances of any character except a newline. I tried a couple of other things but they didn't work. I may give up on this for a bit.
As we cannot solve this problem, let's change our strategy: It's not a bug, it's a feature! I suggest we simply adjust our documentation accordingly:
Comments are either enclosed between the curly braces { and }, or written in a line starting with two slashes and a space "// ".
I agree!
Preprocessor style comments (lines starting with "//") only seem to work if the next character is a space. Otherwise, I get the error message:
This needs to be fixed, probably in
scan.l
, whereCOMMENT2
is defined.