PP_NUM in ASM mode
oxe+1 is parsed as 0xe +1 if (parse_flags & PARSE_FLAG_ASM_FILE)
        Helps to compile a code:
        __asm__("mov $0xe" "+1", "%eax\n")
			
			
This commit is contained in:
		
							parent
							
								
									78ee3759b8
								
							
						
					
					
						commit
						78e4ee55b7
					
				
					 1 changed files with 34 additions and 9 deletions
				
			
		
							
								
								
									
										43
									
								
								tccpp.c
									
										
									
									
									
								
							
							
						
						
									
										43
									
								
								tccpp.c
									
										
									
									
									
								
							|  | @ -2558,6 +2558,7 @@ static inline void next_nomacro1(void) | |||
|     TokenSym *ts; | ||||
|     uint8_t *p, *p1; | ||||
|     unsigned int h; | ||||
|     int is_dec; | ||||
| 
 | ||||
|     p = file->buf_ptr; | ||||
|  redo_no_start: | ||||
|  | @ -2752,23 +2753,45 @@ maybe_newline: | |||
|         } | ||||
|         break; | ||||
| 
 | ||||
|     case '0': case '1': case '2': case '3': | ||||
|     case '0': | ||||
|         t = c; | ||||
|         cstr_reset(&tokcstr); | ||||
|         cstr_ccat(&tokcstr, c); | ||||
|         PEEKC(c, p); | ||||
|         is_dec = 1; | ||||
|         if ((c == 'x') || (c == 'o') || (c == 'b')) | ||||
|             is_dec = 0; | ||||
|         goto parse_num; | ||||
| 
 | ||||
|     case '1': case '2': case '3': | ||||
|     case '4': case '5': case '6': case '7': | ||||
|     case '8': case '9': | ||||
|         is_dec = 1; | ||||
|         t = c; | ||||
|         cstr_reset(&tokcstr); | ||||
|         /* after the first digit, accept digits, alpha, '.' or sign if
 | ||||
|            prefixed by 'eEpP' */ | ||||
|         cstr_ccat(&tokcstr, c); | ||||
|         PEEKC(c, p); | ||||
|     parse_num: | ||||
|         for(;;) { | ||||
|             if (parse_flags & PARSE_FLAG_ASM_FILE) { | ||||
|                 if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) | ||||
|                        || (c == '.') | ||||
|                        || ((c == '+' || c == '-') | ||||
|                             && (((t == 'e' || t == 'E') && is_dec) || | ||||
|                                 ((t == 'p' || t == 'P') && !is_dec))) | ||||
|                 )) | ||||
|                 break; | ||||
|             } else | ||||
|                 if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) | ||||
|                        || c == '.' | ||||
|                        || ((c == '+' || c == '-') | ||||
|                             && (t == 'e' || t == 'E' || t == 'p' || t == 'P') | ||||
|                 ))) | ||||
|                 break; | ||||
| 
 | ||||
|             t = c; | ||||
|             cstr_ccat(&tokcstr, c); | ||||
|             PEEKC(c, p); | ||||
|             if (!((isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM)) | ||||
|                   || c == '.' | ||||
|                   || ((c == '+' || c == '-') | ||||
|                       && (t == 'e' || t == 'E' || t == 'p' || t == 'P') | ||||
|                       ))) | ||||
|                 break; | ||||
|         } | ||||
|         /* We add a trailing '\0' to ease parsing */ | ||||
|         cstr_ccat(&tokcstr, '\0'); | ||||
|  | @ -2782,6 +2805,8 @@ maybe_newline: | |||
|         /* special dot handling because it can also start a number */ | ||||
|         PEEKC(c, p); | ||||
|         if (isnum(c)) { | ||||
|             t = '.'; | ||||
|             is_dec = 1; | ||||
|             cstr_reset(&tokcstr); | ||||
|             cstr_ccat(&tokcstr, '.'); | ||||
|             goto parse_num; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue