Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
093e6632
Commit
093e6632
authored
Dec 21, 2010
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct lexing of exponents.
From-SVN: r168129
parent
3868d6bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
gcc/go/gofrontend/lex.cc
+22
-3
gcc/go/gofrontend/lex.h
+3
-0
No files found.
gcc/go/gofrontend/lex.cc
View file @
093e6632
...
...
@@ -931,6 +931,25 @@ Lex::is_hex_digit(char c)
||
(
c
>=
'a'
&&
c
<=
'f'
));
}
// Return whether an exponent could start at P.
bool
Lex
::
could_be_exponent
(
const
char
*
p
,
const
char
*
pend
)
{
if
(
*
p
!=
'e'
&&
*
p
!=
'E'
)
return
false
;
++
p
;
if
(
p
>=
pend
)
return
false
;
if
(
*
p
==
'+'
||
*
p
==
'-'
)
{
++
p
;
if
(
p
>=
pend
)
return
false
;
}
return
*
p
>=
'0'
&&
*
p
<=
'9'
;
}
// Pick up a number.
Token
...
...
@@ -980,7 +999,7 @@ Lex::gather_number()
}
}
if
(
*
p
!=
'.'
&&
*
p
!=
'
e'
&&
*
p
!=
'E'
&&
*
p
!=
'i'
)
if
(
*
p
!=
'.'
&&
*
p
!=
'
i'
&&
!
Lex
::
could_be_exponent
(
p
,
pend
)
)
{
std
::
string
s
(
pnum
,
p
-
pnum
);
mpz_t
val
;
...
...
@@ -1004,7 +1023,7 @@ Lex::gather_number()
++
p
;
}
if
(
*
p
!=
'.'
&&
*
p
!=
'
E'
&&
*
p
!=
'e'
&&
*
p
!=
'i'
)
if
(
*
p
!=
'.'
&&
*
p
!=
'
i'
&&
!
Lex
::
could_be_exponent
(
p
,
pend
)
)
{
std
::
string
s
(
pnum
,
p
-
pnum
);
mpz_t
val
;
...
...
@@ -1039,7 +1058,7 @@ Lex::gather_number()
++
p
;
}
if
(
dot
&&
(
*
p
==
'E'
||
*
p
==
'e'
))
if
(
dot
&&
Lex
::
could_be_exponent
(
p
,
pend
))
{
++
p
;
if
(
*
p
==
'+'
||
*
p
==
'-'
)
...
...
gcc/go/gofrontend/lex.h
View file @
093e6632
...
...
@@ -379,6 +379,9 @@ class Lex
Token
gather_identifier
();
static
bool
could_be_exponent
(
const
char
*
,
const
char
*
);
Token
gather_number
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment