Changeset 382
- Timestamp:
- Jul 1, 2008, 9:49:27 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/nomc/parser_c/class_parser.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/nomc/parser_c/class_parser.c
r381 r382 124 124 125 125 126 /* 127 Function to parse the body of a class. 128 Current token is '{'. 129 130 CBODY:= '}' //This is an empty class body 131 | CLASSMETHODS '}' 132 */ 133 /* 134 135 CLASSMETHODS:= CLASSMETHOD 136 | CLASSMETHOD CLASSMETHODS 137 */ 126 138 127 139 /* … … 129 141 Current token is '{'. 130 142 131 CBODY:= 143 CBODY:= '}' //This is an empty class body 144 | IMPL CLASSMETHODS '}' 132 145 133 146 */ 134 147 static void parseCBody(void) 135 148 { 136 /* Current token is '{' */ 137 PPARSEINFO pParseInfo=(PPARSEINFO)gScanner->user_data; 138 139 140 do{ 149 PPARSEINFO pParseInfo=(PPARSEINFO)gScanner->user_data; 150 151 while(g_scanner_peek_next_token(gScanner)!= G_TOKEN_EOF && g_scanner_peek_next_token(gScanner)!='}') 152 { 141 153 PSYMBOL pCurSymbol; 142 154 GTokenValue value; 143 144 //pParseInfo->fPrintToken=TRUE;145 //printToken(gScanner->token);146 155 147 156 /* Method implementations must start with "impl" which is registered as a symbol. Here we check if 148 157 the token is a symbol. */ 149 TST_NEXT_TOKEN_NOT_OK(G_TOKEN_SYMBOL, "Method implementation must start with 'impl'.");158 exitIfNotMatchNext(G_TOKEN_SYMBOL, "Method implementation must start with 'impl'."); 150 159 151 160 value=gScanner->value; … … 157 166 g_scanner_unexp_token(gScanner, 158 167 G_TOKEN_SYMBOL, 159 NULL, 160 NULL, 161 NULL, 168 NULL, NULL, NULL, 162 169 "'impl'.", 163 170 TRUE); /* is_error */ … … 176 183 g_scanner_unexp_token(gScanner, 177 184 G_TOKEN_IDENTIFIER, 178 NULL, 179 NULL, 180 NULL, 185 NULL, NULL, NULL, 181 186 "Expected return type specifier.", 182 187 TRUE); /* is_error */ 183 188 cleanupAndExit(1); 184 189 } 185 }while(g_scanner_peek_next_token(gScanner)!= G_TOKEN_EOF && g_scanner_peek_next_token(gScanner)!='}'); 186 190 }; 191 192 exitIfNotMatchNext('}', "No closing of 'class' section."); 187 193 } 188 194 … … 193 199 Current token is CLASSIDENT. 194 200 195 CLASSBODY:= '{' CBODY '}'196 | '{' CBODY ' }' ';'201 CLASSBODY:= '{' CBODY 202 | '{' CBODY ';' 197 203 198 204 */ … … 203 209 204 210 parseCBody(); 205 206 exitIfNotMatchNext('}', "No closing of 'interface' section.");207 211 208 212 /* Remove a terminating ';' from the input if present. */
Note:
See TracChangeset
for help on using the changeset viewer.
