/* YACC parser for C expressions, for GDB.
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 2002, 2006, 2007, 2008,
- 2009, 2010 Free Software Foundation, Inc.
+ 2009, 2010, 2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
%token <sval> STRING
%token <sval> NSSTRING /* ObjC Foundation "NSString" literal */
%token <sval> SELECTOR /* ObjC "@selector" pseudo-operator */
-%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
+%token <ssym> NAME /* BLOCKNAME defined below to give it higher precedence. */
%token <tsym> TYPENAME
%token <class> CLASSNAME /* ObjC Class name */
%type <sval> name
exp : NAME_OR_INT
{ YYSTYPE val;
- parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val);
+ parse_number ($1.stoken.ptr,
+ $1.stoken.length, 0, &val);
write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (val.typed_val_int.type);
- write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
+ write_exp_elt_longcst ((LONGEST)
+ val.typed_val_int.val);
write_exp_elt_opcode (OP_LONG);
}
;
struct symtab *tem =
lookup_symtab (copy_name ($1.stoken));
if (tem)
- $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
+ $$ = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem),
+ STATIC_BLOCK);
else
error ("No file or function \"%s\".",
copy_name ($1.stoken));
msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol != NULL)
write_exp_msymbol (msymbol);
- else if (!have_full_symbols () && !have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
+ else if (!have_full_symbols ()
+ && !have_partial_symbols ())
+ error ("No symbol table is loaded. "
+ "Use the \"file\" command.");
else
- error ("No symbol \"%s\" in current context.", name);
+ error ("No symbol \"%s\" in current context.",
+ name);
}
;
write_exp_msymbol (msymbol);
else if (!have_full_symbols () &&
!have_partial_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
+ error ("No symbol table is loaded. "
+ "Use the \"file\" command.");
else
error ("No symbol \"%s\" in current context.",
copy_name ($1.stoken));
if (parsed_float)
{
- char c;
-
- /* It's a float since it contains a point or an exponent. */
-
- sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
- &putithere->typed_val_float.dval, &c);
-
- /* See if it has `f' or `l' suffix (float or long double). */
-
- c = tolower (p[len - 1]);
-
- if (c == 'f')
- putithere->typed_val_float.type = parse_type->builtin_float;
- else if (c == 'l')
- putithere->typed_val_float.type = parse_type->builtin_long_double;
- else if (isdigit (c) || c == '.')
- putithere->typed_val_float.type = parse_type->builtin_double;
- else
+ if (! parse_c_float (parse_gdbarch, p, len,
+ &putithere->typed_val_float.dval,
+ &putithere->typed_val_float.type))
return ERROR;
-
return FLOAT;
}
if (long_p == 0
&& (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
+ high_bit
+ = ((unsigned LONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
/* A large decimal (not hex or octal) constant (between INT_MAX
and UINT_MAX) is a long or unsigned long, according to ANSI,
else if (long_p <= 1
&& (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
{
- high_bit = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
+ high_bit
+ = ((unsigned LONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
unsigned_type = parse_type->builtin_unsigned_long;
signed_type = parse_type->builtin_long;
}
hex = 1;
local_radix = 16;
}
- else if (tokchr == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
+ else if (tokchr == '0' && (p[1]=='t' || p[1]=='T'
+ || p[1]=='d' || p[1]=='D'))
{
p += 2;
hex = 0;