summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/src/Plugins/NanorexMMPImportExport/mmp-grammar.txt
blob: c13511c935ed654c450bd84383842701217b9088 (plain)
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

// from files_mmp.py


mmp-input: 
           | mmpformat-stmt  end-stmt
           | mmpformat-stmt  compound-stmt-list  end-stmt

mmpformat-stmt :   mmpformat-reqd-stmt '\n'
                 | mmpformat-reqd-stmt  mmpformat-pref-stmt '\n'

mmpformat-reqd-stmt : 'mmpformat' [0-9]{6} 'required'

mmpformat-pref-stmt : ';' [0-9]{6} 'preferred'

compound-stmt-list :
                     | compound-stmt  compound-stmt-list

compound-stmt:
               | kelvin-stmt
               | group-block
               | end1-stmt

kelvin-stmt: 'kelvin' real-number '\n'

group-block: group-begin-stmt
             group-stmt-list
             group-end-stmt

group-begin-stmt: 'group' '(' string-identifier ')' '\n'

group-end-stmt: 'egroup' '(' string-identifier ')' '\n'

group-stmt-list:  
                 | group-stmt  group-stmt-list

group-stmt:  
            | info-opengroup-stmt
            | csys-stmt
            | mol-stmt
            | atom-bond-stmt
            | info-stmt

mol-stmt : 'mol' '(' string-identifier ')' mol-style  '\n'  atoms-bonds-stmt-list

mol-style : **TODO**

atoms-bonds-stmt-list :   atom-bond-stmt
                        | atom-bond-stmt  atoms-bonds-stmt-list

atom-bond-stmt :  atom-stmt  bond-stmt-list

atom-stmt: 'atom' id '(' atomic-num ')' coords atom-style-stmt '\n'

atom-style-stmt : 

bond-stmt-list :
                 | bond-stmt  bond-stmt-list

bond-stmt:   bond1-stmt
           | bond2-stmt
           | bond3-stmt
           | bonda-stmt
           | bondg-stmt
           | bondc-stmt

bond1-stmt : 'bond1' id-list '\n'
bond2-stmt : 'bond2' id-list '\n'
bond3-stmt : 'bond3' id-list '\n'
bonda-stmt : 'bonda' id-list '\n'
bondg-stmt : 'bondg' id-list '\n'
bondc-stmt : 'bondc' id-list '\n'

coords: '(' integer ',' integer ',' integer ')'

info-stmt :   info-chunk-stmt
            | info-opengroup-stmt
            | info-leaf-stmt
            | info-atom-stmt
            | info-gamess-stmt
            | info-espimage-stmt
            | info-povrayscene-stmt

info-atom-stmt : 'info' 'atom' atom-property-value-list '\n'

atom-property-value-list :   atom-property-value-key
                           | atom-property-value-key  atom-property-value-list


atom-property-value-key : atom-property-name '=' atom-property-value

atom-property-name : 'atomtype'

atom-property-value :   'sp'
                      | 'sp2'
                      | 'sp2_g'
                      | 'sp3'
                      | 'sp3d'


end-stmt : 'end'  string-list  '\n'

string-identifier : string

string-list : 
              | string string-list

string : identifier | identifier [\s]+ string

identifier: [A-Za-z_][\w]*
id-list : id | id-list id
id: integer
atomic-num: integer
integer: [0-9]+
real-nunber : [-]?[0-9]*.[0-9]([eE][+-]?[0-9]+)?