X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fjv-exp.y;h=2a9b17e250d4d674e9a93fdc508c47dcfc2f810f;hb=02e423b9b296edcf2fc50161c361062727a3263d;hp=828a557e4ffe457c47d52bbe6068540c84cc9b99;hpb=fa803dc60f0bf01297674c41d001798e18ade4dc;p=binutils-gdb.git diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index 828a557e4ff..2a9b17e250d 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -1,5 +1,5 @@ /* YACC parser for Java expressions, for GDB. - Copyright (C) 1997. + Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -99,21 +99,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define YYDEBUG 0 /* Default to no yydebug support */ #endif -int -yyparse PARAMS ((void)); +int yyparse (void); -static int -yylex PARAMS ((void)); +static int yylex (void); -void -yyerror PARAMS ((char *)); +void yyerror (char *); -static struct type * java_type_from_name PARAMS ((struct stoken)); -static void push_expression_name PARAMS ((struct stoken)); -static void push_fieldnames PARAMS ((struct stoken)); +static struct type *java_type_from_name (struct stoken); +static void push_expression_name (struct stoken); +static void push_fieldnames (struct stoken); -static struct expression *copy_exp PARAMS ((struct expression *, int)); -static void insert_exp PARAMS ((int, struct expression *)); +static struct expression *copy_exp (struct expression *, int); +static void insert_exp (int, struct expression *); %} @@ -145,13 +142,12 @@ static void insert_exp PARAMS ((int, struct expression *)); %{ /* YYSTYPE gets defined by %union */ -static int -parse_number PARAMS ((char *, int, int, YYSTYPE *)); +static int parse_number (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 +197,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 +303,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 +704,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 +730,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') @@ -888,7 +895,7 @@ yylex () error ("Empty character constant."); yylval.typed_val_int.val = c; - yylval.typed_val_int.type = builtin_type_char; + yylval.typed_val_int.type = java_char_type; c = *lexptr++; if (c != '\'') @@ -1077,16 +1084,21 @@ yylex () /* It's a name. See how long it is. */ namelen = 0; for (c = tokstart[namelen]; - (c == '_' || c == '$' || (c >= '0' && c <= '9') - || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) + (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]; }