Changeset 269 for trunk/idl-compiler/c/nom-idl-compiler.c
- Timestamp:
- Mar 25, 2007, 2:35:35 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/idl-compiler/c/nom-idl-compiler.c
r267 r269 83 83 {"NOMOVERRIDE", IDL_SYMBOL_OVERRIDE, KIND_UNKNOWN}, 84 84 {"NOMREGISTEREDIFACE", IDL_SYMBOL_REGINTERFACE, KIND_TYPESPEC}, 85 {"NOMCLASSNAME", IDL_SYMBOL_CLSNAME, KIND_UNKNOWN}, 86 {"NOMMETACLASS", IDL_SYMBOL_OLDMETACLASS, KIND_UNKNOWN}, 87 {"MetaClass", IDL_SYMBOL_METACLASS, KIND_UNKNOWN}, 85 88 {"native", IDL_SYMBOL_NATIVE, KIND_UNKNOWN}, 86 89 {"gulong", IDL_SYMBOL_GULONG, KIND_TYPESPEC}, … … 92 95 93 96 {"boolean", IDL_SYMBOL_BOOLEAN, KIND_TYPESPEC}, 94 {"String", IDL_SYMBOL_STRING, KIND_TYPESPEC}, 97 {"string", IDL_SYMBOL_STRING, KIND_TYPESPEC}, 98 {"long", IDL_SYMBOL_LONG, KIND_TYPESPEC}, 99 {"unsigned", IDL_SYMBOL_LONG, KIND_TYPESPEC}, 95 100 96 101 {"in", IDL_SYMBOL_IN, KIND_DIRECTION}, … … 172 177 } 173 178 return "unknown"; 179 } 180 181 /** 182 This function is only for removing the NOMCLASSNAME() definition from 183 the input stream. When everything is moved to the new IDL compiler 184 those statements will be removed and this parsing function eventually 185 removed. 186 187 The current token is the NOMCLASSNAME keyword. 188 189 CN:= G_TOKEN_SYMBOL '(' INDENT ')' ';' 190 */ 191 static void parseClassName(void) 192 { 193 194 if(!matchNext('(')) 195 { 196 getNextToken(); /* Make sure error references the correct token */ 197 g_scanner_unexp_token(gScanner, 198 '(', 199 NULL, 200 NULL, 201 NULL, 202 "Error in NOMCLASSNAME()", 203 TRUE); /* is_error */ 204 exit(1); 205 } 206 207 /* Identifier. We discard it. */ 208 if(!matchNext(G_TOKEN_IDENTIFIER)) 209 { 210 g_scanner_unexp_token(gScanner, 211 G_TOKEN_IDENTIFIER, 212 NULL, 213 NULL, 214 NULL, 215 "Class name is not a valid identifier.", 216 TRUE); /* is_error */ 217 exit(1); 218 } 219 220 if(!matchNext(')')) 221 { 222 getNextToken(); /* Make sure error references the correct token */ 223 g_scanner_unexp_token(gScanner, 224 ')', 225 NULL, 226 NULL, 227 NULL, 228 "Error in NOMCLASSNAME().", 229 TRUE); /* is_error */ 230 exit(1); 231 } 232 233 if(!matchNext(';')) 234 { 235 getNextToken(); /* Make sure error references the correct token */ 236 g_scanner_unexp_token(gScanner, 237 ';', 238 NULL, 239 NULL, 240 NULL, 241 "Error in NOMCLASSNAME() definition, Missing semicolon at the end.", 242 TRUE); /* is_error */ 243 exit(1); 244 } 245 } 246 247 /** 248 This function is only for removing the NOMMETACLASS() definition from 249 the input stream. When everything is moved to the new IDL compiler 250 those statements will be removed and this parsing function eventually 251 removed. 252 253 The current token is the NOMMETACLASS keyword. 254 255 CN:= G_TOKEN_SYMBOL '(' INDENT ')' ';' 256 */ 257 static void parseOldMetaClass(void) 258 { 259 260 if(!matchNext('(')) 261 { 262 getNextToken(); /* Make sure error references the correct token */ 263 g_scanner_unexp_token(gScanner, 264 '(', 265 NULL, 266 NULL, 267 NULL, 268 "Error in NOMMETACLASS()", 269 TRUE); /* is_error */ 270 exit(1); 271 } 272 273 /* Identifier. We discard it. */ 274 if(!matchNext(G_TOKEN_IDENTIFIER)) 275 { 276 g_scanner_unexp_token(gScanner, 277 G_TOKEN_IDENTIFIER, 278 NULL, 279 NULL, 280 NULL, 281 "Class name is not a valid identifier.", 282 TRUE); /* is_error */ 283 exit(1); 284 } 285 286 if(!matchNext(')')) 287 { 288 getNextToken(); /* Make sure error references the correct token */ 289 g_scanner_unexp_token(gScanner, 290 ')', 291 NULL, 292 NULL, 293 NULL, 294 "Error in NOMMETACLASS().", 295 TRUE); /* is_error */ 296 exit(1); 297 } 298 299 if(!matchNext(';')) 300 { 301 getNextToken(); /* Make sure error references the correct token */ 302 g_scanner_unexp_token(gScanner, 303 ';', 304 NULL, 305 NULL, 306 NULL, 307 "Error in NOMMETACLASS() definition, Missing semicolon at the end.", 308 TRUE); /* is_error */ 309 exit(1); 310 } 174 311 } 175 312 … … 278 415 parseNative(); 279 416 break; 417 case IDL_SYMBOL_CLSNAME: 418 parseClassName(); 419 break; 420 case IDL_SYMBOL_OLDMETACLASS: 421 parseOldMetaClass(); 422 break; 280 423 default: 281 424 break; … … 378 521 void funcMsgHandler(GScanner *gScanner, gchar *message, gboolean error) 379 522 { 380 g_printf("In file %s, line %d:\n\t%s\n", parseInfo.chrCurrentSourceFile, 381 g_scanner_cur_line(gScanner)-parseInfo.uiLineCorrection, message); 523 g_printf("%s:%d: error: %s (%d %d)\n", parseInfo.chrCurrentSourceFile, 524 g_scanner_cur_line(gScanner)-parseInfo.uiLineCorrection, message, 525 g_scanner_cur_line(gScanner), parseInfo.uiLineCorrection); 382 526 } 383 527 … … 485 629 486 630 g_scanner_input_file(gScanner, fd); 631 gScanner->config->case_sensitive=TRUE; 487 632 /* No single line comments */ 488 633 gScanner->config->skip_comment_single=FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.