Skip to content

Commit

Permalink
fix PR#18819
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87300 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Nov 7, 2024
1 parent ddf9b77 commit 0b333e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions doc/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@
integer to double, analogously with \code{seq.default()},
\code{seq.int()} and \code{seq.POSIXt()}, resolving a \emph{modified}
\PR{18782}.

\item The parser now accepts hexadecimal constants with a decimal
point without an exponent (taken as \code{p0}) as documented in
\code{?NumericConstants} (\PR{18819}).
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/gram.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 1997--2023 The R Core Team
* Copyright (C) 1997--2024 The R Core Team
* Copyright (C) 2009--2011 Romain Francois
* Copyright (C) 1995--1997 Robert Gentleman and Ross Ihaka
*
Expand Down Expand Up @@ -4930,7 +4930,8 @@ static int NumericValue(int c)
YYTEXT_PUSH(c, yyp);
if (nd == 0) return ERROR;
}
if (seendot && !seenexp) return ERROR;
// ?NumericComstants says exponent is optional (as does C99)
// if (seendot && !seenexp) return ERROR;
if (c == 'L') /* for getParseData */
{
// seenexp will be checked later
Expand Down
5 changes: 3 additions & 2 deletions src/main/gram.y
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%{
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 1997--2023 The R Core Team
* Copyright (C) 1997--2024 The R Core Team
* Copyright (C) 2009--2011 Romain Francois
* Copyright (C) 1995--1997 Robert Gentleman and Ross Ihaka
*
Expand Down Expand Up @@ -2621,7 +2621,8 @@ static int NumericValue(int c)
YYTEXT_PUSH(c, yyp);
if (nd == 0) return ERROR;
}
if (seendot && !seenexp) return ERROR;
// ?NumericComstants says exponent is optional (as does C99)
// if (seendot && !seenexp) return ERROR;
if (c == 'L') /* for getParseData */
{
// seenexp will be checked later
Expand Down
7 changes: 6 additions & 1 deletion tests/reg-tests-1e.R
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,12 @@ for(x in list(x3 = {n <- 3L; x <- diag(n); x[n,n] <- 0; x},
}
## kappa(..) returned 1 or {0 with a warning} in R <= 4.4.2


## hexadecimal contants with and without exponent.
0x1.234p0
0x1.234p7
0x1.234p-7
0x1.234
## last was a (deliberate) parse error in R < 4.5.0, but not as documented.

## keep at end
rbind(last = proc.time() - .pt,
Expand Down

0 comments on commit 0b333e5

Please sign in to comment.