2 |
|
/* define some general tokens */ |
3 |
|
|
4 |
|
%token MOLECULE ATOM BOND BEND TORSION POSITION MEMBERS CONSTRAINT |
5 |
< |
%token COMPONENT START_INDEX DEFINED ORIENTATION |
5 |
> |
%token COMPONENT START_INDEX DEFINED ORIENTATION ZCONSTRAINT |
6 |
|
|
7 |
|
/* more advanced tokens */ |
8 |
|
|
11 |
|
double d_val; /* double value */ |
12 |
|
char * s_ptr; /* string pointer */ |
13 |
|
struct node_tag* node_ptr; /* pointer to the statement node tree */ |
14 |
– |
struct integer_list_tag* il_ptr; /*pointer to a int_list item */ |
14 |
|
} |
15 |
|
|
16 |
|
%token <i_val> INTEGER |
35 |
|
%type <node_ptr> bend_block |
36 |
|
%type <node_ptr> torsion_block |
37 |
|
%type <node_ptr> component_block |
38 |
< |
%type <node_ptr> start_index |
40 |
< |
|
41 |
< |
%type <il_ptr> int_list |
38 |
> |
%type <node_ptr> zconstraint_block |
39 |
|
|
40 |
|
|
41 |
|
%{ |
91 |
|
| constraint { $$ = $1; } |
92 |
|
| orientation { $$ = $1; } |
93 |
|
| position { $$ = $1; } |
97 |
– |
| start_index { $$ = $1; } |
94 |
|
| block { $$ = $1; } |
95 |
|
; |
96 |
|
|
159 |
|
{ $$ = position( (double)$3, (double)$5, $7 ); } |
160 |
|
; |
161 |
|
|
166 |
– |
start_index: |
167 |
– |
START_INDEX int_list ';' |
168 |
– |
{ $$ = start_index( $2 ); } |
169 |
– |
; |
170 |
– |
|
162 |
|
block: |
163 |
|
molecule_block { $$ = $1; } |
164 |
|
| atom_block { $$ = $1; } |
165 |
|
| bond_block { $$ = $1; } |
166 |
|
| bend_block { $$ = $1; } |
167 |
|
| torsion_block { $$ = $1; } |
168 |
+ |
| zconstraint_block { $$ = $1; } |
169 |
|
| component_block { $$ = $1; } |
170 |
|
; |
171 |
|
|
193 |
|
TORSION ARRAY_INDEX '{' stmt_list '}' |
194 |
|
{ $$ = torsion_blk( $2, $4 ); } |
195 |
|
; |
196 |
+ |
|
197 |
+ |
zconstraint_block: |
198 |
+ |
ZCONSTRAINT ARRAY_INDEX '{' stmt_list '}' |
199 |
+ |
{ $$ = zconstraint_blk( $2, $4 ); } |
200 |
+ |
; |
201 |
|
|
202 |
|
component_block: |
203 |
|
COMPONENT '{' stmt_list '}' |
204 |
|
{ $$ = component_blk( $3 ); } |
205 |
|
; |
206 |
< |
|
206 |
> |
|
207 |
|
stmt_list: |
208 |
|
stmt { $$ = $1; } |
209 |
|
| stmt_list stmt { |
213 |
|
} |
214 |
|
; |
215 |
|
|
219 |
– |
int_list: |
220 |
– |
'<' INTEGER { $$ = il_node( $2 ); } |
221 |
– |
| int_list ',' INTEGER { |
222 |
– |
struct integer_list_tag* temp; |
223 |
– |
temp = il_node( $3 ); |
224 |
– |
$1->next = temp; |
225 |
– |
temp->prev = $1; |
226 |
– |
$$ = temp; |
227 |
– |
} |
228 |
– |
| int_list '>' { $$ = il_top( $1 ); } |
229 |
– |
; |
230 |
– |
|
216 |
|
%% |
217 |
|
|
218 |
|
int yyerror( char *err_msg ){ |