Skip to content

issue in highlighting fortran code: kind of intrinsic data type #1723

@kookma

Description

@kookma

In modern fortran you can set the kind of intrinsic data type. It means you can define additional intrinsic data type. When you do so, for literal constants you have to use the kind name attached to literal consonant using under score.

Example

PROGRAM test_initial
INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13)
REAL(KIND=DBL) :: a1 = 6.666666666666666
REAL(KIND=DBL) :: a2 = 6.666666666666666_DBL
WRITE (*,*) a1, a2
END PROGRAM test_initial

Highlight.js issue

When using highlight.js to highlight a Fortran code contains such named constant, highlight.js fails to do the job! It highlights the remaining code (from the position of named constant) in a wrong way!

Note

  • The above code in this post is highlighted by github, it works correctly! See the name constant is in blue color.
  • other intrinsic data can have other kind. But in all cases in named constants, the kind is specified by an underscore to the constant (e.g 12_ps)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn enhancement or new featuregood first issueShould be easier for first time contributorshelp welcomeCould use help from community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions