Kaydet (Commit) 10d10ffb authored tarafından Guido van Rossum's avatar Guido van Rossum

Change the order in which Floatnumber and Intnumber are tried

so it will correctly recognize floats.
Fix the test program so it works again.
üst 29be3b97
...@@ -22,7 +22,7 @@ Exponent = '[eE][-+]?[0-9]+' ...@@ -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,7 +39,8 @@ try: ...@@ -39,7 +39,8 @@ 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:
dummy = regex.set_syntax(save_syntax) # Restore original syntax if save_syntax != 0:
dummy = regex.set_syntax(save_syntax) # Restore original syntax
def test(file): def test(file):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment