-
Notifications
You must be signed in to change notification settings - Fork 2
/
syntax_test_fortran.F90
1130 lines (1113 loc) · 43.9 KB
/
syntax_test_fortran.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
! SYNTAX TEST "modern-fortran.sublime-syntax"
!
if (a == b) then
! ^^ keyword.control.fortran
! ^^^^ keyword.control.fortran
elseif (a == c) then
! ^^^^^^ keyword.control.fortran
!
else if (a == d) then
! ^^^^ keyword.control.fortran
! ^^ keyword.control.fortran
! ^^^^^^^^ meta.parens.fortran
! ^ punctuation.section.parens.begin.fortran
! ^ punctuation.section.parens.end.fortran
!
else
! ^^^^ keyword.control.fortran
!
endif
! ^^^^ keyword.control.fortran
!
end
! ^^^ keyword.control.fortran
!
read(unit=myUnit, end=200) byte ! Read until end of file, then go to 200
! ^^^^ variable.function.subroutine.intrinsic.io.fortran
! ^^^^ variable.language.io.fortran
! ^^^ variable.language.io.fortran
!
a == b .and. c
! ^^ keyword.operator.comparison.fortran
! ^^^^^ keyword.operator.word.fortran
!
a => b
! ^^ keyword.operator.points-to.fortran
!
a = b
! ^ keyword.operator.assignment.fortran
!
a = [1, 2, 3]
! ^^^^^^^^^ meta.brackets.fortran
! ^ punctuation.section.brackets.begin.fortran
! ^ punctuation.section.brackets.end.fortran
!
a = (/1, 2, 3/)
! ^^^^^^^^^^^ meta.parens.fortran
! ^^ punctuation.section.parens.begin.fortran - keyword
! ^^ punctuation.section.parens.end.fortran - keyword
!
integer(kind=8), dimension(:,:), allocatable :: myInt
! ^^^^^^^ storage.type.intrinsic.fortran
! ^ meta.parens.fortran punctuation.section.parens.begin.fortran
! ^^^^ meta.parens.fortran variable.other.fortran
! ^ meta.parens.fortran keyword.operator.assignment.fortran
! ^ meta.parens.fortran meta.number.integer.decimal.fortran constant.numeric.value.fortran
! ^ meta.parens.fortran punctuation.section.parens.end.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^^^ storage.modifier.fortran
! ^ meta.parens.fortran punctuation.section.parens.begin.fortran
! ^ meta.parens.fortran punctuation.separator.single-colon.fortran
! ^ meta.parens.fortran punctuation.separator.comma.fortran
! ^ meta.parens.fortran punctuation.separator.single-colon.fortran
! ^^^^^ variable.other.fortran
! ^ - variable.other.fortran
! ^^^^^^^ storage.type.intrinsic.fortran
! ^^^^^^^^^ storage.modifier.fortran
! ^^^^^^^^^^^ storage.modifier.fortran
!
real(4) :: aNumber
! ^^^^ storage.type.intrinsic.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^ variable.other.fortran
!
integer myInteger
! ^^^^^^^ storage.type.intrinsic.fortran
! ^^^^^^^^^ variable.other.fortran
logical myLogical
! ^^^^^^^ storage.type.intrinsic.fortran
! ^^^^^^^^^ variable.other.fortran
real myReal
! ^^^^ storage.type.intrinsic.fortran
! ^^^^^^ variable.other.fortran
!
do while (a .ne. b) ! a side-comment
! ^^ keyword.control.fortran
! ^^^^^ keyword.control.fortran
! ^^^^^^^^^^^^^^ comment.line.fortran
!
type(interval) :: myInterval ! object instance declaration, not type definition
! ^^^^ keyword.other.fortran
! ^ meta.parens.fortran punctuation.section.parens.begin.fortran
! ^^^^^^^^ meta.parens.fortran storage.type.class.fortran
! ^ meta.parens.fortran punctuation.section.parens.end.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^^^ variable.other.fortran
!
type (interval) :: myInterval ! object instance declaration, not type definition
! ^^^^ keyword.other.fortran
! ^ meta.parens.fortran punctuation.section.parens.begin.fortran
! ^^^^^^^^ meta.parens.fortran storage.type.class.fortran
! ^ meta.parens.fortran punctuation.section.parens.end.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^^^ variable.other.fortran
!
enddo
! ^^^^^ keyword.control.fortran
!
enddoo
! ^^^^^ - keyword
!
elsei ! should not recognize 'else' in 'elsei'
! ^^^^ - keyword.control.fortran
!
exitflag = 0
! ^^^^ - keyword
!
if (.true.) then
print*, 'test'; endif
! ^^^^^ keyword.control.fortran
!
real(dp), intent(in) :: myReal ! a side-comment
! ^^^^ storage.type.intrinsic.fortran
! ^^ variable.other.fortran
! ^^^^^^ storage.modifier.fortran
! ^^ keyword.other.intent.fortran
! ^^^^^^ variable.other.fortran
! ^^^^^^^^^^^^^^ comment.line.fortran
class(myClass), allocatable :: myClassInstance
! ^^^^^ keyword.other.fortran
! ^^^^^^^^^ meta.parens.fortran
! ^ punctuation.section.parens.begin.fortran
! ^^^^^^^ storage.type.class.fortran
! ^ punctuation.section.parens.end.fortran
! ^^^^^^^^^^^ storage.modifier.fortran
!
type :: myClass1
! ^^^^ meta.class.declaration.fortran keyword.declaration.class.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^ entity.name.class.fortran
! ^^^^^^^^^^^^^^^^ meta.class.declaration.fortran
!
class(abstractClass), allocatable :: polymorphicStrategy
! ^^^^^ keyword.other.fortran
! ^^^^^^^^^^^^^^^ meta.parens.fortran
! ^ punctuation.section.parens.begin.fortran
! ^^^^^^^^^^^^^ storage.type.class.fortran
! ^ punctuation.section.parens.end.fortran
! ^^^^^^^^^^^^^^^^^^^ variable.other.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^^^^ storage.modifier.fortran
!
! ...
!
contains
! ^^^^^^^^ keyword.declaration.contains.fortran
!
procedure :: doStuff => myDoStuffRoutine
! ^^^^^^^^^ keyword.declaration.function.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^ entity.name.function.fortran
! ^^ keyword.operator.points-to.fortran
! ^^^^^^^^^^^^^^^^ entity.name.function.fortran
!
procedure, private :: doStuffMyWay => doStuffMyWayRoutine
! ^^^^^^^^^ keyword.declaration.function.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^ keyword.operator.points-to.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^ storage.modifier.fortran
! ^^^^^^^^^^^^ entity.name.function.fortran
! ^^^^^^^^^^^^^^^^^^ entity.name.function.fortran
!
procedure, private :: aRatherLongFunctionNameIndeed &
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.function.fortran
! ^ punctuation.separator.continuation.fortran
=> theImplementationNameOfTheRatherLongFunction
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entity.name.function.fortran
! ^^ keyword.operator.points-to.fortran
!
end type myClass1
! ^^^ keyword.declaration.class.fortran
! ^^^^ keyword.declaration.class.fortran
! ^^^^^^^^ entity.name.class.fortran - meta.class.declaration.fortran
!
!
type, abstract :: myClass2
! ^^^^ keyword.declaration.class.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^^ storage.modifier.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^ entity.name.class.fortran
"This is a simple string"
!
"This is a simple string, &
& but 'with' continuation, &
& and more continuation!"
!
'This is a simple string'
! ^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single.fortran
! ^ punctuation.definition.string.begin.fortran
! ^ punctuation.definition.string.end.fortran
&
! ^ punctuation.separator.continuation.fortran
!
'This is a simple string, &
& but "with" continuation, &
& and more continuation!'
! ^ punctuation.separator.continuation.fortran
!
'This is a simple string & !no comment here'
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single.fortran - punctuation.separator.continuation - comment
!
'This is a simple string, &
! this is a comment, followed by a blank line
& and this is continuation of the string'
'Line continuation character missing on the next line, &
but highlighting of the rest of the file is still not messed up.'
x = 1
! ^^^^^ - string
!
'string' // ' contatenation!'
! ^^ keyword.operator.arithmetic.string-concatenation.fortran
!
function theFunction()
! ^^^^^^^^^^^^^^^^^^^^ meta.function.declaration.fortran
! ^^ meta.function.parameters.fortran
! ^^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^^^^ entity.name.function.fortran
pure function theFunction()
! ^^^^ storage.modifier.function.prefix.fortran
! ^^^^^^^^^^^^^^^^^^^^ meta.function.declaration.fortran
! ^^ meta.function.parameters.fortran
! ^^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^^^^ entity.name.function.fortran
recursive module function theFunction(a)
! ^^^^^^^^^ storage.modifier.function.prefix.fortran
! ^^^^^^ storage.modifier.function.prefix.fortran
! ^^^ meta.function.parameters.fortran
! ^ punctuation.section.parens.begin.fortran
! ^ variable.parameter.input.fortran
! ^ punctuation.section.parens.end.fortran
function theFunction(a, bee, cesium)
! ^^^^^^^^ meta.function.declaration.fortran keyword.declaration.function.fortran
! ^^^^^^^^^^^ meta.function.declaration.fortran entity.name.function.fortran
! ^^^^^^^^^^^^^^^^ meta.function.parameters.fortran
! ^ punctuation.section.parens.begin.fortran
! ^ variable.parameter.input.fortran
! ^ punctuation.separator.comma.fortran
! ^^^ variable.parameter.input.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^ variable.parameter.input.fortran
! ^ punctuation.section.parens.end.fortran
function theFunction(a, & ! comment
! ^^^^^^^^^^^^^^^^ meta.function.parameters.fortran
! ^ punctuation.separator.continuation.fortran
! ^^^^^^^^^^ comment.line.fortran
b, c)
!^^^^^^^^^^ meta.function.parameters.fortran
! ^ variable.parameter.input.fortran
!
function result(a)
! ^^^^^^ entity.name.function.fortran - keyword
!
pure function getStuff(a) result(theStuff)
! ^^^^ storage.modifier.function.prefix.fortran
! ^^^^^^^^^^^^^^^^^ meta.function.declaration.fortran - meta.function meta.function
! ^^^ meta.function.parameters.fortran - meta.function meta.function
! ^^^^^^^ meta.function.declaration.fortran - meta.function meta.function
! ^^^^^^^^^^ meta.function.parameters.fortran - meta.function meta.function
! ^ - meta.function.parameters
! ^ punctuation.section.parens.begin.fortran
! ^ variable.parameter.input.fortran
! ^ punctuation.section.parens.end.fortran
! ^^^^^^ keyword.control.function-result.fortran
! ^ punctuation.section.parens.begin.fortran
! ^^^^^^^^ variable.parameter.output.fortran
! ^ punctuation.section.parens.end.fortran
!
end function getStuff
! ^^^ keyword.declaration.function.fortran
! ^ - keyword
! ^^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^ entity.name.function.fortran - meta.function.declaration
!
real(dp) function myFunction(a, b, c)
! ^^^^ storage.type.intrinsic.fortran
! ^^ variable.other.fortran
! ...
!
end function myFunction
!
module subroutine doStuff(a, b, c)
! ^^^^^^ storage.modifier.function.prefix.fortran
! ^^^^^^^^^^^^^^^^^^ meta.function.declaration.fortran
! ^^^^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^ entity.name.function.fortran
!
implicit none
! ^^^^^^^^ keyword.control.fortran
! ^^^^ keyword.control.fortran
!
end subroutine doStuff
!
module subroutine doStuff(ace, bees, cees, & ! a comment
! ^ punctuation.separator.continuation.fortran
dees, ees, fsss)
! ^^^^ variable.parameter.fortran
!
module myModule
! ^^^^^^ keyword.declaration.interface.module.fortran
! ^^^^^^^^ entity.name.interface.module.fortran
! ^^^^^^^^^^^^^^^ meta.module.declaration.fortran
!
module myModule ! comment
! ^^^^^^ keyword.declaration.interface.module.fortran
! ^^^^^^^^ entity.name.interface.module.fortran
! ^^^^^^^^^^^^^^^ meta.module.declaration.fortran
!
end module myModule
! ^^^ keyword.declaration.interface.module.fortran
! ^^^^^^ keyword.declaration.interface.module.fortran
! ^^^^^^^^ entity.name.interface.module.fortran - meta.module.declaration.fortran
!
end module
! ^^^ keyword.declaration.interface.module.fortran
! ^^^^^^ keyword.declaration.interface.module.fortran
!
submodule (moduleName) submoduleName
! ^^^^^^^^^ keyword.declaration.interface.submodule.fortran
! ^^^^^^^^^^ entity.name.interface.inherited-module.fortran
! ^^^^^^^^^^^^^ entity.name.interface.submodule.fortran
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.submodule.declaration.fortran
!
end submodule submoduleName
! ^^^^^^^^^ keyword.declaration.interface.submodule.fortran
! ^^^^^^^^^^^^^ entity.name.interface.submodule.fortran - meta.submodule.declaration.fortran
!
end submodule ! just empty end-name also allowed
! ^^^^^^^^^ keyword.declaration.interface.submodule.fortran
!
end submodule
! ^^^ keyword.declaration.interface.submodule.fortran
! ^^^^^^^^^keyword.declaration.interface.submodule.fortran
!
8
! ^ meta.number.integer.decimal.fortran constant.numeric.value.fortran
123
! ^^^ meta.number.integer.decimal.fortran constant.numeric.value.fortran
1_8
! ^ meta.number.integer.decimal.fortran constant.numeric.value.fortran
! ^^ meta.number.integer.decimal.fortran constant.numeric.suffix.fortran
123.
! ^^^^ meta.number.float.decimal.fortran constant.numeric.value.fortran
! ^ punctuation.separator.decimal.fortran
.123
! ^^^^ meta.number.float.decimal.fortran constant.numeric.value.fortran
! ^ punctuation.separator.decimal.fortran
1.0d-12
! ^^^^^^^ meta.number.float.decimal.fortran constant.numeric.value.fortran
! ^ punctuation.separator.decimal.fortran
1.2345E-10
! ^^^^^^^^^^ meta.number.float.decimal.fortran constant.numeric.value.fortran
! ^ punctuation.separator.decimal.fortran
1e2
! ^^^ meta.number.float.decimal.fortran constant.numeric.value.fortran
1.23_dp
! ^^^^^^^ meta.number.float.decimal.fortran
! ^^^^ constant.numeric.value.fortran
! ^^^ constant.numeric.suffix.fortran
! ^ punctuation.separator.decimal.fortran
!
dplusone = d+1
! ^ keyword.operator.arithmetic.fortran - constant.numeric
!
a = minval(b)
! ^^^^^^ support.function.intrinsic.fortran
!
! type casting versus variable declaration
real(8) :: aRealNumber
! ^^^^ storage.type.intrinsic.fortran
!
interface myInterface
! ^^^^^^^^^ keyword.declaration.interface.interface.fortran
! ^^^^^^^^^^^ entity.name.interface.interface.fortran
! ^ - entity.name.interface.interface.fortran
! ^^^ - entity.name.interface.interface.fortran
!
include "path/to/file.F90"
! ^^^^^^^ keyword.control.import.fortran
!
end interface myInterface
! ^^^ keyword.declaration.interface.interface.fortran
! ^^^^^^^^^ keyword.declaration.interface.interface.fortran
! ^^^^^^^^^^^ entity.name.interface.interface.fortran
!
abstract interface
! ^^^^^^^^ storage.modifier.fortran
! ^^^^^^^^^ keyword.declaration.interface.interface.fortran
!
end interface
! ^^^ keyword.declaration.interface.interface.fortran
! ^^^^^^^^^ keyword.declaration.interface.interface.fortran
!
if (thing == object%getThing('string', .true.)) call object%doStuff()
! ^^^^^^ storage.type.class.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^^ variable.function.fortran
! ^^^^^^ string.quoted.single.fortran
! ^^^^^^ constant.language.fortran
!
use moduleName, only: moduleRoutine, moduleObject, &
! ^^^ keyword.control.import.fortran
! ^^^^^^^^^^ entity.name.interface.module.fortran
! ^^^^^^^^^^^^^ variable.other.fortran
! ^^^^ keyword.control.fortran
! ^ punctuation.separator.comma.fortran
! ^ punctuation.separator.single-colon.fortran
! ^ punctuation.separator.continuation.fortran
otherModuleRoutine, anotherModuleObject
! ^^^^^^^^^^^^^^^^^^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
!
use ! incomplete use statement
! ^^^ keyword.control.import.fortran
! ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.fortran
evenNumber = 0
! ^^^^^^^^^^ variable.other.fortran
!
do I = 1, 10
! ^^ keyword.control.fortran
! ^ variable.other.fortran
! ^ constant.numeric.value.fortran
! ^ punctuation.separator.comma.fortran
! ^^ constant.numeric.value.fortran
!
evenNumber = evenNumber + 2*I
! ^^^^^^^^^^ variable.other.fortran
! ^^^^^^^^^^ variable.other.fortran
! ^ variable.other.fortran
! ^ constant.numeric.value.fortran
enddo
! ^^^^^ keyword.control.fortran
!
thing = object%inObject%inInObject(I)%get_thing(J)
! ^^^^^ variable.other.fortran
! ^^^^^^ storage.type.class.fortran
! ^^^^^^^^ storage.type.class.fortran
! ^^^^^^^^^^ storage.type.class.fortran
! ^^^^^^^^^ variable.function.fortran
!
aRealNumber = real(anInteger)
! ^^^^ support.function.intrinsic.fortran
! ^^^^^^^^^ variable.other.fortran
! simple function call
call mySubroutine(a, b, c)
! ^^^^ keyword.control.fortran
! ^^^^^^^^^^^^ variable.function.fortran
!
myVar = object%objectVariable
! ^^^^^ variable.other.fortran
! ^^^^^^ storage.type.class.fortran
! ^ punctuation.accessor.fortran
! ^^^^^^^^^^^^^^ variable.other.fortran
!
myVar = object % objectVariable
! ^^^^^^ storage.type.class.fortran
! ^ - storage.type
! ^ punctuation.accessor.fortran
! ^^^^^^^^^^^^^^ variable.other.fortran
!
myVar = object%objectVariable%getStuff(a, b)
! ^^^^^^ storage.type.class.fortran
! ^^^^^^^^^^^^^^ storage.type.class.fortran
! ^^^^^^^^ variable.function.fortran
!
myVar = object%objectFunction(a, b, c, otherObject%variable)
! ^^^^^^ storage.type.class.fortran
! ^^^^^^^^^^^^^^ variable.function.fortran
! ^^^^^^^^^^^ storage.type.class.fortran
! ^^^^^^^^ variable.other.fortran
!
result = foo(object%member)
! ^^^ variable.function.fortran
! ^^^^^^ storage.type.class.fortran
! ^^^^^^ variable.other.fortran
!
result = foo(object(k)%member)
! ^^^ variable.function.fortran
! ^^^^^^ storage.type.class.fortran
! ^ variable.other.fortran
! ^^^^^^ variable.other.fortran
!
call object%calculateStuff()
! ^^^^^^ storage.type.class.fortran
! ^^^^^^^^^^^^^^ variable.function
!
if (a == b) call mySubroutine(a, b, c)
! ^^^^ keyword.control.fortran
! ^^^^^^^^^^^^ variable.function
!
call object%objectFunction(anotherObject%variable)
! ^^^^^^^^^^^^^ storage.type.class.fortran
! ^^^^^^^^ variable.other.fortran
!
call object%objectFunction(anotherObject%myFunction())
! ^^^^^^^^^^ variable.function.fortran
!
if (present(myArgument)) call doThing(myArgument)
! ^^ keyword.control.fortran
! ^^^^^^^ support.function.intrinsic.fortran
! ^^^^^^^ variable.function.fortran
!
real(dp), dimension(wf%n_ao**2, wf%n_densities), intent(in), optional :: prev_ao_density
! ^^^^ storage.type.intrinsic.fortran
! ^^^^^^^^^ storage.modifier.fortran
! ^^ keyword.other.intent.fortran
! ^^^^^^ storage.modifier.fortran
! ^^ storage.type.class.fortran
! ^ punctuation.accessor.fortran
! ^^^ variable.other.fortran
!
#ifdef myVar
!<- keyword.control.directive.fortran
!^^^^^ keyword.control.directive.fortran
! ^^^^^ variable.other.fortran
integer, parameter :: p = 1
#else
!<- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
integer, parameter :: p = 2
#endif
!<- keyword.control.directive.fortran
!^^^^^ keyword.control.directive.fortran
#include "someFile.F08"
! ^^^^^^^^^^^^^^ string.quoted.double.fortran
! ^ punctuation.definition.string.begin.fortran
! ^ punctuation.definition.string.end.fortran
!$acc parallel create(I, someThing) default(none)
! <- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! ^^^^^^ keyword.control.directive.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^^^ variable.other.fortran
! ^^^^^^^ keyword.control.directive.fortran
! ^^^^ support.constant.acc
!
! Here we test unclosed bracket in "default"
! => incomplete expression should not lead to lines below being incorrectly matched
!$acc parallel create(I) default(none
!
!^ comment.line.fortran
!
!$acc parallel create(I, &
!$acc & someThing) default(none)
! <- keyword.control.directive.fortran
! ^^^ keyword.control.directive.fortran
! ^ punctuation.separator.continuation.fortran
! ^^^^^^^^^ variable.other.fortran
! ^^^^^^^ keyword.control.directive.fortran
! ^^^^ support.constant.acc
!$acc parallel create(I, &
!$acc someThing) default(none)
! <- keyword.control.directive.fortran
! ^^^ keyword.control.directive.fortran
! ^^^^^^^^^ variable.other.fortran
! ^^^^^^^ keyword.control.directive.fortran
! ^^^^ support.constant.acc
!
!$acc loop vector
! <- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
! ^^^^ keyword.control.directive.fortran
! ^^^^^^ keyword.control.directive.fortran
do I = 1, 10
!
f(I) = someThing(I)
!
enddo
!$acc end parallel
!<- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
! ^^^ keyword.control.directive.fortran
! ^^^^^^^^ keyword.control.directive.fortran
!
! Here we test that the whole terms "copyin" and "if_present" are detected (and not only "copy" and "if")
!$acc parallel copyin if_present(someThing)
! <- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! ^^^^^^ keyword.control.directive.fortran
! ^^^^^^^^^^ keyword.control.directive.fortran
!
!$omp parallel do private(I, J, &
!$omp & K, L, M, N, O) schedule(dynamic)
! ^^^ keyword.control.directive.fortran
! ^ punctuation.separator.continuation.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! ^^^^^^^ support.constant.omp
!$omp parallel do private(I, J, &
!$omp K, L, M, N, O) schedule(dynamic)
! ^^^ keyword.control.directive.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! ^^^^^^^ support.constant.omp
!$omp parallel do private(I) schedule(dynamic)
! <- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! ^^ keyword.control.directive.fortran
! ^^^^^^^ keyword.control.directive.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! ^ variable.other.fortran
! ^^^^^^^ support.constant.omp
do I = 1, 10
!
!$ thread = omp_get_num_threads()
!^ keyword.control.directive.fortran
! ^^^^^^^^^^^^^^^^^^^ support.function.omp
!
f(I) = someThing(I)
!
enddo
!$omp end parallel do
!<- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
! ^^ keyword.control.directive.fortran
! ^^^ keyword.control.directive.fortran
! ^^^^^^^^ keyword.control.directive.fortran
! Here we test that the whole term "taskgroup" is detected (and not only "task")
!$omp taskgroup
!<- keyword.control.directive.fortran
!^^^^ keyword.control.directive.fortran
! ^^^^^^^^^ keyword.control.directive.fortran
type1 = "hello!" ! should understand that 'type1' is a variable
! ^^^^^ variable.other.fortran
! ^^^^^^^^ string.quoted.double.fortran
! ^ punctuation.definition.string.begin.fortran
! ^ punctuation.definition.string.end.fortran
! ^^^^^^ comment.line.fortran
!
used_diag(j) = 5 ! should not recognize "use" as keyword
! ^^^^^^^^^ variable.function.fortran
!
real(dp) function myFunction(a, b, c) result(someResult)
! ^^^^ storage.type.intrinsic.fortran
! ^^ variable.other.fortran
! ^^^^^^^^^^ variable.parameter.output.fortran
! ^^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^^^ entity.name.function.fortran
!
program myProgram
!<- meta.program.declaration.fortran keyword.declaration.program.fortran
!^^^^^^ meta.program.declaration.fortran keyword.declaration.program.fortran
! ^^^^^^^^^ entity.name.program.fortran
!
! Program contents
!
end program myProgram
!<- keyword.declaration.program.fortran
! ^^^^^^^ keyword.declaration.program.fortran
! ^^^^^^^^^ entity.name.program.fortran - meta.program.declaration.fortran
!
DO I = 1, 10
! ^^ keyword.control.fortran
! ^ variable.other.fortran
!
ENDDO
! ^^^^^ keyword.control.fortran
!
type,
!
TYPE simpleStruct
! ^^^^ keyword.declaration.class.fortran
! ^^^^^^^^^^^^ entity.name.class.fortran
! ^^^^^^^^^^^^^^^^^ meta.class.declaration.fortran
!
integer :: x
integer :: y
!
END TYPE simpleStruct
! ^^^^ keyword.declaration.class.fortran
! ^^^^^^^^^^^^ entity.name.class.fortran
ALLOCATE(array(10))
! ^^^^^^^^ support.function.subroutine.fortran
!
do I = 1, 10; array(I) = I; end do
! ^ punctuation.terminator.fortran
! ^ punctuation.terminator.fortran
!
DEALLOCATE(array)
! ^^^^^^^^^^ support.function.subroutine.fortran
!
select
! ^^^^^^ keyword.control.fortran
!
select classoij
! ^^^^^^ keyword.control.fortran
! ^^^^^ - keyword.control.fortran
! (should not recognize "class" in "classoij")
!
select case (myString)
! ^^^^^^ keyword.control.fortran
! ^^^^ keyword.control.fortran
!
case ('Phaedo')
! ^^^^ keyword.control.fortran
! do stuff
!
case ('Crito')
! ^^^^ keyword.control.fortran
! do other stuff
!
case default
! ^^^^ keyword.control.fortran
! ^^^^^^^ keyword.control.fortran
! what to do if string doesn't match any case
!
end select
! ^^^ keyword.control.fortran
! ^^^^^^ keyword.control.fortran
!
namedSelect: select case (myString)
! ^^^^^^^^^^^ entity.name.label.conditional.fortran
!
end select namedSelect
! ^^^^^^^^^^^ entity.name.label.conditional.fortran
!
select type (animal)
! ^^^^^^ keyword.control.fortran
! ^^^^ keyword.control.fortran
! ^^^^^^ variable.other.fortran
!
type is (cat)
! ^^^^^^^ keyword.control.fortran
! ^^^ entity.name.class.fortran
type is (dog)
! ^^^^^^^ keyword.control.fortran
! ^^^ entity.name.class.fortran
!
end select
!
animalCasting: select class (animal)
! ^^^^^^^^^^^^^ entity.name.label.conditional.fortran
! ^ punctuation.separator.single-colon.fortran
! ^^^^^^ keyword.control.fortran
! ^^^^^ keyword.control.fortran
! ^ meta.parens.fortran punctuation.section.parens.begin.fortran
! ^^^^^^ variable.other.fortran
! ^ meta.parens.fortran punctuation.section.parens.end.fortran
!
class is (cat)
! ^^^^^^^^ keyword.control.fortran
! ^^^ entity.name.class.fortran
!
class is (dog)
! ^^^^^^^^ keyword.control.fortran
! ^^^ entity.name.class.fortran
!
class default
! ^^^^^^^^^^^^^ keyword.control.fortran
!
end select animalCasting
! ^^^^^^^^^^^^^ entity.name.label.conditional.fortran
! ^^^ keyword.control.fortran
! ^^^^^^ keyword.control.fortran
!
!
type, abstract, extends(cat) :: superCat
! ^ punctuation.separator.comma.fortran
! ^^^^^^^^ storage.modifier.fortran
! ^^^^^^^ keyword.control.extends.fortran
! ^ punctuation.separator.comma.fortran
! ^^ punctuation.separator.double-colon.fortran
!
type, private, extends(cat) :: superCat
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.declaration.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^ storage.modifier.fortran
! ^^^^^^^ keyword.control.extends.fortran
! ^ punctuation.separator.comma.fortran
! ^^ punctuation.separator.double-colon.fortran
!
MODULE SUBROUTINE MY_SUBROUTINE(A, B, C)
! ^^^^^^ storage.modifier.function.prefix.fortran
! ^^^^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^^^^^^ entity.name.function.fortran
! ^ variable.parameter.fortran
! ^ punctuation.separator.comma.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.parameter.fortran
! ^ variable.parameter.fortran
read(unit=fileUnit, *) myVariable
! ^^^^ variable.function.subroutine.intrinsic.io.fortran
! ^^^^ variable.language.io.fortran
!
DO CONCURRENT (I = 1:N, J(I) > 0) LOCAL(M) SHARED(J, K)
! ^^^^^^^^^^ keyword.control.fortran
! ^^^^^ keyword.control.fortran
! ^^^^^^ keyword.control.fortran
M = MOD (K(I), J(I))
K(I) = K(I) – M
!
END DO
! ^^^ keyword.control.fortran
! ^^ keyword.control.fortran
!
extraordinaryLoop: do i = 1, 5
! ^^^^^^^^^^^^^^^^^ entity.name.label.conditional.fortran
! ^ punctuation.separator.single-colon.fortran
!
print*, "I can count: ", i
!
end do extraordinaryLoop
! ^^^^^^^^^^^^^^^^^ entity.name.label.conditional.fortran
!
readingTime : if (person%hasBooks()) then
! ^ punctuation.separator.single-colon.fortran
! ^^^^^^^^^^^ entity.name.label.conditional.fortran
!
call person%read()
!
else if (person%hasMoney()) then readingTime
! ^^^^^^^^^^^ entity.name.label.conditional.fortran
!
call person%buyBooks()
call person%read()
!
else readingTime
! ^^^^^^^^^^^ entity.name.label.conditional.fortran
!
call person%cry()
!
end if readingTime
! ^^ keyword.control.fortran
! ^^^^^^^^^^^ entity.name.label.conditional.fortran
!
integer, codimension(*) :: myInt
! ^^^^^^^^^^^ storage.modifier.fortran
!
sync all
! ^^^^ keyword.control.fortran
! ^^^ keyword.control.fortran
sync images
! ^^^^ keyword.control.fortran
! ^^^^^^ keyword.control.fortran
sync memory
! ^^^^ keyword.control.fortran
! ^^^^^^ keyword.control.fortran
!
lock
! ^^^^ keyword.control.fortran
unlock
! ^^^^^^ keyword.control.fortran
!
complex :: c(7,0:13) [-3:2,5,*] ! complex array coarray of corank 3
! ^^^^^^^ storage.type.intrinsic.fortran
! ^ variable.other.fortran
! ^ keyword.operator.arithmetic.fortran
! ^ constant.numeric.value.fortran
! ^ punctuation.separator.single-colon.fortran
! ^ constant.numeric.value.fortran
! ^ punctuation.separator.comma.fortran
! ^ constant.numeric.value.fortran
! ^ constant.numeric.value.fortran
! ^^ constant.numeric.value.fortran
! ^ punctuation.separator.comma.fortran
! ^ punctuation.separator.single-colon.fortran
!
a = 3 + 4*(12/5)
! ^ variable.other.fortran
! ^ keyword.operator.assignment.fortran
! ^ keyword.operator.arithmetic.fortran
! ^ keyword.operator.arithmetic.fortran
! ^ keyword.operator.arithmetic.fortran
!
if ( this_image() .eq. 2 ) sync images( 3 )
! ^^^^^^^^^^ support.function.intrinsic.fortran
! ^^^^ keyword.control.fortran
! ^^^^^^ keyword.control.fortran
! ^ constant.numeric.value.fortran
!
!
type(t) :: myValue[*]
if ( img .eq. num_images() ) myValue%i(1) = myValue[1]%i(1)
! ^^^^^^^ storage.type.class.fortran
! ^^^^^^^ storage.type.class.fortran
!
a = gei[i,k](j)%asd
! ^^^ storage.type.class.fortran
! ^ punctuation.accessor.fortran
! ^ variable.other.fortran
! ^ punctuation.separator.comma.fortran
! ^ variable.other.fortran
! ^^^ variable.other.fortran
!
a = this_image()
! ^^^^^^^^^^ support.function.intrinsic.fortran
!
allocate (co % data (10 * this_image()))
! ^^^^^^^^^^ support.function.intrinsic.fortran
! ^^^^^^^^ support.function.subroutine.fortran
! ^^ storage.type.class.fortran
! ^^^^ variable.function.fortran
! ^^ constant.numeric.value.fortran
!
result = thisFunction ()
! ^^^^^^ variable.other.fortran
! ^^^^^^^^^^^^ variable.function
!
event post (...)
! ^^^^^ keyword.control.fortran
! ^^^^ keyword.control.fortran
!
procedure, public :: theRoutine & ! side-comment
! ^ punctuation.separator.continuation.fortran
! ^^^^^^^^^^ entity.name.function.fortran
=> theRoutine_impl ! just a side comment
! ^^^^^^^^^^^^^^^ entity.name.function.fortran
!
procedure, public :: get_oei_1der &
! ^^^^^^^^^ keyword.declaration.function.fortran
! ^ punctuation.separator.continuation.fortran
! ^^^^^^^^^^^^ entity.name.function.fortran
! interrupting comment!
=> get_oei_1der_ao_tool
! ^^^^^^^^^^^^^^^^^^^^ entity.name.function.fortran
!
generic :: genericRoutine => specificRoutineA, & ! and another side comment
! ^^^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^^^^^^^ entity.name.function.fortran
! ^^^^^^^^^^^^^^^^ entity.name.function.fortran
! ^ punctuation.separator.continuation.fortran
! ^ punctuation.separator
specificRoutineB ! just a side comment
! ^^^^^^^^^^^^^^^^ entity.name.function.fortran
!
generic :: genericRoutine &
! ^^^^^^^^^^^^^^ entity.name.function.fortran
=> specificRoutineA, &
! ^^ keyword.operator.points-to.fortran
! ^^^^^^^^^^^^^^^^ entity.name.function.fortran
specificRoutineB ! just a side comment
! ^^^^^^^^^^^^^^^^ entity.name.function.fortran
!
final :: myDestructor
! ^^^^^ keyword.declaration.function.fortran
! ^^^^^^^^^^^^ entity.name.function.fortran
!
type, extends (animal) :: cat ! with spaces & commment
! ^ punctuation.definition.comment.fortran
! ^^^^^^^^^^^^^^^^^^^^^^ comment.line.fortran
! ^^^^^^^ keyword.control.extends.fortran
! ^^^^^^ entity.other.inherited-class.fortran
! ^^^ entity.name.class.fortran
!
return
! ^^^^^^ keyword.control.fortran
!
use :: myModule, only: thatRoutine, thisRoutine
! ^^^ keyword.control.import.fortran
! ^ punctuation.separator.single-colon.fortran
! ^ punctuation.separator.comma.fortran
! ^^^^^^^^^^^ variable.other.fortran
! ^^^^^^^^^^^ variable.other.fortran
! ^^^^ keyword.control.fortran
! ^^ punctuation.separator.double-colon.fortran
! ^^^^^^^^ entity.name.interface.module.fortran