parser.c (259660) | parser.c (260014) |
---|---|
1/* C++ Parser. 2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 3 2005 Free Software Foundation, Inc. 4 Written by Mark Mitchell <mark@codesourcery.com>. 5 6 This file is part of GCC. 7 8 GCC is free software; you can redistribute it and/or modify it --- 6773 unchanged lines hidden (view full) --- 6782/* Parse an iteration-statement. 6783 6784 iteration-statement: 6785 while ( condition ) statement 6786 do statement while ( expression ) ; 6787 for ( for-init-statement condition [opt] ; expression [opt] ) 6788 statement 6789 | 1/* C++ Parser. 2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 3 2005 Free Software Foundation, Inc. 4 Written by Mark Mitchell <mark@codesourcery.com>. 5 6 This file is part of GCC. 7 8 GCC is free software; you can redistribute it and/or modify it --- 6773 unchanged lines hidden (view full) --- 6782/* Parse an iteration-statement. 6783 6784 iteration-statement: 6785 while ( condition ) statement 6786 do statement while ( expression ) ; 6787 for ( for-init-statement condition [opt] ; expression [opt] ) 6788 statement 6789 |
6790 APPLE LOCAL begin for-fsf-4_4 3274130 5295549 6791 GNU extension: 6792 6793 while attributes [opt] ( condition ) statement 6794 do attributes [opt] statement while ( expression ) ; 6795 for attributes [opt] 6796 ( for-init-statement condition [opt] ; expression [opt] ) 6797 statement 6798 6799 APPLE LOCAL end for-fsf-4_4 3274130 5295549 |
|
6790 Returns the new WHILE_STMT, DO_STMT, or FOR_STMT. */ 6791 6792static tree 6793cp_parser_iteration_statement (cp_parser* parser) 6794{ 6795 cp_token *token; 6796 enum rid keyword; | 6800 Returns the new WHILE_STMT, DO_STMT, or FOR_STMT. */ 6801 6802static tree 6803cp_parser_iteration_statement (cp_parser* parser) 6804{ 6805 cp_token *token; 6806 enum rid keyword; |
6797 tree statement; | 6807/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 6808 tree statement, attributes; 6809/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
6798 unsigned char in_statement; 6799 | 6810 unsigned char in_statement; 6811 |
6800 /* Peek at the next token. */ | 6812/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 6813 /* Get the keyword at the start of the loop. */ 6814/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
6801 token = cp_parser_require (parser, CPP_KEYWORD, "iteration-statement"); 6802 if (!token) 6803 return error_mark_node; 6804 6805 /* Remember whether or not we are already within an iteration 6806 statement. */ 6807 in_statement = parser->in_statement; 6808 | 6815 token = cp_parser_require (parser, CPP_KEYWORD, "iteration-statement"); 6816 if (!token) 6817 return error_mark_node; 6818 6819 /* Remember whether or not we are already within an iteration 6820 statement. */ 6821 in_statement = parser->in_statement; 6822 |
6823/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 6824 /* Parse the attributes, if any. */ 6825 attributes = cp_parser_attributes_opt (parser); 6826 6827/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
|
6809 /* See what kind of keyword it is. */ 6810 keyword = token->keyword; 6811 switch (keyword) 6812 { 6813 case RID_WHILE: 6814 { 6815 tree condition; 6816 6817 /* Begin the while-statement. */ | 6828 /* See what kind of keyword it is. */ 6829 keyword = token->keyword; 6830 switch (keyword) 6831 { 6832 case RID_WHILE: 6833 { 6834 tree condition; 6835 6836 /* Begin the while-statement. */ |
6818 statement = begin_while_stmt (); | 6837/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 6838 statement = begin_while_stmt (attributes); 6839/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
6819 /* Look for the `('. */ 6820 cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); 6821 /* Parse the condition. */ 6822 condition = cp_parser_condition (parser); 6823 finish_while_stmt_cond (condition, statement); 6824 /* Look for the `)'. */ 6825 cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); 6826 /* Parse the dependent statement. */ --- 5 unchanged lines hidden (view full) --- 6832 } 6833 break; 6834 6835 case RID_DO: 6836 { 6837 tree expression; 6838 6839 /* Begin the do-statement. */ | 6840 /* Look for the `('. */ 6841 cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); 6842 /* Parse the condition. */ 6843 condition = cp_parser_condition (parser); 6844 finish_while_stmt_cond (condition, statement); 6845 /* Look for the `)'. */ 6846 cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'"); 6847 /* Parse the dependent statement. */ --- 5 unchanged lines hidden (view full) --- 6853 } 6854 break; 6855 6856 case RID_DO: 6857 { 6858 tree expression; 6859 6860 /* Begin the do-statement. */ |
6840 statement = begin_do_stmt (); | 6861/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 6862 statement = begin_do_stmt (attributes); 6863/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
6841 /* Parse the body of the do-statement. */ 6842 parser->in_statement = IN_ITERATION_STMT; 6843 cp_parser_implicitly_scoped_statement (parser, NULL); 6844 parser->in_statement = in_statement; 6845 finish_do_body (statement); 6846 /* Look for the `while' keyword. */ 6847 cp_parser_require_keyword (parser, RID_WHILE, "`while'"); 6848 /* Look for the `('. */ --- 10 unchanged lines hidden (view full) --- 6859 break; 6860 6861 case RID_FOR: 6862 { 6863 tree condition = NULL_TREE; 6864 tree expression = NULL_TREE; 6865 6866 /* Begin the for-statement. */ | 6864 /* Parse the body of the do-statement. */ 6865 parser->in_statement = IN_ITERATION_STMT; 6866 cp_parser_implicitly_scoped_statement (parser, NULL); 6867 parser->in_statement = in_statement; 6868 finish_do_body (statement); 6869 /* Look for the `while' keyword. */ 6870 cp_parser_require_keyword (parser, RID_WHILE, "`while'"); 6871 /* Look for the `('. */ --- 10 unchanged lines hidden (view full) --- 6882 break; 6883 6884 case RID_FOR: 6885 { 6886 tree condition = NULL_TREE; 6887 tree expression = NULL_TREE; 6888 6889 /* Begin the for-statement. */ |
6867 statement = begin_for_stmt (); | 6890/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 6891 statement = begin_for_stmt (attributes); 6892/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
6868 /* Look for the `('. */ 6869 cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); 6870 /* Parse the initialization. */ 6871 cp_parser_for_init_statement (parser); 6872 finish_for_init_stmt (statement); 6873 6874 /* If there's a condition, process it. */ 6875 if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) --- 12614 unchanged lines hidden --- | 6893 /* Look for the `('. */ 6894 cp_parser_require (parser, CPP_OPEN_PAREN, "`('"); 6895 /* Parse the initialization. */ 6896 cp_parser_for_init_statement (parser); 6897 finish_for_init_stmt (statement); 6898 6899 /* If there's a condition, process it. */ 6900 if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) --- 12614 unchanged lines hidden --- |