mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Change the order in which Floatnumber and Intnumber are tried
so it will correctly recognize floats. Fix the test program so it works again.
This commit is contained in:
parent
29be3b97a6
commit
10d10ffb1b
1 changed files with 3 additions and 2 deletions
|
@ -22,7 +22,7 @@ Exponent = '[eE][-+]?[0-9]+'
|
||||||
Pointfloat = '\([0-9]+\.[0-9]*\|\.[0-9]+\)\(' + Exponent + '\)?'
|
Pointfloat = '\([0-9]+\.[0-9]*\|\.[0-9]+\)\(' + Exponent + '\)?'
|
||||||
Expfloat = '[0-9]+' + Exponent
|
Expfloat = '[0-9]+' + Exponent
|
||||||
Floatnumber = Pointfloat + '\|' + Expfloat
|
Floatnumber = Pointfloat + '\|' + Expfloat
|
||||||
Number = Intnumber + '\|' + Floatnumber
|
Number = Floatnumber + '\|' + Intnumber
|
||||||
|
|
||||||
String = '\'\(\\\\.\|[^\\\n\']\)*\''
|
String = '\'\(\\\\.\|[^\\\n\']\)*\''
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ try:
|
||||||
save_syntax = regex.set_syntax(0) # Use default syntax
|
save_syntax = regex.set_syntax(0) # Use default syntax
|
||||||
tokenprog = regex.compile(Token)
|
tokenprog = regex.compile(Token)
|
||||||
finally:
|
finally:
|
||||||
|
if save_syntax != 0:
|
||||||
dummy = regex.set_syntax(save_syntax) # Restore original syntax
|
dummy = regex.set_syntax(save_syntax) # Restore original syntax
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue