Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full line comments before the first CASE in a CASE block are dropped #160

Open
raehik opened this issue Jul 23, 2021 · 1 comment
Open

Comments

@raehik
Copy link
Collaborator

raehik commented Jul 23, 2021

We attempt to store comments in our AST as statements. Mostly, the places where statements are valid and (full line) comments are valid are the same, so this isn't a problem. However, in the case of the CASE block

select case
  case (expr1)
    statement
  case (expr2)
    statement
end select

the user is able to insert comments between the SELECT CASE statement, and the first CASE statement.

These comments are currently thrown away. I wonder if there's a way we could keep them instead.


Production code does use this pattern: the open source WRF-Chem project uses it a number of times (extract):

       tracer_select: SELECT CASE(config_flags%tracer_opt)
!
! only mixing one fire(smoke) scalar array
!
       CASE (TRACER_SMOKE,TRACER_TEST1,TRACER_TEST2)
        CALL wrf_debug(15,'DOING TRACER MIXING, 1 SPECIE ONLY')
        do nv=2,num_tracer
         do k=kts,kte
            pblst(k)=max(epsilc,tracer(i,k,j,nv))
         enddo

               call vertmx(dtstep,pblst,ekmfull,dryrho_1d, &
                           zzfull,zz,0.,kts,kte)
         do k=kts,kte-1
            tracer(i,k,j,nv)=max(epsilc,pblst(k))
         enddo
        enddo
       CASE DEFAULT
!        CALL wrf_debug(15,'NOT YET DEFINED')
       END SELECT tracer_select
@raehik
Copy link
Collaborator Author

raehik commented Jul 26, 2021

Could throw a Maybe Comment (or Maybe [Comment]?) field into BlCase. Should be straightforward enough to parse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant