From 29d5a1ff57dfb8d07a738e000b5134b2377adc7a Mon Sep 17 00:00:00 2001 From: Qingming He <906459647@qq.com> Date: Sat, 4 Jul 2015 01:46:20 +0800 Subject: [PATCH] test for Fortran enum Test cases contributed by Adam Hirst --- .../fortran-enum.d/expected.tags | 45 ++++++++++++++++ .../parser-fortran.r/fortran-enum.d/input.f90 | 52 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 Units/parser-fortran.r/fortran-enum.d/expected.tags create mode 100644 Units/parser-fortran.r/fortran-enum.d/input.f90 diff --git a/Units/parser-fortran.r/fortran-enum.d/expected.tags b/Units/parser-fortran.r/fortran-enum.d/expected.tags new file mode 100644 index 0000000000..c2da696718 --- /dev/null +++ b/Units/parser-fortran.r/fortran-enum.d/expected.tags @@ -0,0 +1,45 @@ +Constants input.f90 /^module Constants$/;" m +E_e input.f90 /^ real, parameter :: E_e /;" v module:Constants +Named1 input.f90 /^ enum :: Named1$/;" E module:Constants +Named2 input.f90 /^ enum Named2$/;" E module:Constants +Named3 input.f90 /^ enum(8) Named3$/;" E module:Constants +Named4 input.f90 /^ enum*8 Named4$/;" E module:Constants +Named5 input.f90 /^ enum(8) :: Named5$/;" E module:Constants +Named6 input.f90 /^ enum*8 :: Named6$/;" E module:Constants +Named7 input.f90 /^ enum, bind(c) :: Named7$/;" E module:Constants +a input.f90 /^ enumerat/;" N module:Constants +b input.f90 /^ enumerator :: a, b,/;" N module:Constants +black input.f90 /^ enumerator :: red =1, blue, black /;" N module:Constants +blue input.f90 /^ enumerator :: red =1, blue,/;" N module:Constants +bronze input.f90 /^ enumerator gold, silver, bronze$/;" N module:Constants +c input.f90 /^ enumerator :: a, b, c$/;" N module:Constants +gold input.f90 /^ enumerator gold,/;" N module:Constants +hc input.f90 /^ real, parameter :: hc /;" v module:Constants +lavender input.f90 /^ enumerator :: pink, lavender$/;" N module:Constants +pi input.f90 /^ real, parameter :: pi /;" v module:Constants +pink input.f90 /^ enumerator :: pink,/;" N module:Constants +purple input.f90 /^ enumerator :: purple$/;" N module:Constants +red input.f90 /^ enumerator :: red /;" N module:Constants +silver input.f90 /^ enumerator gold, silver,/;" N module:Constants +x1 input.f90 /^ enumerator :: x1,/;" N module:Constants +x2 input.f90 /^ enumerator :: x2,/;" N module:Constants +x3 input.f90 /^ enumerator :: x3,/;" N module:Constants +x4 input.f90 /^ enumerator :: x4,/;" N module:Constants +x5 input.f90 /^ enumerator :: x5,/;" N module:Constants +x6 input.f90 /^ enumerator :: x6,/;" N module:Constants +x7 input.f90 /^ enumerator :: x7,/;" N module:Constants +y1 input.f90 /^ enumerator :: x1, y1,/;" N module:Constants +y2 input.f90 /^ enumerator :: x2, y2,/;" N module:Constants +y3 input.f90 /^ enumerator :: x3, y3,/;" N module:Constants +y4 input.f90 /^ enumerator :: x4, y4,/;" N module:Constants +y5 input.f90 /^ enumerator :: x5, y5,/;" N module:Constants +y6 input.f90 /^ enumerator :: x6, y6,/;" N module:Constants +y7 input.f90 /^ enumerator :: x7, y7,/;" N module:Constants +yellow input.f90 /^ enumerator yellow$/;" N module:Constants +z1 input.f90 /^ enumerator :: x1, y1, z1$/;" N module:Constants +z2 input.f90 /^ enumerator :: x2, y2, z2$/;" N module:Constants +z3 input.f90 /^ enumerator :: x3, y3, z3$/;" N module:Constants +z4 input.f90 /^ enumerator :: x4, y4, z4$/;" N module:Constants +z5 input.f90 /^ enumerator :: x5, y5, z5$/;" N module:Constants +z6 input.f90 /^ enumerator :: x6, y6, z6$/;" N module:Constants +z7 input.f90 /^ enumerator :: x7, y7, z7$/;" N module:Constants diff --git a/Units/parser-fortran.r/fortran-enum.d/input.f90 b/Units/parser-fortran.r/fortran-enum.d/input.f90 new file mode 100644 index 0000000000..90ef81315e --- /dev/null +++ b/Units/parser-fortran.r/fortran-enum.d/input.f90 @@ -0,0 +1,52 @@ +module Constants + implicit none + + real, parameter :: pi = 4 * atan(1.0) + real, parameter :: E_e = 510998.91013 + + ! we now have enumerators in F2003/8, for the sake of interop with C + enum, bind(c) ! unnamed 1 + enumerator :: red =1, blue, black =5 + enumerator yellow + enumerator gold, silver, bronze + enumerator :: purple + enumerator :: pink, lavender + end enum + + enum ! unnamed 2 + enumerator :: a, b, c + end enum + + enum :: Named1 + enumerator :: x1, y1, z1 + end enum + + enum Named2 + enumerator :: x2, y2, z2 + end enum + + enum(8) Named3 + enumerator :: x3, y3, z3 + end enum + + enum*8 Named4 + enumerator :: x4, y4, z4 + end enum + + enum(8) :: Named5 + enumerator :: x5, y5, z5 + end enum + + enum*8 :: Named6 + enumerator :: x6, y6, z6 + end enum + + enum, bind(c) :: Named7 + enumerator :: x7, y7, z7 + end enum + + real, parameter :: hc = 12398.4193 + + public + +end module Constants