File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -4322,7 +4322,9 @@ static int typeofnext(void)
43224322    int  k , c ;
43234323
43244324    c  =  xxgetc ();
4325-     if  (isdigit (c )) k  =  1 ; else  k  =  2 ;
4325+     if  (isdigit (c )) k  =  1 ;
4326+     else  if  (('a'  <= c  &&  c  <= 'f' ) ||  ('A'  <= c  &&  c  <= 'F' )) k  =  2 ;
4327+     else  k  =  3 ;
43264328    xxungetc (c );
43274329    return  k ;
43284330}
@@ -4757,7 +4759,7 @@ static int NumericValue(int c)
47574759    YYTEXT_PUSH (c , yyp );
47584760    /* We don't care about other than ASCII digits */ 
47594761    while  (isdigit (c  =  xxgetc ()) ||  c  ==  '.'  ||  c  ==  'e'  ||  c  ==  'E' 
4760- 	   ||  c  ==  'x'  ||  c  ==  'X'  ||  c  ==  'L' )
4762+ 	   ||  c  ==  'x'  ||  c  ==  'X'  ||  c  ==  'L'   ||   c   ==   '_' )
47614763    {
47624764	count ++ ;
47634765	if  (c  ==  'L' ) /* must be at the end.  Won't allow 1Le3 (at present). */ 
@@ -4769,11 +4771,16 @@ static int NumericValue(int c)
47694771	    if  (count  >  2  ||  last  !=  '0' ) break ;  /* 0x must be first */ 
47704772	    YYTEXT_PUSH (c , yyp );
47714773	    while (isdigit (c  =  xxgetc ()) ||  ('a'  <= c  &&  c  <= 'f' ) || 
4772- 		  ('A'  <= c  &&  c  <= 'F' ) ||  c  ==  '.' ) {
4774+ 		  ('A'  <= c  &&  c  <= 'F' ) ||  c  ==  '.'   ||   c   ==   '_' ) {
47734775		if  (c  ==  '.' ) {
47744776		    if  (seendot ) return  ERROR ;
47754777		    seendot  =  1 ;
47764778		}
4779+ 		if  (c  ==  '_' ) {
4780+ 		    /* disallow underscores following 0x or followed by non-hexdigit */ 
4781+ 		    if  (nd  ==  0  ||  typeofnext () >= 3 ) break ;
4782+ 		    continue ;
4783+ 		}
47774784		YYTEXT_PUSH (c , yyp );
47784785		nd ++ ;
47794786	    }
@@ -4819,6 +4826,11 @@ static int NumericValue(int c)
48194826		break ;
48204827	    seendot  =  1 ;
48214828	}
4829+ 	/* underscores in significand followed by a digit must be skipped */ 
4830+ 	if  (c  ==  '_' ) {
4831+ 	    if  (seenexp  ||  typeofnext () >= 2 ) break ;
4832+ 	    continue ;
4833+ 	}
48224834	YYTEXT_PUSH (c , yyp );
48234835	last  =  c ;
48244836    }
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments