#define get_effective_char(pfile) (*pfile->buffer->cur++)
#define BACKUP() (--pfile->buffer->cur)
- enum num_type_e { NT_DEC, NT_HEX } num_type = NT_DEC;
+ enum num_type_e { NT_DEC, NT_HEX, NT_BIN } num_type = NT_DEC;
enum num_part_e { NP_WHOLE, NP_FRACT, NP_EXP, NP_INT_SUFFIX, NP_FLOAT_SUFFIX } num_part = NP_WHOLE;
uchar c = *(pfile->buffer->cur - 1);
num_part = NP_FRACT;
++len;
obstack_1grow (stack, '.');
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
else
{
has_whole = 1;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
switch (c)
{
num_type = NT_HEX;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
+ break;
+
+ case 'B':
+ case 'b':
+ if (!CPP_OPTION (pfile, std))
+ {
+ num_type = NT_BIN;
+ ++len;
+ obstack_1grow (stack, c);
+ c = get_effective_char (pfile);
+ }
break;
case '.':
num_part = NP_FRACT;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
break;
}
}
has_whole = 1;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
if ('.' == c)
num_part = NP_FRACT;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
continue;
}
else if ('E' == c || 'e' == c)
num_part = NP_EXP;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
continue;
}
else
break;
}
}
- else
+ else if (NT_HEX == num_type)
{
while (ISXDIGIT (c))
{
has_whole = 1;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
+ }
+
+ if ('.' == c)
+ {
+ num_part = NP_FRACT;
+ ++len;
+ obstack_1grow (stack, c);
+ c = get_effective_char (pfile);
+ continue;
+ }
+ else if ('P' == c || 'p' == c)
+ {
+ if (has_whole || has_fract)
+ {
+ num_part = NP_EXP;
+ ++len;
+ obstack_1grow (stack, c);
+ c = get_effective_char (pfile);
+ continue;
+ }
+ else
+ break;
+ }
+ }
+ else /* (NT_BIN == num_type) */
+ {
+ while ((c=='0') || (c=='1'))
+ {
+ has_whole = 1;
+ ++len;
+ obstack_1grow (stack, c);
+ c = get_effective_char (pfile);
}
if ('.' == c)
num_part = NP_FRACT;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
continue;
}
else if ('P' == c || 'p' == c)
num_part = NP_EXP;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
continue;
}
else
has_fract = 1;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
if ('E' == c || 'e' == c)
num_part = NP_EXP;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
continue;
}
}
has_fract = 1;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
if ('P' == c || 'p' == c)
num_part = NP_EXP;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
continue;
}
}
{
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
while (ISDIGIT (c))
{
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
num_part = NP_FLOAT_SUFFIX;
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
if (c == prevc)
{
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
}
else if ('U' == c || 'u' == c)
{
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
break;
{
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
else if ('L' == c || 'l' == c)
{
++len;
obstack_1grow (stack, c);
- c = get_effective_char(pfile);
+ c = get_effective_char (pfile);
}
break;
}
{
struct normalize_state nst = INITIAL_NORMALIZE_STATE;
result->type = CPP_NUMBER;
- if (CPP_OPTION(pfile, pedantic_parse_number))
+ if (CPP_OPTION (pfile, pedantic_parse_number))
pedantic_lex_number (pfile, &result->val.str);
else
lex_number (pfile, &result->val.str, &nst);
/* SDCC _asm specific */
/* handle _asm ... _endasm ; */
- if (CPP_OPTION(pfile, preproc_asm) == 0 && result->val.node == pfile->spec_nodes.n__asm)
+ if (CPP_OPTION (pfile, preproc_asm) == 0 && result->val.node == pfile->spec_nodes.n__asm)
{
comment_start = buffer->cur;
result->type = CPP_ASM;
{
struct normalize_state nst = INITIAL_NORMALIZE_STATE;
result->type = CPP_NUMBER;
- if (CPP_OPTION(pfile, pedantic_parse_number))
+ if (CPP_OPTION (pfile, pedantic_parse_number))
pedantic_lex_number (pfile, &result->val.str);
else
lex_number (pfile, &result->val.str, &nst);