From f6d23b6f3bc8e82684fc24b2d4d06ffeac38f509 Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Wed, 10 Jun 1998 23:29:59 +0000 Subject: * c-exp.y: Fix problems with parsing "'foo.bar'::func". Some languages allow symbols with dots. * gdbtypes.c (check_stub_method): Cosmetic. Use more descriptive names for parameters. start-sanitize-java * jv-exp.y: Parser now accepts primitive types. * (parse_number): Use correct ifdef for scanf long double support. * jv-lang.c (java_array_type): Initial cut at array support. end-sanitize-java * language.c language.h (set_language): Now returns previous language. * symtab.c (find_methods): Make static. Cosmetic changes, including indentation, and adding descriptive comments. Move local variable defs into the block they are used in. * Don't call check_stub_method any more. Use gdb_mangle_name to generate the full method name. find_method doesn't need all the other goobldegook that check_stub_method does. * (gdb_mangle_name): Use more descriptive names for parameters. Fix comment. start-sanitize-java * (lookup_partial_symbol lookup_block_symbol): Check for java to ensure we can find mangled names. end-sanitize-java * (decode_line_1): Move local variable defs into the block they are used in. (Improves code readability.) --- gdb/jv-exp.y | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'gdb/jv-exp.y') diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index 828a557..672991b 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -151,7 +151,7 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *)); %type rcurly Dims Dims_opt %type ClassOrInterfaceType ClassType /* ReferenceType Type ArrayType */ -%type IntegralType FloatingPointType NumericType PrimitiveType +%type IntegralType FloatingPointType NumericType PrimitiveType ArrayType PrimitiveOrArrayType %token INTEGER_LITERAL %token FLOATING_POINT_LITERAL @@ -201,7 +201,20 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *)); %% start : exp1 -/* | type_exp FIXME */ + | type_exp + ; + +type_exp: PrimitiveOrArrayType + { + write_exp_elt_opcode(OP_TYPE); + write_exp_elt_type($1); + write_exp_elt_opcode(OP_TYPE); + } + ; + +PrimitiveOrArrayType: + PrimitiveType + | ArrayType ; StringLiteral: @@ -294,14 +307,12 @@ ClassType: ClassOrInterfaceType ; -/* UNUSED: ArrayType: PrimitiveType Dims { $$ = java_array_type ($1, $2); } | Name Dims { $$ = java_array_type (java_type_from_name ($1), $2); } ; -*/ Name: IDENTIFIER @@ -697,7 +708,7 @@ parse_number (p, len, parsed_float, putithere) num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c); else { -#ifdef PRINTF_HAS_LONG_DOUBLE +#ifdef SCANF_HAS_LONG_DOUBLE num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c); #else /* Scan it into a double, then assign it to the long double. @@ -723,7 +734,7 @@ parse_number (p, len, parsed_float, putithere) return ERROR; return FLOATING_POINT_LITERAL; -} + } /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ if (p[0] == '0') @@ -1080,13 +1091,13 @@ yylex () (c == '_' || c == '$' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) { - if (c == '<') - { - int i = namelen; - while (tokstart[++i] && tokstart[i] != '>'); - if (tokstart[i] == '>') - namelen = i; - } + if (c == '<') + { + int i = namelen; + while (tokstart[++i] && tokstart[i] != '>'); + if (tokstart[i] == '>') + namelen = i; + } c = tokstart[++namelen]; } -- cgit v1.1