#include "system.h"
#include "obstack.h"
+#include "toplev.h"
extern char *input_filename;
extern FILE *finput, *out;
#define USE_ABSORBER absorber = 0
/* Keep track of the current class name and package name. */
-static char *current_class;
-static char *package_name;
+static const char *current_class;
+static const char *package_name;
/* Keep track of whether things have be listed before. */
static int previous_output;
/* Record a method declaration */
struct method_declarator {
- char *method_name;
- char *args;
+ const char *method_name;
+ const char *args;
};
#define NEW_METHOD_DECLARATOR(D,N,A) \
{ \
}
/* Two actions for this grammar */
-static void report_class_declaration PROTO ((char *));
+static void report_class_declaration PROTO ((const char *));
static void report_main_declaration PROTO ((struct method_declarator *));
#include "lex.h"
int value; /* For modifiers */
}
+%{
+#include "lex.c"
+%}
+
%pure_parser
/* Things defined here have to match the order of what's in the
primitive_type OSB_TK CSB_TK
| name OSB_TK CSB_TK
{
- char *n = xmalloc (strlen ($1)+2);
- n [0] = '[';
- strcpy (n+1, $1);
- $$ = n;
+ $$ = concat ("[", $1, NULL);
}
| array_type OSB_TK CSB_TK
{
- char *n = xmalloc (strlen ($1)+2);
- n [0] = '[';
- strcpy (n+1, $1);
- $$ = n;
+ $$ = concat ("[", $1, NULL);
}
;
qualified_name:
name DOT_TK identifier
{
- char *n = xmalloc (strlen ($1)+strlen ($3)+2);
- sprintf (n, "%s.%s", $1, $3);
- $$ = n;
+ $$ = concat ($1, ".", $3, NULL);
}
;
formal_parameter
| formal_parameter_list C_TK formal_parameter
{
- char *n = xmalloc (strlen ($1)+strlen($3)+2);
- sprintf (n, "%s,%s", $1, $3);
- $$ = n;
+ $$ = concat ($1, ",", $3, NULL);
}
;
/* 19.9.1 Productions from 9.1: Interfaces Declarations */
interface_declaration:
INTERFACE_TK identifier interface_body
+ { report_class_declaration ($2); modifier_value = 0; }
| modifiers INTERFACE_TK identifier interface_body
- { modifier_value = 0; }
+ { report_class_declaration ($3); modifier_value = 0; }
| INTERFACE_TK identifier extends_interfaces interface_body
+ { report_class_declaration ($2); modifier_value = 0; }
| modifiers INTERFACE_TK identifier extends_interfaces interface_body
- { modifier_value = 0; }
+ { report_class_declaration ($3); modifier_value = 0; }
;
extends_interfaces:
%%
\f
-#include "lex.c"
-
/* Create a new parser context */
void
java_push_parser_context ()
{
struct parser_ctxt *new =
- (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
+ (struct parser_ctxt *) xcalloc (1, sizeof (struct parser_ctxt));
- bzero (new, sizeof (struct parser_ctxt));
new->next = ctxp;
ctxp = new;
}
static void
report_class_declaration (name)
- char * name;
+ const char * name;
{
extern int flag_dump_class, flag_list_filename;
void
yyerror (msg)
- char *msg;
-{
-}
-
-char *
-xstrdup (s)
- const char *s;
+ const char *msg ATTRIBUTE_UNUSED;
{
- char *ret;
-
- ret = xmalloc (strlen (s) + 1);
- strcpy (ret, s);
- return ret;
}