While eqtype can detect numbers and floats, it is nice to be able to match for numbers/floats at the preprocessor stage.
The patch below will allow ! to match a number and !.! to match a float such that one can do things like:
match !,0 {db !} ;this will code db 0
match !,x {db !} ;this will not match
The patch applies to PREPROCE.INC.
skip_match_element:
cmp esi,[parameters_end]
je cannot_match
;vvvvvvvvvvvvvvvvv Insert lines below vvvvvvvvvvvvvvvvvvvvvv
;Lines below will allow ! to match for symbols beginning with a numeric expression
;and !.! to match for a float expression
mov ebp,esi ;save esi
cmp byte [ebx],1Ah ;before we skip the symbol, check if need to match a number
jne skip_match_rest
mov eax,[ebx+1]
cmp eax,'!.!' shl 8 + 3
je match_float
cmp ax,'!' shl 8 + 1
jne skip_match_rest
match_number: ;first match for single operands +/-/not
push ebx edx edi
mov edi,single_operand_operators
call get_operator
pop edi edx ebx
or al,al
jnz match_number
lodsb
cmp al,'('
je match_number
dec esi
cmp al,1Ah
jne number_mismatch
pushd ebp ebx edx [edi] [edi+4]
call get_number
popd [edi+4] [edi] edx ebx ebp
jc number_mismatch
number_matched:
push ebx edx edi
mov edi,operators
call get_operator
pop edi edx ebx
or al,al
jnz match_number
mov al,[esi]
cmp al,')'
je number_matched
cmp al,'('
je match_number
clc
ret
number_mismatch:
mov esi,ebp ;error = return with CF set, symbol not skipped
stc
ret
match_float:
push ebx edx ebp
call get_fp_value
pop ebp edx ebx
jc number_mismatch
ret
skip_match_rest:
mov esi,ebp
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^