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 4678... Line 4678...
4678
    R_ParseErrorCol  = yylloc.first_column;
4678
    R_ParseErrorCol  = yylloc.first_column;
4679
    R_ParseErrorFile = PS_SRCFILE;
4679
    R_ParseErrorFile = PS_SRCFILE;
4680
 
4680
 
4681
    if (!strncmp(s, yyunexpected, sizeof yyunexpected -1)) {
4681
    if (!strncmp(s, yyunexpected, sizeof yyunexpected -1)) {
4682
	int i;
4682
	int i;
4683
	/* Edit the error message */
4683
	/* Edit the error message: needs a copy */
-
 
4684
	char s1[PARSE_ERROR_SIZE + 1];
-
 
4685
	strncpy(s1, s, PARSE_ERROR_SIZE);
-
 
4686
	s1[PARSE_ERROR_SIZE] = 0;
4684
	expecting = (char *) strstr(s + sizeof yyunexpected -1, yyexpecting);
4687
	expecting = strstr(s1 + sizeof yyunexpected -1, yyexpecting);
4685
	if (expecting) *expecting = '\0';
4688
	if (expecting) *expecting = '\0';
-
 
4689
	
4686
	for (i = 0; yytname_translations[i]; i += 2) {
4690
	for (i = 0; yytname_translations[i]; i += 2) {
4687
	    if (!strcmp(s + sizeof yyunexpected - 1, yytname_translations[i])) {
4691
	    if (!strcmp(s1 + sizeof yyunexpected - 1, yytname_translations[i])) {
4688
                switch(i/2)
4692
                switch(i/2)
4689
                {
4693
                {
4690
                case 0:
4694
                case 0:
4691
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected input"));
4695
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected input"));
4692
                                break;
4696
                                break;
Line 4710... Line 4714...
4710
                                break;
4714
                                break;
4711
                case 7:
4715
                case 7:
4712
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected end of line"));
4716
                        snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE, _("unexpected end of line"));
4713
                                break;
4717
                                break;
4714
                default:
4718
                default:
4715
		  if (!strcmp(s + sizeof yyunexpected - 1, "PLACEHOLDER")) {
4719
		  if (!strcmp(s1 + sizeof yyunexpected - 1, "PLACEHOLDER")) {
4716
		      /* cheat to avoid changing the parse error
4720
		      /* cheat to avoid changing the parse error
4717
			 message for mis-use of _ */
4721
			 message for mis-use of _ */
4718
		      snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE,
4722
		      snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE,
4719
			       _("unexpected input"));
4723
			       _("unexpected input"));
4720
		      break;
4724
		      break;
Line 4726... Line 4730...
4726
                
4730
                
4727
		return;
4731
		return;
4728
	    }
4732
	    }
4729
	}
4733
	}
4730
	snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE - 1, _("unexpected %s"),
4734
	snprintf(R_ParseErrorMsg, PARSE_ERROR_SIZE - 1, _("unexpected %s"),
4731
                 s + sizeof yyunexpected - 1);
4735
                 s1 + sizeof yyunexpected - 1);
4732
    } else {
4736
    } else {
4733
	strncpy(R_ParseErrorMsg, s, PARSE_ERROR_SIZE - 1);
4737
	strncpy(R_ParseErrorMsg, s, PARSE_ERROR_SIZE - 1);
4734
        R_ParseErrorMsg[PARSE_ERROR_SIZE - 1] = '\0';
4738
        R_ParseErrorMsg[PARSE_ERROR_SIZE - 1] = '\0';
4735
    }
4739
    }
4736
}
4740
}