[Python-checkins] CVS: python/dist/src/Parser tokenizer.c,2.51,2.52

Tim Peters tim_one@users.sourceforge.net
Mon, 27 Aug 2001 12:19:30 -0700


Update of /cvsroot/python/python/dist/src/Parser
In directory usw-pr-cvs1:/tmp/cvs-serv11755/python/Parser

Modified Files:
	tokenizer.c 
Log Message:
SF bug [#455775] float parsing discrepancy.
PyTokenizer_Get:  error if exponent contains no digits (3e, 2.0e+, ...).


Index: tokenizer.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v
retrieving revision 2.51
retrieving revision 2.52
diff -C2 -d -r2.51 -r2.52
*** tokenizer.c	2001/08/08 05:00:18	2.51
--- tokenizer.c	2001/08/27 19:19:28	2.52
***************
*** 757,763 ****
  				c = tok_nextc(tok);
  			else {
! 				/* Accept floating point numbers.
! 				   XXX This accepts incomplete things like
! 				   XXX 12e or 1e+; worry run-time */
  				if (c == '.') {
  		fraction:
--- 757,761 ----
  				c = tok_nextc(tok);
  			else {
! 				/* Accept floating point numbers. */
  				if (c == '.') {
  		fraction:
***************
*** 772,778 ****
  					if (c == '+' || c == '-')
  						c = tok_nextc(tok);
! 					while (isdigit(c)) {
! 						c = tok_nextc(tok);
  					}
  				}
  #ifndef WITHOUT_COMPLEX
--- 770,781 ----
  					if (c == '+' || c == '-')
  						c = tok_nextc(tok);
! 					if (!isdigit(c)) {
! 						tok->done = E_TOKEN;
! 						tok_backup(tok, c);
! 						return ERRORTOKEN;
  					}
+ 					do {
+ 						c = tok_nextc(tok);
+ 					} while (isdigit(c));
  				}
  #ifndef WITHOUT_COMPLEX