Changeset d69f4bb4 for src/Parser
- Timestamp:
- Aug 29, 2018, 6:09:48 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 933933c
- Parents:
- bcb14b5
- Location:
- src/Parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/lex.ll
rbcb14b5 rd69f4bb4 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Wed Aug 8 17:23:17201813 * Update Count : 68 512 * Last Modified On : Wed Aug 29 15:02:41 2018 13 * Update Count : 686 14 14 */ 15 15 … … 410 410 ">>=" { NAMEDOP_RETURN(RSassign); } 411 411 412 "~=" { NAMEDOP_RETURN(Erange); } // CFA413 412 "@=" { NAMEDOP_RETURN(ATassign); } // CFA 413 "~=" { NAMEDOP_RETURN(ErangeUpEq); } // CFA 414 "-~" { NAMEDOP_RETURN(ErangeDown); } // CFA 415 "-~=" { NAMEDOP_RETURN(ErangeDownEq); } // CFA 414 416 415 417 /* CFA, operator identifier */ -
src/Parser/parser.yy
rbcb14b5 rd69f4bb4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 8 17:50:07 201813 // Update Count : 399812 // Last Modified On : Wed Aug 29 16:44:17 2018 13 // Update Count : 4006 14 14 // 15 15 … … 186 186 } // fieldDecl 187 187 188 ExpressionNode *forInc( const OperKinds op ) { 189 return new ExpressionNode( build_constantInteger( *new string( op == OperKinds::LThan || op == OperKinds::LEThan ? "1" : "-1" ) ) ); 190 } // forInc 191 188 192 ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) { 189 193 return new ForCtrl( … … 290 294 %token ANDassign ERassign ORassign // &= ^= |= 291 295 292 %token Erange //~=296 %token ErangeUpEq ErangeDown ErangeDownEq // ~= -~ -~= 293 297 %token ATassign // @= 294 298 … … 1138 1142 $$ = new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ); 1139 1143 } else { 1140 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $1->clone(),1141 new ExpressionNode( build_constantInteger( *new string( "1" ) )) );1144 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1145 OperKinds::LThan, $1->clone(), forInc( OperKinds::LThan ) ); 1142 1146 } // if 1143 1147 } 1144 1148 | constant_expression inclexcl constant_expression // CFA 1145 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) )) ); }1149 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, forInc( $2 ) ); } 1146 1150 | constant_expression inclexcl constant_expression '~' constant_expression // CFA 1147 1151 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); } … … 1154 1158 } else { 1155 1159 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1156 $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $3->clone(),1157 new ExpressionNode( build_constantInteger( *new string( "1" ) )) );1160 $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1161 OperKinds::LThan, $3->clone(), forInc( OperKinds::LThan ) ); 1158 1162 } else { 1159 1163 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; … … 1167 1171 } else { 1168 1172 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1169 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) )) );1173 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, forInc( $4 ) ); 1170 1174 } else { 1171 1175 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; … … 1194 1198 '~' 1195 1199 { $$ = OperKinds::LThan; } 1196 | Erange 1200 | ErangeUpEq 1197 1201 { $$ = OperKinds::LEThan; } 1202 | ErangeDown 1203 { $$ = OperKinds::GThan; } 1204 | ErangeDownEq 1205 { $$ = OperKinds::GEThan; } 1198 1206 ; 1199 1207
Note: See TracChangeset
for help on using the changeset viewer.