X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gdb%2Fm2-exp.y;h=56ec4048c0fcb740812d710705f9739054068886;hb=efc0eabd6019406ff92286a36713d41a42515e09;hp=b7b28fe892429c641139033a9b95fcfeddaf2d87;hpb=3e79cecf024acb3f5739ec19d6ebd331f08e80e8;p=platform%2Fupstream%2Fbinutils.git diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index b7b28fe..56ec404 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -1,25 +1,23 @@ /* YACC grammar for Modula-2 expressions, for GDB. Copyright (C) 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, - 2000, 2007, 2008 Free Software Foundation, Inc. + 2000, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Generated from expread.y (now c-exp.y) and contributed by the Department of Computer Science at the State University of New York at Buffalo, 1991. -This file is part of GDB. + This file is part of GDB. -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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + 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 + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ /* Parse a Modula-2 expression from text in a string, and return the result as a struct expression pointer. @@ -36,7 +34,7 @@ Boston, MA 02110-1301, USA. */ generator. Doing this with #defines and trying to control the interaction with include files ( and for example) just became too messy, particularly when such includes can be inserted at random - times by the parser generator. */ + times by the parser generator. */ %{ @@ -60,7 +58,7 @@ Boston, MA 02110-1301, USA. */ yacc generated parsers in gdb. Note that these are only the variables produced by yacc. If other parser generators (bison, byacc, etc) produce additional global names that conflict at link time, then those parser - generators need to be fixed instead of adding those names to this list. */ + generators need to be fixed instead of adding those names to this list. */ #define yymaxdepth m2_maxdepth #define yyparse m2_parse @@ -121,7 +119,7 @@ static char *make_qualname (char *, char *); static int parse_number (int); -/* The sign of the number being parsed. */ +/* The sign of the number being parsed. */ static int number_sign = 1; /* The block that the module specified by the qualifer on an identifer is @@ -267,7 +265,7 @@ exp : MIN_FUNC '(' type ')' exp : MAX_FUNC '(' type ')' { write_exp_elt_opcode (UNOP_MAX); write_exp_elt_type ($3); - write_exp_elt_opcode (UNOP_MIN); } + write_exp_elt_opcode (UNOP_MAX); } ; exp : FLOAT_FUNC '(' exp ')' @@ -545,7 +543,7 @@ exp : STRING write_exp_elt_opcode (OP_M2_STRING); } ; -/* This will be used for extensions later. Like adding modules. */ +/* This will be used for extensions later. Like adding modules. */ block : fblock { $$ = SYMBOL_BLOCK_VALUE($1); } ; @@ -598,7 +596,7 @@ variable: block COLONCOLON NAME write_exp_elt_opcode (OP_VAR_VALUE); } ; -/* Base case for variables. */ +/* Base case for variables. */ variable: NAME { struct symbol *sym; int is_a_field_of_this; @@ -645,29 +643,14 @@ variable: NAME type : TYPENAME - { $$ = lookup_typename (copy_name ($1), + { $$ = lookup_typename (parse_language, parse_gdbarch, + copy_name ($1), expression_context_block, 0); } ; %% -#if 0 /* FIXME! */ -int -overflow(a,b) - long a,b; -{ - return (MAX_OF_TYPE(parse_m2_type->builtin_int) - b) < a; -} - -int -uoverflow(a,b) - unsigned long a,b; -{ - return (MAX_OF_TYPE(parse_m2_type->builtin_card) - b) < a; -} -#endif /* FIXME */ - /* Take care of parsing a number (anything that starts with a digit). Set yylval and return the token type; update lexptr. LEN is the number of characters in it. */ @@ -735,7 +718,7 @@ parse_number (olen) if(!unsigned_p && number_sign == 1 && (prevn >= n)) unsigned_p=1; /* Try something unsigned */ /* Don't do the range check if n==i and i==0, since that special - case will give an overflow error. */ + case will give an overflow error. */ if(RANGE_CHECK && n!=i && i) { if((unsigned_p && (unsigned)prevn >= (unsigned)n) || @@ -1023,17 +1006,18 @@ yylex () char *tmp = copy_name (yylval.sval); struct symbol *sym; - if (lookup_partial_symtab (tmp)) + if (lookup_symtab (tmp)) return BLOCKNAME; sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0); if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) return BLOCKNAME; - if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1)) + if (lookup_typename (parse_language, parse_gdbarch, + copy_name (yylval.sval), expression_context_block, 1)) return TYPENAME; if(sym) { - switch(sym->aclass) + switch(SYMBOL_CLASS (sym)) { case LOC_STATIC: case LOC_REGISTER: @@ -1067,7 +1051,7 @@ yylex () } else { - /* Built-in BOOLEAN type. This is sort of a hack. */ + /* Built-in BOOLEAN type. This is sort of a hack. */ if (strncmp (tokstart, "TRUE", 4) == 0) { yylval.ulval = 1; @@ -1080,7 +1064,7 @@ yylex () } } - /* Must be another type of name... */ + /* Must be another type of name... */ return NAME; } }