Skip to content

Commit 0b333e5

Browse files
author
ripley
committed
fix PR#18819
git-svn-id: https://svn.r-project.org/R/trunk@87300 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent ddf9b77 commit 0b333e5

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

doc/NEWS.Rd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@
349349
integer to double, analogously with \code{seq.default()},
350350
\code{seq.int()} and \code{seq.POSIXt()}, resolving a \emph{modified}
351351
\PR{18782}.
352+
353+
\item The parser now accepts hexadecimal constants with a decimal
354+
point without an exponent (taken as \code{p0}) as documented in
355+
\code{?NumericConstants} (\PR{18819}).
352356
}
353357
}
354358
}

src/main/gram.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
/*
7272
* R : A Computer Language for Statistical Data Analysis
73-
* Copyright (C) 1997--2023 The R Core Team
73+
* Copyright (C) 1997--2024 The R Core Team
7474
* Copyright (C) 2009--2011 Romain Francois
7575
* Copyright (C) 1995--1997 Robert Gentleman and Ross Ihaka
7676
*
@@ -4930,7 +4930,8 @@ static int NumericValue(int c)
49304930
YYTEXT_PUSH(c, yyp);
49314931
if (nd == 0) return ERROR;
49324932
}
4933-
if (seendot && !seenexp) return ERROR;
4933+
// ?NumericComstants says exponent is optional (as does C99)
4934+
// if (seendot && !seenexp) return ERROR;
49344935
if (c == 'L') /* for getParseData */
49354936
{
49364937
// seenexp will be checked later

src/main/gram.y

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%{
33
/*
44
* R : A Computer Language for Statistical Data Analysis
5-
* Copyright (C) 1997--2023 The R Core Team
5+
* Copyright (C) 1997--2024 The R Core Team
66
* Copyright (C) 2009--2011 Romain Francois
77
* Copyright (C) 1995--1997 Robert Gentleman and Ross Ihaka
88
*
@@ -2621,7 +2621,8 @@ static int NumericValue(int c)
26212621
YYTEXT_PUSH(c, yyp);
26222622
if (nd == 0) return ERROR;
26232623
}
2624-
if (seendot && !seenexp) return ERROR;
2624+
// ?NumericComstants says exponent is optional (as does C99)
2625+
// if (seendot && !seenexp) return ERROR;
26252626
if (c == 'L') /* for getParseData */
26262627
{
26272628
// seenexp will be checked later

tests/reg-tests-1e.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,7 +1552,12 @@ for(x in list(x3 = {n <- 3L; x <- diag(n); x[n,n] <- 0; x},
15521552
}
15531553
## kappa(..) returned 1 or {0 with a warning} in R <= 4.4.2
15541554

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

15571562
## keep at end
15581563
rbind(last = proc.time() - .pt,

0 commit comments

Comments
 (0)