The R Project SVN R

Rev

Rev 90254 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 90254 Rev 90289
Line 2369... Line 2369...
2369
    R_ParseErrorCol  = yylloc.first_column;
2369
    R_ParseErrorCol  = yylloc.first_column;
2370
    R_ParseErrorFile = PS_SRCFILE;
2370
    R_ParseErrorFile = PS_SRCFILE;
2371
 
2371
 
2372
    if (!strncmp(s, yyunexpected, sizeof yyunexpected -1)) {
2372
    if (!strncmp(s, yyunexpected, sizeof yyunexpected -1)) {
2373
	int i;
2373
	int i;
2374
	/* Edit the error message */
2374
	/* Edit the error message: needs a copy */
-
 
2375
	char s1[PARSE_ERROR_SIZE + 1];
-
 
2376
	strncpy(s1, s, PARSE_ERROR_SIZE);
-
 
2377
	s1[PARSE_ERROR_SIZE] = 0;
2375
	expecting = (char *) strstr(s + sizeof yyunexpected -1, yyexpecting);
2378
	expecting = strstr(s1 + sizeof yyunexpected -1, yyexpecting);
2376
	if (expecting) *expecting = '\0';
2379
	if (expecting) *expecting = '\0';
-
 
2380
	
2377
	for (i = 0; yytname_translations[i]; i += 2) {
2381
	for (i = 0; yytname_translations[i]; i += 2) {
2378
	    if (!strcmp(s + sizeof yyunexpected - 1, yytname_translations[i])) {
2382
	    if (!strcmp(s1 + sizeof yyunexpected - 1, yytname_translations[i])) {
2379
                switch(i/2)
2383
                switch(i/2)
2380
                {
2384
                {
2381
                case 0:
2385
                case 0:
2382
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected input"));
2386
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected input"));
2383
                                break;
2387
                                break;
Line 2401... Line 2405...
2401
                                break;
2405
                                break;
2402
                case 7:
2406
                case 7:
2403
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected end of line"));
2407
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected end of line"));
2404
                                break;
2408
                                break;
2405
                default:
2409
                default:
2406
		  if (!strcmp(s + sizeof yyunexpected - 1, "PLACEHOLDER")) {
2410
		  if (!strcmp(s1 + sizeof yyunexpected - 1, "PLACEHOLDER")) {
2407
		      /* cheat to avoid changing the parse error
2411
		      /* cheat to avoid changing the parse error
2408
			 message for mis-use of _ */
2412
			 message for mis-use of _ */
2409
		      snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE,
2413
		      snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE,
2410
			       _("unexpected input"));
2414
			       _("unexpected input"));
2411
		      break;
2415
		      break;
Line 2417... Line 2421...
2417
                
2421
                
2418
		return;
2422
		return;
2419
	    }
2423
	    }
2420
	}
2424
	}
2421
	snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE - 1, _("unexpected %s"),
2425
	snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE - 1, _("unexpected %s"),
2422
                 s + sizeof yyunexpected - 1);
2426
                 s1 + sizeof yyunexpected - 1);
2423
    } else {
2427
    } else {
2424
	strncpy(R_ParseErrorMsg, s, PARSE_ERROR_SIZE - 1);
2428
	strncpy(R_ParseErrorMsg, s, PARSE_ERROR_SIZE - 1);
2425
        R_ParseErrorMsg[PARSE_ERROR_SIZE - 1] = '\0';
2429
        R_ParseErrorMsg[PARSE_ERROR_SIZE - 1] = '\0';
2426
    }
2430
    }
2427
}
2431
}