ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libBASS/BASSyacc.y
(Generate patch)

Comparing trunk/OOPSE/libBASS/BASSyacc.y (file contents):
Revision 378 by mmeineke, Fri Mar 21 17:42:12 2003 UTC vs.
Revision 998 by gezelter, Thu Jan 29 23:01:17 2004 UTC

# Line 2 | Line 2
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 RIGIDBODY
6  
7   /* more advanced tokens */
8  
# Line 11 | Line 11
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
# Line 21 | Line 20
20  
21   %token <s_ptr> IDENTIFIER
22   %token <s_ptr> QUOTED_STRING
23 + %token <s_ptr> LIST_STRING
24  
25   %type <node_ptr> stmt
26   %type <node_ptr> stmt_list
27   %type <node_ptr> assignment
28 < %type <node_ptr> member
28 > %type <node_ptr> members
29   %type <node_ptr> constraint
30   %type <node_ptr> orientation
31   %type <node_ptr> position
# Line 36 | Line 36
36   %type <node_ptr> bend_block
37   %type <node_ptr> torsion_block
38   %type <node_ptr> component_block
39 < %type <node_ptr> start_index
40 <
41 < %type <il_ptr> int_list
39 > %type <node_ptr> zconstraint_block
40 > %type <node_ptr> rigidbody_block
41  
42  
43   %{
# Line 46 | Line 45
45   #include <stdio.h>
46   #include <string.h>
47  
48 < #include <node_list.h>
49 < #include <make_nodes.h>
50 < #include <parse_tree.h>
51 < #include <simError.h>
48 > #include "node_list.h"
49 > #include "make_nodes.h"
50 > #include "parse_tree.h"
51 > #include "simError.h"
52   #ifdef IS_MPI
53   #define __is_lex__
54 < #include <mpiBASS.h>
54 > #include "mpiBASS.h"
55   #endif
56  
57   extern int yylineno;
# Line 90 | Line 89 | stmt:
89  
90   stmt:
91            assignment            { $$ = $1; }
92 <        | member                { $$ = $1; }
92 >        | members               { $$ = $1; }
93          | constraint            { $$ = $1; }
94          | orientation           { $$ = $1; }
95          | position              { $$ = $1; }
97        | start_index           { $$ = $1; }
96          | block                 { $$ = $1; }
97          ;
98  
# Line 109 | Line 107 | member:
107                                  { $$ = assign_s( $1, $3 ); }
108          ;
109  
110 < member:
111 <          MEMBERS '(' INTEGER ',' INTEGER ')' ';'
112 <                                { $$ = members_2( $3, $5 ); }
115 <        | MEMBERS '(' INTEGER ',' INTEGER ',' INTEGER ')' ';'
116 <                                { $$ = members_3( $3, $5, $7 ); }
117 <        | MEMBERS '(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ')' ';'
118 <                                { $$ = members_4( $3, $5, $7, $9 ); }
110 > members:
111 >          MEMBERS LIST_STRING ';'
112 >                                { $$ = members( $2 ); }
113          ;
114  
115   constraint:
116 <          CONSTRAINT '(' INTEGER ')' ';'
117 <                                { $$ = constraint( (double)$3 ); }
124 <        | CONSTRAINT '(' DOUBLE ')' ';'
125 <                                { $$ = constraint( $3 ); }
116 >          CONSTRAINT LIST_STRING ';'
117 >                                { $$ = constraint( $2 ); }
118          ;
119  
120   orientation:
121 <          ORIENTATION '(' DOUBLE ',' DOUBLE ',' DOUBLE ')' ';'
122 <                                { $$ = orientation( $3, $5, $7 ); }
131 <        | ORIENTATION '(' INTEGER ',' DOUBLE ',' DOUBLE ')' ';'
132 <                                { $$ = orientation( (double)$3, $5, $7 ); }
133 <        | ORIENTATION '(' DOUBLE ',' INTEGER ',' DOUBLE ')' ';'
134 <                                { $$ = orientation( $3, (double)$5, $7 ); }
135 <        | ORIENTATION '(' DOUBLE ',' DOUBLE ',' INTEGER ')' ';'
136 <                                { $$ = orientation( $3, $5, (double)$7 ); }
137 <        | ORIENTATION '(' INTEGER ',' INTEGER ',' INTEGER ')' ';'
138 <                                { $$ = orientation( (double)$3, (double)$5, (double)$7 ); }
139 <        | ORIENTATION '(' DOUBLE ',' INTEGER ',' INTEGER ')' ';'
140 <                                { $$ = orientation( $3, (double)$5, (double)$7 ); }
141 <        | ORIENTATION '(' INTEGER ',' DOUBLE ',' INTEGER ')' ';'
142 <                                { $$ = orientation( (double)$3, $5, (double)$7 ); }
143 <        | ORIENTATION '(' INTEGER ',' INTEGER ',' DOUBLE ')' ';'
144 <                                { $$ = orientation( (double)$3, (double)$5, $7 ); }
121 >          ORIENTATION LIST_STRING ';'
122 >                                { $$ = orientation( $2 ); }
123          ;
124  
125   position:
126 <          POSITION '(' DOUBLE ',' DOUBLE ',' DOUBLE ')' ';'
127 <                                { $$ = position( $3, $5, $7 ); }
150 <        | POSITION '(' INTEGER ',' DOUBLE ',' DOUBLE ')' ';'
151 <                                { $$ = position( (double)$3, $5, $7 ); }
152 <        | POSITION '(' DOUBLE ',' INTEGER ',' DOUBLE ')' ';'
153 <                                { $$ = position( $3, (double)$5, $7 ); }
154 <        | POSITION '(' DOUBLE ',' DOUBLE ',' INTEGER ')' ';'
155 <                                { $$ = position( $3, $5, (double)$7 ); }
156 <        | POSITION '(' INTEGER ',' INTEGER ',' INTEGER ')' ';'
157 <                                { $$ = position( (double)$3, (double)$5, (double)$7 ); }
158 <        | POSITION '(' DOUBLE ',' INTEGER ',' INTEGER ')' ';'
159 <                                { $$ = position( $3, (double)$5, (double)$7 ); }
160 <        | POSITION '(' INTEGER ',' DOUBLE ',' INTEGER ')' ';'
161 <                                { $$ = position( (double)$3, $5, (double)$7 ); }
162 <        | POSITION '(' INTEGER ',' INTEGER ',' DOUBLE ')' ';'
163 <                                { $$ = position( (double)$3, (double)$5, $7 ); }
126 >          POSITION LIST_STRING ';'
127 >                                { $$ = position( $2 ); }
128          ;
129  
166 start_index:
167        START_INDEX int_list ';'
168                                { $$ = start_index( $2 ); }
169        ;
170
130   block:
131            molecule_block        { $$ = $1; }
132          | atom_block            { $$ = $1; }
133          | bond_block            { $$ = $1; }
134          | bend_block            { $$ = $1; }
135          | torsion_block         { $$ = $1; }
136 +        | zconstraint_block     { $$ = $1; }
137 +        | rigidbody_block       { $$ = $1; }
138          | component_block       { $$ = $1; }
139          ;
140  
# Line 201 | Line 162 | torsion_block:
162          TORSION ARRAY_INDEX '{' stmt_list '}'
163                                  { $$ = torsion_blk( $2, $4 ); }
164          ;
165 <        
165 >
166 > zconstraint_block:
167 >        ZCONSTRAINT ARRAY_INDEX '{' stmt_list '}'
168 >                                { $$ = zconstraint_blk( $2, $4 ); }
169 >        ;
170 >
171 > rigidbody_block:
172 >        RIGIDBODY ARRAY_INDEX '{' stmt_list '}'
173 >                                { $$ = rigidbody_blk( $2, $4 ); }
174 >        ;
175 >                
176   component_block:
177          COMPONENT '{' stmt_list '}'
178                                  { $$ = component_blk( $3 ); }
179          ;
180 <        
180 >
181   stmt_list:
182            stmt                  { $$ = $1; }
183          | stmt_list stmt        {
# Line 216 | Line 187 | int_list:
187                                  }
188          ;
189  
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
190   %%
191  
192   int yyerror( char *err_msg ){
193  
194 <  sprintf( painCave.errMsg, "yacc parse error in %s at line %d: %s\n",
195 <           yyfile_name->my_name, yylineno, err_msg );
194 >  sprintf( painCave.errMsg, "OOPSE parse error in %s at line %d: %s\n",
195 >           yyfile_name->my_name, yylineno + 1, err_msg );
196    painCave.isFatal = 1;
197    simError();
198    return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines