ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/mdParser/MDTreeParser.g
(Generate patch)

Comparing trunk/OOPSE-4/src/mdParser/MDTreeParser.g (file contents):
Revision 2509 by tim, Wed Dec 14 18:02:28 2005 UTC vs.
Revision 2513 by tim, Fri Dec 16 02:57:00 2005 UTC

# Line 44 | Line 44 | constant [ANTLR_USE_NAMESPACE(antlr)RefAST id]    
44   assignment  : #(ASSIGNEQUAL id:ID constant[#id]) //{blockStack.top()->assign(#ID->getText(),);}
45              ;
46              
47 < constant [ANTLR_USE_NAMESPACE(antlr)RefAST id]    
48 <            : signedIntOrFloat[#id]
47 > constant [ANTLR_USE_NAMESPACE(antlr)RefAST id]
48 > {
49 >  int ival;
50 >  double dval;
51 > }    
52 >            : ival=intConst {blockStack.top()->assign(id->getText(), ival);}
53 >            | dval=floatConst {blockStack.top()->assign(id->getText(), dval);}
54              | str1:ID {blockStack.top()->assign(id->getText(), str1->getText());}
55              | str2:StringLiteral { std::string s =  str2->getText();
56                                     s = s.substr(1, s.length()-2);
# Line 53 | Line 58 | signedIntOrFloat [ANTLR_USE_NAMESPACE(antlr)RefAST id]
58                                   }
59              ;
60              
56 signedIntOrFloat [ANTLR_USE_NAMESPACE(antlr)RefAST id]  
57 {
58  int ival;
59  double dval;
60 }
61              : #(MINUS (icMinus:intConst {ival = lexi_cast<int>(icMinus->getText()); ival = -ival; blockStack.top()->assign(id->getText(), ival);}
62                | fcMinus:floatConst) {dval = lexi_cast<double>(fcMinus->getText());dval = -dval;  blockStack.top()->assign(id->getText(), dval);}
63                )
64              | (ic:intConst {ival = lexi_cast<int>(ic->getText()); blockStack.top()->assign(id->getText(), ival);}
65                | fc:floatConst {dval = lexi_cast<double>(fc->getText());  blockStack.top()->assign(id->getText(), dval);}
66                )              
67              ;
61  
62   componentblock  : #(COMPONENT  {Component* currComponet = new Component(); blockStack.push(currComponet);}
63                        (assignment)*
# Line 112 | Line 105 | AtomStamp* currAtomStamp =  static_cast<AtomStamp*>(bl
105  
106   }
107                : assignment
108 <              | #(POSITION dvec=signedNumberTuple) {currAtomStamp->setPosition(dvec);}
109 <              | #(ORIENTATION dvec=signedNumberTuple) {currAtomStamp->setOrientation(dvec);}
108 >              | #(POSITION dvec=doubleNumberTuple) {currAtomStamp->setPosition(dvec);}
109 >              | #(ORIENTATION dvec=doubleNumberTuple) {currAtomStamp->setOrientation(dvec);}
110                ;
111  
112                        
# Line 231 | Line 224 | signedNumberTuple   returns [vector<double> dvec]
224  
225  
226                
227 < signedNumberTuple   returns [vector<double> dvec]
227 > doubleNumberTuple   returns [vector<double> dvec]
228   {
229    double dval;
230   }
231 <              : (dval=signedNumber {dvec.push_back(dval);})+  
231 >              : (dval=doubleNumber {dvec.push_back(dval);})+  
232                ;
233                            
234   inttuple  returns [vector<int> ivec]
# Line 247 | Line 240 | intConst returns [int ival]
240  
241   protected
242   intConst returns [int ival]
243 <        : oival:OCTALINT {ival = lexi_cast<int>(oival->getText());}
244 <        | dival:DECIMALINT {ival = lexi_cast<int>(dival->getText());}
252 <        | hival:HEXADECIMALINT {ival = lexi_cast<int>(hival->getText());}
243 >        : i1:NUM_INT {ival = lexi_cast<int>(i1->getText());}
244 >        | i2:NUM_LONG {ival = lexi_cast<int>(i2->getText());}
245          ;
246  
247   protected
248 < signedNumber  returns [double dval]
248 > doubleNumber  returns [double dval]
249                :
250                  ic:intConst {dval = lexi_cast<double>(ic->getText());}
251                  | fc:floatConst {dval = lexi_cast<double>(fc->getText());}
# Line 262 | Line 254 | floatConst returns [double dval]
254                
255   protected
256   floatConst returns [double dval]
257 <        : d1:FLOATONE {dval = lexi_cast<double>(d1->getText());}  
258 <        | d2:FLOATTWO {dval = lexi_cast<double>(d2->getText());}
257 >        : d1:NUM_FLOAT {dval = lexi_cast<double>(d1->getText());}  
258 >        | d2:NUM_DOUBLE {dval = lexi_cast<double>(d2->getText());}
259          ;
260          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines