File tree Expand file tree Collapse file tree 4 files changed +927
-0
lines changed Expand file tree Collapse file tree 4 files changed +927
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ classifiers = [
15
15
]
16
16
dependencies = [
17
17
" f90nml" ,
18
+ " lark" ,
18
19
" ruamel.yaml" ,
19
20
]
20
21
Original file line number Diff line number Diff line change
1
+ // Copyright 2025 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Common terminals and rules for use in all ACCESS configuration parsers
5
+
6
+ // Dictionary keys
7
+ key : CNAME
8
+
9
+ // Fortran logicals
10
+ logical : FTRUE | FFALSE
11
+ FTRUE : " .true." i
12
+ FFALSE : " .false." i
13
+
14
+ // Booleans
15
+ bool : TRUE | FALSE
16
+ TRUE : " True"
17
+ FALSE : " False"
18
+
19
+ // Integers
20
+ integer : SIGNED_INT
21
+
22
+ // Floats
23
+ float : SIGNED_FLOAT
24
+
25
+ // Fortran double values
26
+ double : SIGNED_DOUBLE
27
+ _ DOUBLE_EXP : (" d" | " D" ) SIGNED_INT
28
+ DOUBLE : INT _ DOUBLE_EXP | DECIMAL _ DOUBLE_EXP?
29
+ SIGNED_DOUBLE : [" +" | " -" ] DOUBLE
30
+
31
+ // Fortran complex floats
32
+ complex : CMPLX
33
+ CMPLX : " (" WS_INLINE * SIGNED_FLOAT WS_INLINE * " ," WS_INLINE * SIGNED_FLOAT WS_INLINE * " )"
34
+
35
+ // Fortran complex doubles
36
+ double_complex : DCMPLX
37
+ DCMPLX : " (" WS_INLINE * SIGNED_DOUBLE WS_INLINE * " ," WS_INLINE * SIGNED_DOUBLE WS_INLINE * " )"
38
+
39
+ // Identifiers
40
+ identifier : CNAME
41
+
42
+ // Quoted strings
43
+ string : STRING
44
+ STRING : / ( ". *? (?<! \\ ) ( \\\\ ) *? "| '(?! '') . *? (?<! \\ ) ( \\\\ ) *? ') /
45
+
46
+ // Unix-like filesystem paths
47
+ path : PATH
48
+ PATH_COMPONENT : / [a-zA-Z0-9._- ]+ /
49
+ PATH : (" /" | " ./" | " ../" )? PATH_COMPONENT (" /" PATH_COMPONENT )* (" /" )?
50
+
51
+ // Space, newlines and comments
52
+ ws : WS_INLINE
53
+ NEWLINE : CR ? LF
54
+ comment : / [ \t ]* #[^ \n ]* /
55
+ fortran_comment : / [ \t ]* ![^ \n ]* /
56
+
57
+ %import common .CNAME
58
+ %import common .SIGNED_INT
59
+ %import common .SIGNED_FLOAT
60
+ %import common .INT
61
+ %import common .DECIMAL
62
+ %import common .CR
63
+ %import common .LF
64
+ %import common .WS_INLINE
You can’t perform that action at this time.
0 commit comments