This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[ecj] Patch: FYI: remove jv-scan
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 20 Oct 2006 20:18:53 -0600
- Subject: [ecj] Patch: FYI: remove jv-scan
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcj-eclipse branch.
jv-scan was never all that useful and it won't be updated for 1.5.
It seemed best to just remove it.
Tom
Index: gcc/java/ChangeLog
from Tom Tromey <tromey@redhat.com>
* gcj.texi (Top): Don't mention jv-scan.
(Invoking gcj): Likewise.
(Invoking gcjh): Likewise.
(Invoking gjnih): Likewise.
(Invoking gij): Likewise.
(Invoking gcj-dbtool): Likewise.
(Invoking jv-scan): Removed.
* parse-scan.y: Removed.
* jv-scan.c: Removed.
* config-lang.in (stagestuff): Don't mention jv-scan.
* Make-lang.in (java): Removed jv-scan.
(JAVA_TARGET_INDEPENDENT_BIN_TOOLS): Likewise.
(JVSCAN_OBJS): Removed.
(jv-scan$(exeext)): Likewise.
(JAVA_MANFILES): Removed jv-scan.1.
(java.uninstall): Don't mention jv-scan.
(java.mostlyclean): Likewise.
(java.maintainer-clean): Likewise.
(.INTERMEDIATE): Likewise.
(java/jv-scan.o): Removed.
(jv-scan.pod): Likewise.
(java.srcextra): Don't mention parse-scan.c.
(java.mostlyclean): Likewise.
(java/parse-scan.c): Removed.
(java/parse-scan.o-warn): Removed.
(java/parse-scan.o): Removed.
Index: libjava/ChangeLog
from Tom Tromey <tromey@redhat.com>
* testsuite/libjava.cni/cni.exp (gcj_cni_build_headers): Don't use
jv-scan.
* testsuite/lib/libjava.exp (test_libjava_from_javac): Removed.
(find_jvscan): Removed.
Index: gcc/java/jv-scan.c
===================================================================
--- gcc/java/jv-scan.c (revision 117511)
+++ gcc/java/jv-scan.c (working copy)
@@ -1,290 +0,0 @@
-/* Main for jv-scan
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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, or (at your option)
-any later version.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "intl.h"
-
-#include "obstack.h" /* We use obstacks in lex.c */
-
-#include "version.h"
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#ifdef HAVE_LANGINFO_CODESET
-#include <langinfo.h>
-#endif
-
-#include <getopt.h>
-
-extern void fatal_error (const char *gmsgid, ...)
- ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-void warning (int opt, const char *gmsgid, ...) ATTRIBUTE_PRINTF_2;
-void warning0 (const char *gmsgid, ...) ATTRIBUTE_PRINTF_1;
-void report (void);
-
-static void usage (void) ATTRIBUTE_NORETURN;
-static void help (void) ATTRIBUTE_NORETURN;
-static void version (void) ATTRIBUTE_NORETURN;
-
-#define JC1_LITE
-#include "jcf.h"
-#include "parse.h"
-
-/* Current input file and output file IO streams. */
-FILE *finput, *out;
-
-/* Executable name. */
-char *exec_name;
-
-struct line_maps line_table;
-
-/* Flags matching command line options. */
-int flag_find_main = 0;
-int flag_dump_class = 0;
-int flag_list_filename = 0;
-int flag_complexity = 0;
-int flag_assert = 1;
-
-int pedantic = 0;
-
-
-
-/* This is used to mark options with no short value. */
-#define LONG_OPT(Num) ((Num) + 128)
-
-#define OPT_HELP LONG_OPT (0)
-#define OPT_VERSION LONG_OPT (1)
-#define OPT_ENCODING LONG_OPT (2)
-
-static const struct option options[] =
-{
- { "help", no_argument, NULL, OPT_HELP },
- { "version", no_argument, NULL, OPT_VERSION },
- { "print-main", no_argument, &flag_find_main, 1 },
- { "list-filename", no_argument, &flag_list_filename, 1 },
- { "list-class", no_argument, &flag_dump_class, 1 },
- { "encoding", required_argument, NULL, OPT_ENCODING },
- { "complexity", no_argument, &flag_complexity, 1 },
- { "no-assert", no_argument, &flag_assert, 0 },
- { "assert", no_argument, &flag_assert, 1 },
- { NULL, no_argument, NULL, 0 }
-};
-
-static void
-usage (void)
-{
- fprintf (stderr, _("Try 'jv-scan --help' for more information.\n"));
- exit (1);
-}
-
-static void
-help (void)
-{
- printf (_("Usage: jv-scan [OPTION]... FILE...\n\n"));
- printf (_("Print useful information read from Java source files.\n\n"));
- printf (_(" --no-assert Don't recognize the assert keyword\n"));
- printf (_(" --complexity Print cyclomatic complexity of input file\n"));
- printf (_(" --encoding NAME Specify encoding of input file\n"));
- printf (_(" --print-main Print name of class containing 'main'\n"));
- printf (_(" --list-class List all classes defined in file\n"));
- printf (_(" --list-filename Print input filename when listing class names\n"));
- printf (_(" -o FILE Set output file name\n"));
- printf ("\n");
- printf (_(" --help Print this help, then exit\n"));
- printf (_(" --version Print version number, then exit\n"));
- printf ("\n");
- printf (_("For bug reporting instructions, please see:\n"
- "%s.\n"), bug_report_url);
- exit (0);
-}
-
-static void
-version (void)
-{
- printf ("jv-scan (GCC) %s\n\n", version_string);
- printf ("Copyright %s 2006 Free Software Foundation, Inc.\n", _("(C)"));
- printf (_("This is free software; see the source for copying conditions. There is NO\n"
- "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"));
- exit (0);
-}
-
-/* jc1-lite main entry point */
-int
-main (int argc, char **argv)
-{
- int i = 1;
- const char *output_file = NULL;
- const char *encoding = NULL;
- long ft;
- int opt;
-
- exec_name = argv[0];
-
- /* Default for output */
- out = stdout;
-
- /* Unlock the stdio streams. */
- unlock_std_streams ();
-
- gcc_init_libintl ();
-
- /* Process options first. We use getopt_long and not
- getopt_long_only because we only support `--' long options here. */
- while ((opt = getopt_long (argc, argv, "o:", options, NULL)) != -1)
- {
- switch (opt)
- {
- case 0:
- /* Already handled. */
- break;
-
- case 'o':
- output_file = optarg;
- break;
-
- case OPT_HELP:
- help ();
- break;
-
- case OPT_VERSION:
- version ();
- break;
-
- case OPT_ENCODING:
- encoding = optarg;
- break;
-
- default:
- usage ();
- break;
- }
- }
-
- /* No flags? Do nothing */
- if (! flag_find_main && ! flag_dump_class && ! flag_complexity)
- return 0;
-
- /* Check on bad usage */
- if (flag_find_main + flag_dump_class + flag_complexity > 1)
- fatal_error
- ("only one of '--print-main', '--list-class', and '--complexity' allowed");
-
- if (output_file && !(out = fopen (output_file, "w")))
- fatal_error ("can't open output file '%s'", output_file);
-
- ft = ftell (out);
-
- gcc_obstack_init (&temporary_obstack);
- java_push_parser_context ();
-
- for ( i = optind; i < argc; i++ )
- if (argv [i])
- {
- char *filename = argv[i];
- if ( (finput = fopen (filename, "r")) )
- {
- /* There's no point in trying to find the current encoding
- unless we are going to do something intelligent with it
- -- hence the test for iconv. */
-#if defined (HAVE_LOCALE_H) && defined (HAVE_ICONV) && defined (HAVE_LANGINFO_CODESET)
- setlocale (LC_CTYPE, "");
- if (encoding == NULL)
- encoding = nl_langinfo (CODESET);
-#endif
- if (encoding == NULL || *encoding == '\0')
- encoding = DEFAULT_ENCODING;
-
- main_input_filename = filename;
- java_init_lex (finput, encoding);
- ctxp->filename = filename;
- yyparse ();
- report ();
- if (ftell (out) != ft)
- fputc ('\n', out);
- ft = ftell (out);
- fclose (finput);
- reset_report ();
- }
- else
- fatal_error ("file not found '%s'", argv [i]);
- }
-
- /* Flush and close */
- if (ftell (out) != ft)
- fputc ('\n', out);
- if (!output_file)
- fclose (out);
-
- return 0;
-}
-
-
-
-/* Error report, memory, obstack initialization and other utility
- functions. Use actually c-format msgid, but as functions with
- the same name elsewhere use gcc-internal-format, assume all users
- here use intersection between c-format and gcc-internal-format. */
-
-void
-fatal_error (const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
- fprintf (stderr, _("%s: error: "), exec_name);
- vfprintf (stderr, _(gmsgid), ap);
- fputc ('\n', stderr);
- va_end (ap);
- exit (1);
-}
-
-void
-warning (int opt ATTRIBUTE_UNUSED, const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
- fprintf (stderr, _("%s: warning: "), exec_name);
- vfprintf (stderr, _(gmsgid), ap);
- fputc ('\n', stderr);
- va_end (ap);
-}
-
-void
-warning0 (const char *gmsgid, ...)
-{
- va_list ap;
- va_start (ap, gmsgid);
- fprintf (stderr, _("%s: warning: "), exec_name);
- vfprintf (stderr, _(gmsgid), ap);
- fputc ('\n', stderr);
- va_end (ap);
-}
-
-void
-fancy_abort (const char *file, int line, const char *func)
-{
- fatal_error ("abort in %s, at %s:%d", func, file, line);
-}
Index: gcc/java/config-lang.in
===================================================================
--- gcc/java/config-lang.in (revision 117912)
+++ gcc/java/config-lang.in (working copy)
@@ -34,7 +34,7 @@
compilers="jc1\$(exeext) jvgenmain\$(exeext)"
-stagestuff="jc1\$(exeext) gcj\$(exeext) jvgenmain\$(exeext) jv-scan\$(exeext) jcf-dump\$(exeext)"
+stagestuff="jc1\$(exeext) gcj\$(exeext) jvgenmain\$(exeext) jcf-dump\$(exeext)"
gtfiles="\$(srcdir)/java/java-tree.h \$(srcdir)/java/jcf.h \$(srcdir)/java/lex.h \$(srcdir)/java/parse.h \$(srcdir)/java/builtins.c \$(srcdir)/java/class.c \$(srcdir)/java/constants.c \$(srcdir)/java/decl.c \$(srcdir)/java/expr.c \$(srcdir)/java/jcf-parse.c \$(srcdir)/java/lang.c \$(srcdir)/java/mangle.c \$(srcdir)/java/parse.y \$(srcdir)/java/resource.c"
Index: gcc/java/Make-lang.in
===================================================================
--- gcc/java/Make-lang.in (revision 117912)
+++ gcc/java/Make-lang.in (working copy)
@@ -47,12 +47,11 @@
GCJ = gcj
# Define the names for selecting java in LANGUAGES.
-java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) \
- jv-scan$(exeext) jcf-dump$(exeext)
+java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) jcf-dump$(exeext)
# Define the name of target independent tools to be installed in $(bindir)
# Names are subject to changes
-JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jv-scan jcf-dump
+JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-dump
# Tell GNU make to ignore these if they exist.
.PHONY: java
@@ -76,15 +75,12 @@
-rm -f $(GCJ)-cross$(exeext)
cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
-java.srcextra: java/parse.c java/parse-scan.c
+java.srcextra: java/parse.c
-cp -p $^ $(srcdir)/java
java/parse.c: java/parse.y
-$(BISON) -t --name-prefix=java_ $(BISONFLAGS) -o $@ $<
-java/parse-scan.c: java/parse-scan.y
- -$(BISON) -t $(BISONFLAGS) -o $@ $<
-
$(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
(cd $(srcdir)/java || exit 1; \
gperf -L ANSI-C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,4,$$ \
@@ -105,8 +101,6 @@
java/buffer.o java/check-init.o java/jcf-depend.o \
java/jcf-path.o java/boehm.o java/java-gimplify.o
-JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o intl.o
-
JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
java/win32-host.o java/zextract.o errors.o version.o ggc-none.o intl.o
@@ -119,7 +113,6 @@
jvspec.o-warn = -Wno-error
# Bison-1.75 output often yields (harmless) -Wtraditional warnings
-java/parse-scan.o-warn = -Wno-error
java/parse.o-warn = -Wno-error
jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
@@ -127,10 +120,6 @@
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
$(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)
-jv-scan$(exeext): $(JVSCAN_OBJS) $(LIBDEPS)
- rm -f $@
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVSCAN_OBJS) $(LIBICONV) $(LIBS)
-
jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
rm -f $@
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
@@ -161,7 +150,7 @@
java.dvi: doc/gcj.dvi
java.html: $(htmldir)/java/index.html
-JAVA_MANFILES = doc/gcj.1 doc/jv-scan.1 doc/jcf-dump.1 doc/gij.1 \
+JAVA_MANFILES = doc/gcj.1 doc/jcf-dump.1 doc/gij.1 \
doc/jv-convert.1 doc/grmic.1 doc/grmiregistry.1 \
doc/gcj-dbtool.1
@@ -204,7 +193,6 @@
java.uninstall:
-rm -rf $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
-rm -rf $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext)
- -rm -rf $(DESTDIR)$(man1dir)/jv-scan$(man1ext)
-rm -rf $(DESTDIR)$(man1dir)/jcf-dump$(man1ext)
-rm -rf $(DESTDIR)$(man1dir)/gij$(man1ext)
-rm -rf $(DESTDIR)$(man1dir)/jv-convert$(man1ext)
@@ -218,18 +206,18 @@
# We just have to delete files specific to us.
java.mostlyclean:
- -rm -f java/parse.c java/parse-scan.c
+ -rm -f java/parse.c
-rm -f java/*$(objext) $(DEMANGLER_PROG)
-rm -f java/*$(coverageexts)
-rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) \
- jv-scan$(exeext) jcf-dump$(exeext) s-java
+ jcf-dump$(exeext) s-java
java.clean:
java.distclean:
-rm -f java/config.status java/Makefile
-rm -f java/parse.output java/y.tab.c
java.maintainer-clean:
-rm -f $(docobjdir)/gcj.1
- -rm -f $(docobjdir)/jv-scan.1 $(docobjdir)/jcf-dump.1
+ -rm -f $(docobjdir)/jcf-dump.1
-rm -f $(docobjdir)/gij.1
-rm -f $(docobjdir)/jv-convert.1
-rm -f $(docobjdir)/grmic.1
@@ -289,8 +277,6 @@
java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) flags.h \
input.h java/java-except.h $(SYSTEM_H) coretypes.h $(TM_H) toplev.h \
java/parse.h $(GGC_H) debug.h real.h gt-java-jcf-parse.h $(TM_P_H)
-java/jv-scan.o: java/jv-scan.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- version.h intl.h
java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
coretypes.h $(TM_H) intl.h
java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
@@ -315,8 +301,6 @@
java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(JAVA_TREE_H) tree-gimple.h toplev.h
-java/parse-scan.o: java/parse-scan.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) toplev.h $(JAVA_LEX_C) java/parse.h java/lex.h input.h
java/parse.o: java/parse.c java/jcf-reader.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) function.h $(JAVA_TREE_H) $(JAVA_LEX_C) java/parse.h \
java/lex.h input.h $(GGC_H) debug.h gt-java-parse.h gtype-java.h $(TARGET_H) \
@@ -355,13 +339,11 @@
rm -f $(@D)/*
$(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/java -o $(@D) $<
-.INTERMEDIATE: gcj.pod jv-scan.pod jcf-dump.pod gij.pod \
+.INTERMEDIATE: gcj.pod jcf-dump.pod gij.pod \
jv-convert.pod grmic.pod grmiregistry.pod gcj-dbtool.pod
gcj.pod: java/gcj.texi
-$(TEXI2POD) -D gcj < $< > $@
-jv-scan.pod: java/gcj.texi
- -$(TEXI2POD) -D jv-scan < $< > $@
jcf-dump.pod: java/gcj.texi
-$(TEXI2POD) -D jcf-dump < $< > $@
gij.pod: java/gcj.texi
Index: gcc/java/parse-scan.y
===================================================================
--- gcc/java/parse-scan.y (revision 117511)
+++ gcc/java/parse-scan.y (working copy)
@@ -1,1377 +0,0 @@
-/* Parser grammar for quick source code scan of Java(TM) language programs.
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
- Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-
-This file is part of GCC.
-
-GCC 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, or (at your option)
-any later version.
-
-GCC 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 GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.
-
-Java and all Java-based marks are trademarks or registered trademarks
-of Sun Microsystems, Inc. in the United States and other countries.
-The Free Software Foundation is independent of Sun Microsystems, Inc. */
-
-/* This file parses Java source code. Action can be further completed
-to achieve a desired behavior. This file isn't part of the Java
-language gcc front end.
-
-The grammar conforms to the Java grammar described in "The Java(TM)
-Language Specification. J. Gosling, B. Joy, G. Steele. Addison Wesley
-1996, ISBN 0-201-63451-1"
-
-Some rules have been modified to support JDK1.1 inner classes
-definitions and other extensions. */
-
-%{
-#define JC1_LITE
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "obstack.h"
-#include "toplev.h"
-
-extern FILE *finput, *out;
-
- const char *main_input_filename;
-
-/* Obstack for the lexer. */
-struct obstack temporary_obstack;
-
-/* The current parser context. */
-struct parser_ctxt *ctxp;
-
-/* Error and warning counts, because they're used elsewhere */
-int java_error_count;
-int java_warning_count;
-
-/* Tweak default rules when necessary. */
-static int absorber;
-#define USE_ABSORBER absorber = 0
-
-/* Keep track of the current package name. */
-static const char *package_name;
-
-/* Keep track of whether things have be listed before. */
-static int previous_output;
-
-/* Record modifier uses */
-static int modifier_value;
-
-/* Record (almost) cyclomatic complexity. */
-static int complexity;
-
-/* Keeps track of number of bracket pairs after a variable declarator
- id. */
-static int bracket_count;
-
-/* Numbers anonymous classes */
-static int anonymous_count;
-
-/* This is used to record the current class context. */
-struct class_context
-{
- char *name;
- struct class_context *next;
-};
-
-/* The global class context. */
-static struct class_context *current_class_context;
-
-/* A special constant used to represent an anonymous context. */
-static const char *anonymous_context = "ANONYMOUS";
-
-/* Count of method depth. */
-static int method_depth;
-
-/* Record a method declaration */
-struct method_declarator {
- const char *method_name;
- const char *args;
-};
-#define NEW_METHOD_DECLARATOR(D,N,A) \
-{ \
- (D) = XNEW (struct method_declarator); \
- (D)->method_name = (N); \
- (D)->args = (A); \
-}
-
-/* Two actions for this grammar */
-static int make_class_name_recursive (struct obstack *stack,
- struct class_context *ctx);
-static char *get_class_name (void);
-static void report_class_declaration (const char *);
-static void report_main_declaration (struct method_declarator *);
-static void push_class_context (const char *);
-static void pop_class_context (void);
-
-void report (void);
-
-#include "lex.h"
-#include "parse.h"
-%}
-
-%union {
- char *node;
- struct method_declarator *declarator;
- int value; /* For modifiers */
-}
-
-%{
-extern int flag_assert;
-
-#include "lex.c"
-%}
-
-%pure_parser
-
-/* Things defined here have to match the order of what's in the
- binop_lookup table. */
-
-%token PLUS_TK MINUS_TK MULT_TK DIV_TK REM_TK
-%token LS_TK SRS_TK ZRS_TK
-%token AND_TK XOR_TK OR_TK
-%token BOOL_AND_TK BOOL_OR_TK
-%token EQ_TK NEQ_TK GT_TK GTE_TK LT_TK LTE_TK
-
-/* This maps to the same binop_lookup entry than the token above */
-
-%token PLUS_ASSIGN_TK MINUS_ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
-%token REM_ASSIGN_TK
-%token LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK
-%token AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK
-
-
-/* Modifier TOKEN have to be kept in this order. Don't scramble it */
-
-%token PUBLIC_TK PRIVATE_TK PROTECTED_TK
-%token STATIC_TK FINAL_TK SYNCHRONIZED_TK
-%token VOLATILE_TK TRANSIENT_TK NATIVE_TK
-%token PAD_TK ABSTRACT_TK MODIFIER_TK
-%token STRICT_TK
-
-/* Keep those two in order, too */
-%token DECR_TK INCR_TK
-
-/* From now one, things can be in any order */
-
-%token DEFAULT_TK IF_TK THROW_TK
-%token BOOLEAN_TK DO_TK IMPLEMENTS_TK
-%token THROWS_TK BREAK_TK IMPORT_TK
-%token ELSE_TK INSTANCEOF_TK RETURN_TK
-%token VOID_TK CATCH_TK INTERFACE_TK
-%token CASE_TK EXTENDS_TK FINALLY_TK
-%token SUPER_TK WHILE_TK CLASS_TK
-%token SWITCH_TK CONST_TK TRY_TK
-%token FOR_TK NEW_TK CONTINUE_TK
-%token GOTO_TK PACKAGE_TK THIS_TK
-%token ASSERT_TK
-
-%token BYTE_TK SHORT_TK INT_TK LONG_TK
-%token CHAR_TK INTEGRAL_TK
-
-%token FLOAT_TK DOUBLE_TK FP_TK
-
-%token ID_TK
-
-%token REL_QM_TK REL_CL_TK NOT_TK NEG_TK
-
-%token ASSIGN_ANY_TK ASSIGN_TK
-%token OP_TK CP_TK OCB_TK CCB_TK OSB_TK CSB_TK SC_TK C_TK DOT_TK
-
-%token STRING_LIT_TK CHAR_LIT_TK INT_LIT_TK FP_LIT_TK
-%token TRUE_TK FALSE_TK BOOL_LIT_TK NULL_TK
-
-%type <node> ID_TK identifier name simple_name qualified_name type
- primitive_type reference_type array_type formal_parameter_list
- formal_parameter class_or_interface_type class_type interface_type
-%type <declarator> method_declarator
-%type <value> MODIFIER_TK
-
-%%
-/* 19.2 Production from 2.3: The Syntactic Grammar */
-goal:
- compilation_unit
-;
-
-/* 19.3 Productions from 3: Lexical structure */
-literal:
- INT_LIT_TK
-| FP_LIT_TK
-| BOOL_LIT_TK
-| CHAR_LIT_TK
-| STRING_LIT_TK
-| NULL_TK
-;
-
-/* 19.4 Productions from 4: Types, Values and Variables */
-type:
- primitive_type
-| reference_type
-;
-
-primitive_type:
- INTEGRAL_TK
- {
- /* use preset global here. FIXME */
- $$ = xstrdup ("int");
- }
-| FP_TK
- {
- /* use preset global here. FIXME */
- $$ = xstrdup ("double");
- }
-| BOOLEAN_TK
- {
- /* use preset global here. FIXME */
- $$ = xstrdup ("boolean");
- }
-;
-
-reference_type:
- class_or_interface_type
-| array_type
-;
-
-class_or_interface_type:
- name
-;
-
-class_type:
- class_or_interface_type /* Default rule */
-;
-
-interface_type:
- class_or_interface_type
-;
-
-array_type:
- primitive_type dims
- {
- while (bracket_count-- > 0)
- $$ = concat ("[", $1, NULL);
- }
-| name dims
- {
- while (bracket_count-- > 0)
- $$ = concat ("[", $1, NULL);
- }
-;
-
-/* 19.5 Productions from 6: Names */
-name:
- simple_name /* Default rule */
-| qualified_name /* Default rule */
-;
-
-simple_name:
- identifier /* Default rule */
-;
-
-qualified_name:
- name DOT_TK identifier
- {
- $$ = concat ($1, ".", $3, NULL);
- }
-;
-
-identifier:
- ID_TK
-;
-
-/* 19.6: Production from 7: Packages */
-compilation_unit:
-| package_declaration
-| import_declarations
-| type_declarations
-| package_declaration import_declarations
-| package_declaration type_declarations
-| import_declarations type_declarations
-| package_declaration import_declarations type_declarations
-;
-
-import_declarations:
- import_declaration
-| import_declarations import_declaration
-;
-
-type_declarations:
- type_declaration
-| type_declarations type_declaration
-;
-
-package_declaration:
- PACKAGE_TK name SC_TK
- { package_name = $2; }
-;
-
-import_declaration:
- single_type_import_declaration
-| type_import_on_demand_declaration
-;
-
-single_type_import_declaration:
- IMPORT_TK name SC_TK
-;
-
-type_import_on_demand_declaration:
- IMPORT_TK name DOT_TK MULT_TK SC_TK
-;
-
-type_declaration:
- class_declaration
-| interface_declaration
-| empty_statement
-;
-
-/* 19.7 Shortened from the original:
- modifiers: modifier | modifiers modifier
- modifier: any of public... */
-modifiers:
- MODIFIER_TK
- {
- if ($1 == PUBLIC_TK)
- modifier_value++;
- if ($1 == STATIC_TK)
- modifier_value++;
- USE_ABSORBER;
- }
-| modifiers MODIFIER_TK
- {
- if ($2 == PUBLIC_TK)
- modifier_value++;
- if ($2 == STATIC_TK)
- modifier_value++;
- USE_ABSORBER;
- }
-;
-
-/* 19.8.1 Production from $8.1: Class Declaration */
-class_declaration:
- modifiers CLASS_TK identifier super interfaces
- {
- report_class_declaration($3);
- modifier_value = 0;
- }
- class_body
-| CLASS_TK identifier super interfaces
- { report_class_declaration($2); }
- class_body
-;
-
-super:
-| EXTENDS_TK class_type
-;
-
-interfaces:
-| IMPLEMENTS_TK interface_type_list
-;
-
-interface_type_list:
- interface_type
- { USE_ABSORBER; }
-| interface_type_list C_TK interface_type
- { USE_ABSORBER; }
-;
-
-class_body:
- OCB_TK CCB_TK
- { pop_class_context (); }
-| OCB_TK class_body_declarations CCB_TK
- { pop_class_context (); }
-;
-
-class_body_declarations:
- class_body_declaration
-| class_body_declarations class_body_declaration
-;
-
-class_body_declaration:
- class_member_declaration
-| static_initializer
-| constructor_declaration
-| block /* Added, JDK1.1, instance initializer */
-;
-
-class_member_declaration:
- field_declaration
-| method_declaration
-| class_declaration /* Added, JDK1.1 inner classes */
-| interface_declaration /* Added, JDK1.1 inner classes */
-| empty_statement
-;
-
-/* 19.8.2 Productions from 8.3: Field Declarations */
-field_declaration:
- type variable_declarators SC_TK
- { USE_ABSORBER; }
-| modifiers type variable_declarators SC_TK
- { modifier_value = 0; }
-;
-
-variable_declarators:
- /* Should we use build_decl_list () instead ? FIXME */
- variable_declarator /* Default rule */
-| variable_declarators C_TK variable_declarator
-;
-
-variable_declarator:
- variable_declarator_id
-| variable_declarator_id ASSIGN_TK variable_initializer
-;
-
-variable_declarator_id:
- identifier
- { bracket_count = 0; USE_ABSORBER; }
-| variable_declarator_id OSB_TK CSB_TK
- { ++bracket_count; }
-;
-
-variable_initializer:
- expression
-| array_initializer
-;
-
-/* 19.8.3 Productions from 8.4: Method Declarations */
-method_declaration:
- method_header
- { ++method_depth; }
- method_body
- { --method_depth; }
-;
-
-method_header:
- type method_declarator throws
- { USE_ABSORBER; }
-| VOID_TK method_declarator throws
-| modifiers type method_declarator throws
- { modifier_value = 0; }
-| modifiers VOID_TK method_declarator throws
- {
- report_main_declaration ($3);
- modifier_value = 0;
- }
-;
-
-method_declarator:
- identifier OP_TK CP_TK
- {
- struct method_declarator *d;
- NEW_METHOD_DECLARATOR (d, $1, NULL);
- $$ = d;
- }
-| identifier OP_TK formal_parameter_list CP_TK
- {
- struct method_declarator *d;
- NEW_METHOD_DECLARATOR (d, $1, $3);
- $$ = d;
- }
-| method_declarator OSB_TK CSB_TK
-;
-
-formal_parameter_list:
- formal_parameter
-| formal_parameter_list C_TK formal_parameter
- {
- $$ = concat ($1, ",", $3, NULL);
- }
-;
-
-formal_parameter:
- type variable_declarator_id
- {
- USE_ABSORBER;
- if (bracket_count)
- {
- int i;
- char *n = XNEWVEC (char, bracket_count + 1 + strlen ($$));
- for (i = 0; i < bracket_count; ++i)
- n[i] = '[';
- strcpy (n + bracket_count, $$);
- $$ = n;
- }
- else
- $$ = $1;
- }
-| modifiers type variable_declarator_id /* Added, JDK1.1 final locals */
- {
- if (bracket_count)
- {
- int i;
- char *n = XNEWVEC (char, bracket_count + 1 + strlen ($2));
- for (i = 0; i < bracket_count; ++i)
- n[i] = '[';
- strcpy (n + bracket_count, $2);
- $$ = n;
- }
- else
- $$ = $2;
- }
-;
-
-throws:
-| THROWS_TK class_type_list
-;
-
-class_type_list:
- class_type
- { USE_ABSORBER; }
-| class_type_list C_TK class_type
- { USE_ABSORBER; }
-;
-
-method_body:
- block
-| SC_TK
-;
-
-/* 19.8.4 Productions from 8.5: Static Initializers */
-static_initializer:
- static block
-;
-
-static: /* Test lval.sub_token here */
- MODIFIER_TK
- { USE_ABSORBER; }
-;
-
-/* 19.8.5 Productions from 8.6: Constructor Declarations */
-/* NOTE FOR FURTHER WORK ON CONSTRUCTORS:
- - If a forbidden modifier is found, the error is either the use of
- a forbidden modifier for a constructor OR bogus attempt to declare a
- method without having specified the return type. FIXME */
-constructor_declaration:
- constructor_declarator throws constructor_body
-| modifiers constructor_declarator throws constructor_body
- { modifier_value = 0; }
-/* extra SC_TK, FIXME */
-| constructor_declarator throws constructor_body SC_TK
-/* extra SC_TK, FIXME */
-| modifiers constructor_declarator throws constructor_body SC_TK
- { modifier_value = 0; }
-/* I'm not happy with the SC_TK addition. It isn't in the grammar and should
- probably be matched by and empty statement. But it doesn't work. FIXME */
-;
-
-constructor_declarator:
- simple_name OP_TK CP_TK
- { USE_ABSORBER; }
-| simple_name OP_TK formal_parameter_list CP_TK
- { USE_ABSORBER; }
-;
-
-constructor_body:
- OCB_TK CCB_TK
-| OCB_TK explicit_constructor_invocation CCB_TK
-| OCB_TK block_statements CCB_TK
-| OCB_TK explicit_constructor_invocation block_statements CCB_TK
-;
-
-/* Error recovery for that rule moved down expression_statement: rule. */
-explicit_constructor_invocation:
- this_or_super OP_TK CP_TK SC_TK
-| this_or_super OP_TK argument_list CP_TK SC_TK
- /* Added, JDK1.1 inner classes. Modified because the rule
- 'primary' couldn't work. */
-| name DOT_TK SUPER_TK OP_TK argument_list CP_TK SC_TK
- { USE_ABSORBER; }
-| name DOT_TK SUPER_TK OP_TK CP_TK SC_TK
- { USE_ABSORBER; }
-;
-
-this_or_super: /* Added, simplifies error diagnostics */
- THIS_TK
-| SUPER_TK
-;
-
-/* 19.9 Productions from 9: Interfaces */
-/* 19.9.1 Productions from 9.1: Interfaces Declarations */
-interface_declaration:
- INTERFACE_TK identifier
- { report_class_declaration ($2); modifier_value = 0; }
- interface_body
-| modifiers INTERFACE_TK identifier
- { report_class_declaration ($3); modifier_value = 0; }
- interface_body
-| INTERFACE_TK identifier extends_interfaces
- { report_class_declaration ($2); modifier_value = 0; }
- interface_body
-| modifiers INTERFACE_TK identifier extends_interfaces
- { report_class_declaration ($3); modifier_value = 0; }
- interface_body
-;
-
-extends_interfaces:
- EXTENDS_TK interface_type
-| extends_interfaces C_TK interface_type
-;
-
-interface_body:
- OCB_TK CCB_TK
- { pop_class_context (); }
-| OCB_TK interface_member_declarations CCB_TK
- { pop_class_context (); }
-;
-
-interface_member_declarations:
- interface_member_declaration
-| interface_member_declarations interface_member_declaration
-;
-
-interface_member_declaration:
- constant_declaration
-| abstract_method_declaration
-| class_declaration /* Added, JDK1.1 inner classes */
-| interface_declaration /* Added, JDK1.1 inner classes */
-| empty_statement
-;
-
-constant_declaration:
- field_declaration
-;
-
-abstract_method_declaration:
- method_header SC_TK
-;
-
-/* 19.10 Productions from 10: Arrays */
-array_initializer:
- OCB_TK CCB_TK
-| OCB_TK variable_initializers CCB_TK
-| OCB_TK C_TK CCB_TK
-| OCB_TK variable_initializers C_TK CCB_TK
-;
-
-variable_initializers:
- variable_initializer
-| variable_initializers C_TK variable_initializer
-;
-
-/* 19.11 Production from 14: Blocks and Statements */
-block:
- OCB_TK CCB_TK
-| OCB_TK block_statements CCB_TK
-;
-
-block_statements:
- block_statement
-| block_statements block_statement
-;
-
-block_statement:
- local_variable_declaration_statement
-| statement
-| class_declaration /* Added, JDK1.1 inner classes */
-;
-
-local_variable_declaration_statement:
- local_variable_declaration SC_TK /* Can't catch missing ';' here */
-;
-
-local_variable_declaration:
- type variable_declarators
- { USE_ABSORBER; }
-| modifiers type variable_declarators /* Added, JDK1.1 final locals */
- { modifier_value = 0; }
-;
-
-statement:
- statement_without_trailing_substatement
-| labeled_statement
-| if_then_statement
-| if_then_else_statement
-| while_statement
-| for_statement
-;
-
-statement_nsi:
- statement_without_trailing_substatement
-| labeled_statement_nsi
-| if_then_else_statement_nsi
-| while_statement_nsi
-| for_statement_nsi
-;
-
-statement_without_trailing_substatement:
- block
-| empty_statement
-| expression_statement
-| switch_statement
-| do_statement
-| break_statement
-| continue_statement
-| return_statement
-| synchronized_statement
-| throw_statement
-| try_statement
-| assert_statement
-;
-
-empty_statement:
- SC_TK
-;
-
-label_decl:
- identifier REL_CL_TK
- { USE_ABSORBER; }
-;
-
-labeled_statement:
- label_decl statement
-;
-
-labeled_statement_nsi:
- label_decl statement_nsi
-;
-
-/* We concentrate here a bunch of error handling rules that we couldn't write
- earlier, because expression_statement catches a missing ';'. */
-expression_statement:
- statement_expression SC_TK
-;
-
-statement_expression:
- assignment
-| pre_increment_expression
-| pre_decrement_expression
-| post_increment_expression
-| post_decrement_expression
-| method_invocation
-| class_instance_creation_expression
-;
-
-if_then_statement:
- IF_TK OP_TK expression CP_TK statement { ++complexity; }
-;
-
-if_then_else_statement:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement
- { ++complexity; }
-;
-
-if_then_else_statement_nsi:
- IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement_nsi
- { ++complexity; }
-;
-
-switch_statement:
- SWITCH_TK OP_TK expression CP_TK switch_block
-;
-
-switch_block:
- OCB_TK CCB_TK
-| OCB_TK switch_labels CCB_TK
-| OCB_TK switch_block_statement_groups CCB_TK
-| OCB_TK switch_block_statement_groups switch_labels CCB_TK
-;
-
-switch_block_statement_groups:
- switch_block_statement_group
-| switch_block_statement_groups switch_block_statement_group
-;
-
-switch_block_statement_group:
- switch_labels block_statements { ++complexity; }
-;
-
-
-switch_labels:
- switch_label
-| switch_labels switch_label
-;
-
-switch_label:
- CASE_TK constant_expression REL_CL_TK
-| DEFAULT_TK REL_CL_TK
-;
-
-while_expression:
- WHILE_TK OP_TK expression CP_TK { ++complexity; }
-;
-
-while_statement:
- while_expression statement
-;
-
-while_statement_nsi:
- while_expression statement_nsi
-;
-
-do_statement_begin:
- DO_TK
-;
-
-do_statement:
- do_statement_begin statement WHILE_TK OP_TK expression CP_TK SC_TK
- { ++complexity; }
-;
-
-for_statement:
- for_begin SC_TK expression SC_TK for_update CP_TK statement
-| for_begin SC_TK SC_TK for_update CP_TK statement
-;
-
-for_statement_nsi:
- for_begin SC_TK expression SC_TK for_update CP_TK statement_nsi
-| for_begin SC_TK SC_TK for_update CP_TK statement_nsi
-;
-
-for_header:
- FOR_TK OP_TK
-;
-
-for_begin:
- for_header for_init { ++complexity; }
-;
-for_init: /* Can be empty */
-| statement_expression_list
-| local_variable_declaration
-;
-
-for_update: /* Can be empty */
-| statement_expression_list
-;
-
-statement_expression_list:
- statement_expression
-| statement_expression_list C_TK statement_expression
-;
-
-break_statement:
- BREAK_TK SC_TK
-| BREAK_TK identifier SC_TK
-;
-
-/* `continue' with a label is considered for complexity but ordinary
- continue is not. */
-continue_statement:
- CONTINUE_TK SC_TK
- | CONTINUE_TK identifier SC_TK { ++complexity; }
-;
-
-return_statement:
- RETURN_TK SC_TK
-| RETURN_TK expression SC_TK
-;
-
-throw_statement:
- THROW_TK expression SC_TK { ++complexity; }
-;
-
-assert_statement:
- ASSERT_TK expression REL_CL_TK expression SC_TK
-| ASSERT_TK expression SC_TK
-| ASSERT_TK error
- {yyerror ("Missing term"); RECOVER;}
-| ASSERT_TK expression error
- {yyerror ("';' expected"); RECOVER;}
-;
-synchronized_statement:
- synchronized OP_TK expression CP_TK block
-| synchronized OP_TK expression CP_TK error
-;
-
-synchronized: /* Test lval.sub_token here */
- MODIFIER_TK
- { USE_ABSORBER; }
-;
-
-try_statement:
- TRY_TK block catches
-| TRY_TK block finally
-| TRY_TK block catches finally
-;
-
-catches:
- catch_clause
-| catches catch_clause
-;
-
-catch_clause:
- CATCH_TK OP_TK formal_parameter CP_TK block { ++complexity; }
-;
-
-finally:
- FINALLY_TK block { ++complexity; }
-;
-
-/* 19.12 Production from 15: Expressions */
-primary:
- primary_no_new_array
-| array_creation_expression
-;
-
-primary_no_new_array:
- literal
-| THIS_TK
-| OP_TK expression CP_TK
-| class_instance_creation_expression
-| field_access
-| method_invocation
-| array_access
-| type_literals
- /* Added, JDK1.1 inner classes. Documentation is wrong
- referring to a 'ClassName' (class_name) rule that doesn't
- exist. Used name instead. */
-| name DOT_TK THIS_TK
- { USE_ABSORBER; }
-;
-
-type_literals:
- name DOT_TK CLASS_TK
- { USE_ABSORBER; }
-| array_type DOT_TK CLASS_TK
- { USE_ABSORBER; }
-| primitive_type DOT_TK CLASS_TK
- { USE_ABSORBER; }
-| VOID_TK DOT_TK CLASS_TK
- { USE_ABSORBER; }
-;
-
-class_instance_creation_expression:
- NEW_TK class_type OP_TK argument_list CP_TK
-| NEW_TK class_type OP_TK CP_TK
-| anonymous_class_creation
-| something_dot_new identifier OP_TK CP_TK
-| something_dot_new identifier OP_TK CP_TK class_body
-| something_dot_new identifier OP_TK argument_list CP_TK
-| something_dot_new identifier OP_TK argument_list CP_TK class_body
-;
-
-anonymous_class_creation:
- NEW_TK class_type OP_TK CP_TK
- { report_class_declaration (anonymous_context); }
- class_body
-| NEW_TK class_type OP_TK argument_list CP_TK
- { report_class_declaration (anonymous_context); }
- class_body
-;
-
-something_dot_new: /* Added, not part of the specs. */
- name DOT_TK NEW_TK
- { USE_ABSORBER; }
-| primary DOT_TK NEW_TK
-;
-
-argument_list:
- expression
-| argument_list C_TK expression
-| argument_list C_TK error
-;
-
-array_creation_expression:
- NEW_TK primitive_type dim_exprs
-| NEW_TK class_or_interface_type dim_exprs
-| NEW_TK primitive_type dim_exprs dims
-| NEW_TK class_or_interface_type dim_exprs dims
- /* Added, JDK1.1 anonymous array. Initial documentation rule
- modified */
-| NEW_TK class_or_interface_type dims array_initializer
-| NEW_TK primitive_type dims array_initializer
-;
-
-dim_exprs:
- dim_expr
-| dim_exprs dim_expr
-;
-
-dim_expr:
- OSB_TK expression CSB_TK
-;
-
-dims:
- OSB_TK CSB_TK
- { bracket_count = 1; }
-| dims OSB_TK CSB_TK
- { bracket_count++; }
-;
-
-field_access:
- primary DOT_TK identifier
-| SUPER_TK DOT_TK identifier
-;
-
-/* We include method invocation in the complexity measure on the
- theory that most method calls are virtual and therefore involve a
- decision point. */
-method_invocation:
- name OP_TK CP_TK
- { USE_ABSORBER; ++complexity; }
-| name OP_TK argument_list CP_TK
- { USE_ABSORBER; ++complexity; }
-| primary DOT_TK identifier OP_TK CP_TK { ++complexity; }
-| primary DOT_TK identifier OP_TK argument_list CP_TK { ++complexity; }
-| SUPER_TK DOT_TK identifier OP_TK CP_TK { ++complexity; }
-| SUPER_TK DOT_TK identifier OP_TK argument_list CP_TK { ++complexity; }
-;
-
-array_access:
- name OSB_TK expression CSB_TK
- { USE_ABSORBER; }
-| primary_no_new_array OSB_TK expression CSB_TK
-;
-
-postfix_expression:
- primary
-| name
- { USE_ABSORBER; }
-| post_increment_expression
-| post_decrement_expression
-;
-
-post_increment_expression:
- postfix_expression INCR_TK
-;
-
-post_decrement_expression:
- postfix_expression DECR_TK
-;
-
-unary_expression:
- pre_increment_expression
-| pre_decrement_expression
-| PLUS_TK unary_expression
-| MINUS_TK unary_expression
-| unary_expression_not_plus_minus
-;
-
-pre_increment_expression:
- INCR_TK unary_expression
-;
-
-pre_decrement_expression:
- DECR_TK unary_expression
-;
-
-unary_expression_not_plus_minus:
- postfix_expression
-| NOT_TK unary_expression
-| NEG_TK unary_expression
-| cast_expression
-;
-
-cast_expression: /* Error handling here is potentially weak */
- OP_TK primitive_type dims CP_TK unary_expression
-| OP_TK primitive_type CP_TK unary_expression
-| OP_TK expression CP_TK unary_expression_not_plus_minus
-| OP_TK name dims CP_TK unary_expression_not_plus_minus
-;
-
-multiplicative_expression:
- unary_expression
-| multiplicative_expression MULT_TK unary_expression
-| multiplicative_expression DIV_TK unary_expression
-| multiplicative_expression REM_TK unary_expression
-;
-
-additive_expression:
- multiplicative_expression
-| additive_expression PLUS_TK multiplicative_expression
-| additive_expression MINUS_TK multiplicative_expression
-;
-
-shift_expression:
- additive_expression
-| shift_expression LS_TK additive_expression
-| shift_expression SRS_TK additive_expression
-| shift_expression ZRS_TK additive_expression
-;
-
-relational_expression:
- shift_expression
-| relational_expression LT_TK shift_expression
-| relational_expression GT_TK shift_expression
-| relational_expression LTE_TK shift_expression
-| relational_expression GTE_TK shift_expression
-| relational_expression INSTANCEOF_TK reference_type
-;
-
-equality_expression:
- relational_expression
-| equality_expression EQ_TK relational_expression
-| equality_expression NEQ_TK relational_expression
-;
-
-and_expression:
- equality_expression
-| and_expression AND_TK equality_expression
-;
-
-exclusive_or_expression:
- and_expression
-| exclusive_or_expression XOR_TK and_expression
-;
-
-inclusive_or_expression:
- exclusive_or_expression
-| inclusive_or_expression OR_TK exclusive_or_expression
-;
-
-conditional_and_expression:
- inclusive_or_expression
-| conditional_and_expression BOOL_AND_TK inclusive_or_expression
- { ++complexity; }
-;
-
-conditional_or_expression:
- conditional_and_expression
-| conditional_or_expression BOOL_OR_TK conditional_and_expression
- { ++complexity; }
-;
-
-conditional_expression: /* Error handling here is weak */
- conditional_or_expression
-| conditional_or_expression REL_QM_TK expression REL_CL_TK conditional_expression
- { ++complexity; }
-;
-
-assignment_expression:
- conditional_expression
-| assignment
-;
-
-assignment:
- left_hand_side assignment_operator assignment_expression
-;
-
-left_hand_side:
- name
- { USE_ABSORBER; }
-| field_access
-| array_access
-;
-
-assignment_operator:
- ASSIGN_ANY_TK
-| ASSIGN_TK
-;
-
-expression:
- assignment_expression
-;
-
-constant_expression:
- expression
-;
-
-%%
-
-/* Create a new parser context */
-
-void
-java_push_parser_context (void)
-{
- struct parser_ctxt *tmp = XCNEW (struct parser_ctxt);
-
- tmp->next = ctxp;
- ctxp = tmp;
-}
-
-static void
-push_class_context (const char *name)
-{
- struct class_context *ctx;
-
- ctx = XNEW (struct class_context);
- ctx->name = (char *) name;
- ctx->next = current_class_context;
- current_class_context = ctx;
-}
-
-static void
-pop_class_context (void)
-{
- struct class_context *ctx;
-
- if (current_class_context == NULL)
- return;
-
- ctx = current_class_context->next;
- if (current_class_context->name != anonymous_context)
- free (current_class_context->name);
- free (current_class_context);
-
- current_class_context = ctx;
- if (current_class_context == NULL)
- anonymous_count = 0;
-}
-
-/* Recursively construct the class name. This is just a helper
- function for get_class_name(). */
-static int
-make_class_name_recursive (struct obstack *stack, struct class_context *ctx)
-{
- if (! ctx)
- return 0;
-
- make_class_name_recursive (stack, ctx->next);
-
- /* Replace an anonymous context with the appropriate counter value. */
- if (ctx->name == anonymous_context)
- {
- char buf[50];
- ++anonymous_count;
- sprintf (buf, "%d", anonymous_count);
- ctx->name = xstrdup (buf);
- }
-
- obstack_grow (stack, ctx->name, strlen (ctx->name));
- obstack_1grow (stack, '$');
-
- return ISDIGIT (ctx->name[0]);
-}
-
-/* Return a newly allocated string holding the name of the class. */
-static char *
-get_class_name (void)
-{
- char *result;
- int last_was_digit;
- struct obstack name_stack;
-
- obstack_init (&name_stack);
-
- /* Duplicate the logic of parse.y:maybe_make_nested_class_name(). */
- last_was_digit = make_class_name_recursive (&name_stack,
- current_class_context->next);
-
- if (! last_was_digit
- && method_depth
- && current_class_context->name != anonymous_context)
- {
- char buf[50];
- ++anonymous_count;
- sprintf (buf, "%d", anonymous_count);
- obstack_grow (&name_stack, buf, strlen (buf));
- obstack_1grow (&name_stack, '$');
- }
-
- if (current_class_context->name == anonymous_context)
- {
- char buf[50];
- ++anonymous_count;
- sprintf (buf, "%d", anonymous_count);
- current_class_context->name = xstrdup (buf);
- obstack_grow0 (&name_stack, buf, strlen (buf));
- }
- else
- obstack_grow0 (&name_stack, current_class_context->name,
- strlen (current_class_context->name));
-
- result = xstrdup (obstack_finish (&name_stack));
- obstack_free (&name_stack, NULL);
-
- return result;
-}
-
-/* Actions defined here */
-
-static void
-report_class_declaration (const char * name)
-{
- extern int flag_dump_class, flag_list_filename;
-
- push_class_context (name);
- if (flag_dump_class)
- {
- char *name = get_class_name ();
-
- if (!previous_output)
- {
- if (flag_list_filename)
- fprintf (out, "%s: ", main_input_filename);
- previous_output = 1;
- }
-
- if (package_name)
- fprintf (out, "%s.%s ", package_name, name);
- else
- fprintf (out, "%s ", name);
-
- free (name);
- }
-}
-
-static void
-report_main_declaration (struct method_declarator *declarator)
-{
- extern int flag_find_main;
-
- if (flag_find_main
- && modifier_value == 2
- && !strcmp (declarator->method_name, "main")
- && declarator->args
- && declarator->args [0] == '['
- && (! strcmp (declarator->args+1, "String")
- || ! strcmp (declarator->args + 1, "java.lang.String"))
- && current_class_context)
- {
- if (!previous_output)
- {
- char *name = get_class_name ();
- if (package_name)
- fprintf (out, "%s.%s ", package_name, name);
- else
- fprintf (out, "%s", name);
- free (name);
- previous_output = 1;
- }
- }
-}
-
-void
-report (void)
-{
- extern int flag_complexity;
- if (flag_complexity)
- fprintf (out, "%s %d\n", main_input_filename, complexity);
-}
-
-/* Reset global status used by the report functions. */
-
-void
-reset_report (void)
-{
- previous_output = 0;
- package_name = NULL;
- current_class_context = NULL;
- complexity = 0;
-}
-
-void
-yyerror (const char *msg ATTRIBUTE_UNUSED)
-{
- fprintf (stderr, "%s: %s\n", main_input_filename, msg);
- exit (1);
-}
-
-#ifdef __XGETTEXT__
-/* Depending on the version of Bison used to compile this grammar,
- it may issue generic diagnostics spelled "syntax error" or
- "parse error". To prevent this from changing the translation
- template randomly, we list all the variants of this particular
- diagnostic here. Translators: there is no fine distinction
- between diagnostics with "syntax error" in them, and diagnostics
- with "parse error" in them. It's okay to give them both the same
- translation. */
-const char d1[] = N_("syntax error");
-const char d2[] = N_("parse error");
-const char d3[] = N_("syntax error; also virtual memory exhausted");
-const char d4[] = N_("parse error; also virtual memory exhausted");
-const char d5[] = N_("syntax error: cannot back up");
-const char d6[] = N_("parse error: cannot back up");
-#endif
Index: gcc/java/gcj.texi
===================================================================
--- gcc/java/gcj.texi (revision 117511)
+++ gcc/java/gcj.texi (working copy)
@@ -68,8 +68,6 @@
Generate header files from Java class files
* gjnih: (gcj)Invoking gjnih.
Generate JNI header files from Java class files
-* jv-scan: (gcj)Invoking jv-scan.
- Print information about Java source files
* jcf-dump: (gcj)Invoking jcf-dump.
Print information about Java class files
* gij: (gcj)Invoking gij. GNU interpreter for Java bytecode
@@ -121,7 +119,6 @@
* Compatibility:: Compatibility between gcj and other tools for Java
* Invoking gcjh:: Generate header files from class files
* Invoking gjnih:: Generate JNI header files from class files
-* Invoking jv-scan:: Print information about source files
* Invoking jcf-dump:: Print information about class files
* Invoking gij:: Interpreting Java bytecodes
* Invoking gcj-dbtool:: Tool for manipulating class file databases.
@@ -156,7 +153,7 @@
@var{sourcefile}@dots{}
@c man end
@c man begin SEEALSO gcj
-gcc(1), gcjh(1), gjnih(1), gij(1), jv-scan(1), jcf-dump(1), gfdl(7),
+gcc(1), gcjh(1), gjnih(1), gij(1), jcf-dump(1), gfdl(7),
and the Info entries for @file{gcj} and @file{gcc}.
@c man end
@end ignore
@@ -760,7 +757,7 @@
@var{classname}@dots{}
@c man end
@c man begin SEEALSO gcjh
-gcc(1), gcj(1), gij(1), jv-scan(1), jcf-dump(1), gfdl(7),
+gcc(1), gcj(1), gij(1), jcf-dump(1), gfdl(7),
and the Info entries for @file{gcj} and @file{gcc}.
@c man end
@end ignore
@@ -874,7 +871,7 @@
@var{classname}@dots{}
@c man end
@c man begin SEEALSO gjnih
-gcc(1), gcj(1), gcjh(1), gij(1), jv-scan(1), jcf-dump(1), gfdl(7),
+gcc(1), gcj(1), gcjh(1), gij(1), jcf-dump(1), gfdl(7),
and the Info entries for @file{gcj} and @file{gcc}.
@c man end
@end ignore
@@ -961,69 +958,6 @@
@c man end
-@node Invoking jv-scan
-@chapter Invoking jv-scan
-
-@c man title jv-scan print information about Java source file
-
-@c man begin DESCRIPTION jv-scan
-
-The @code{jv-scan} program can be used to print information about a Java
-source file (@file{.java} file).
-
-@c man end
-
-@ignore
-@c man begin SYNOPSIS jv-scan
-jv-scan [@option{--no-assert}] [@option{--complexity}]
- [@option{--encoding}=@var{name}] [@option{--print-main}]
- [@option{--list-class}] [@option{--list-filename}]
- [@option{--version}] [@option{--help}]
- [@option{-o} @var{file}] @var{inputfile}@dots{}
-@c man end
-@c man begin SEEALSO jv-scan
-gcc(1), gcj(1), gcjh(1), gij(1), jcf-dump(1), gfdl(7),
-and the Info entries for @file{gcj} and @file{gcc}.
-@c man end
-@end ignore
-
-@c man begin OPTIONS jv-scan
-
-@table @gcctabopt
-@item --no-assert
-Don't recognize the @code{assert} keyword, for backwards compatibility
-with older versions of the language specification.
-
-@item --complexity
-This prints a complexity measure, related to cyclomatic complexity, for
-each input file.
-
-@item --encoding=@var{name}
-This works like the corresponding @command{gcj} option.
-
-@item --print-main
-This prints the name of the class in this file containing a @code{main}
-method.
-
-@item --list-class
-This lists the names of all classes defined in the input files.
-
-@item --list-filename
-If @code{--list-class} is given, this option causes @code{jv-scan} to
-also print the name of the file in which each class was found.
-
-@item -o @var{file}
-Print output to the named file.
-
-@item --help
-Print help, then exit.
-
-@item --version
-Print version number, then exit.
-@end table
-
-@c man end
-
@node Invoking jcf-dump
@chapter Invoking jcf-dump
@@ -1101,7 +1035,7 @@
[@option{--showversion}] [@option{--version}] [@option{--help}][@option{-?}]
@c man end
@c man begin SEEALSO gij
-gcc(1), gcj(1), gcjh(1), jv-scan(1), jcf-dump(1), gfdl(7),
+gcc(1), gcj(1), gcjh(1), jcf-dump(1), gfdl(7),
and the Info entries for @file{gcj} and @file{gcc}.
@c man end
@end ignore
@@ -1228,7 +1162,7 @@
@c man end
@c man begin SEEALSO gij
-gcc(1), gcj(1), gcjh(1), jv-scan(1), jcf-dump(1), gfdl(7),
+gcc(1), gcj(1), gcjh(1), jcf-dump(1), gfdl(7),
and the Info entries for @file{gcj} and @file{gcc}.
@c man end
@end ignore
Index: libjava/testsuite/libjava.cni/cni.exp
===================================================================
--- libjava/testsuite/libjava.cni/cni.exp (revision 117914)
+++ libjava/testsuite/libjava.cni/cni.exp (working copy)
@@ -31,29 +31,23 @@
global libgcj_jar
set gcjh [find_gcjh]
- set jvscan [find_jvscan]
- set class_out [string trim \
- [libjava_prune_warnings \
- [lindex [local_exec "$jvscan --encoding=UTF-8 $file --list-class" "" "" 300] 1]]]
- if {[string match "*parse error*" $class_out]} {
- fail "$file header generation"
+ # Currently we only build a header file for the main class from the
+ # .java file. If we need more than this, we'll have to figure
+ # something out.
+ set main [file rootname [file tail $file]]
+
+ set cmd "$gcjh -cni -force -classpath .:$libgcj_jar $main"
+ verbose $cmd
+ set x [string trim [libjava_prune_warnings \
+ [lindex [local_exec $cmd "" "" 300] 1]]]
+ if {$x != ""} {
+ verbose "local_exec failed: $x" 2
+ fail "$main header generation"
return 0
}
- foreach file [split $class_out] {
- set cmd "$gcjh -cni -force -classpath .:$libgcj_jar $file"
- verbose $cmd
- set x [string trim [libjava_prune_warnings \
- [lindex [local_exec $cmd "" "" 300] 1]]]
- if {$x != ""} {
- verbose "local_exec failed: $x" 2
- fail "$file header generation"
- return 0
- }
- }
-
- pass "$file header generation"
+ pass "$main header generation"
return 1
}
Index: libjava/testsuite/lib/libjava.exp
===================================================================
--- libjava/testsuite/lib/libjava.exp (revision 117914)
+++ libjava/testsuite/lib/libjava.exp (working copy)
@@ -75,11 +75,6 @@
return $file
}
-# Find `jv-scan'.
-proc find_jvscan {} {
- return [libjava_find_program jv-scan]
-}
-
# Find `gcjh'.
proc find_gcjh {} {
return [libjava_find_program gjavah]
@@ -686,207 +681,6 @@
#
# Run the test specified by srcfile and resultfile. compile_args and
# exec_args are options telling this proc how to work.
-#
-proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile exec_args } {
- global base_dir
- global srcdir subdir objdir
- global TOOL_OPTIONS
- global GCJ_UNDER_TEST
- global tmpdir
- global runtests
- global INTERPRETER
-
- # Make opts into an array.
- set opts(_) x
- unset opts(_)
- foreach item $exec_args {
- set opts($item) x
- }
-
- # If we need threads and we don't have them then set the `no-exec'
- # flag. This is case is also handled specially later.
- if {[info exists opts(need-threads)]} {
- global libjava_uses_threads
- if {! $libjava_uses_threads} {
- set opts(no-exec) x
- }
- }
- set errname [file rootname [file tail $srcfile]]
- if {! [runtest_file_p $runtests $errname]} {
- return
- }
-
- # bytecompile files with Sun's compiler for now.
- set bc_ok [bytecompile_file $srcfile $objdir]
-
- set javac [find_javac]
- # This is an ugly heuristic but it will have to do.
- if {[string match *gcj* $javac]} {
- set tag gcjC
- } else {
- set tag javac
- }
- if {[info exists opts(xfail-$tag)]} {
- setup_xfail *-*-*
- }
- if {! $bc_ok} then {
- if {[info exists opts(shouldfail)]} {
- pass "$errname byte compilation"
- return
- }
- fail "$errname byte compilation"
- untested "$errname compilation from bytecode"
- if {! [info exists opts(no-exec)]
- || [info exists opts(need-threads)]} {
- untested "$errname execution from bytecode->native test"
- untested "$errname output from bytecode->native test"
- }
- return
- }
- if {[info exists opts(shouldfail)]} {
- fail "$errname byte compilation"
- return
- }
- pass "$errname byte compilation"
-
- set removeList {}
-
- # Find name to use for --main, and name of all class files.
- set jvscan [find_jvscan]
- verbose "jvscan is $jvscan"
- set main_name [string trim \
- [libjava_prune_warnings \
- [lindex [local_exec "$jvscan --encoding=UTF-8 $srcfile --print-main" "" "" 300] 1]]]
- verbose "main name is $main_name"
- set class_out [string trim \
- [libjava_prune_warnings \
- [lindex [local_exec "$jvscan --encoding=UTF-8 $srcfile --list-class" "" "" 300] 1]]]
- verbose "class list is $class_out"
-
- if {[string match "*parse error*" $main_name]
- || [string match "*parse error*" $class_out]} {
- untested "$errname compilation from bytecode"
- if {! [info exists opts(no-exec)]
- || [info exists opts(need-threads)]} {
- untested "$errname execution from bytecode->native test"
- untested "$errname output from bytecode->native test"
- }
- return
- }
-
- # Turn "a b" into "a.class b.class".
- # Also, turn "foo.bar" into "foo/bar.class".
- set class_files {}
- foreach file [split [string trim $class_out]] {
- set file [join [split $file .] /]
- lappend class_files $objdir/$file.class
- }
-
- eval lappend removeList $class_files
-
- # Usually it is an error for a test program not to have a `main'
- # method. However, for no-exec tests it is ok. Treat no-link
- # like no-exec here.
- if {[info exists opts(no-link)]} {
- set opts(no-exec) x
- }
- set largs {}
-
- if {[info exists opts(no-exec)]} {
- set type object
- set mode compile
- } elseif {$main_name == ""} {
- perror "No `main' given in program $errname"
- return
- } else {
- set type executable
- lappend largs "additional_flags=--main=$main_name"
- # DOS/win32 targets default to .exe if no suffix is given
- # We then try to delete a file that doesn't exist. It is
- # simpler to add the suffix everywhere.
- set executable "${objdir}/${main_name}.exe"
- set mode link
- }
-
- # We purposely ignore errors here; we still want to run the other
- # appropriate tests.
- set gij [libjava_find_gij]
- # libjava_find_gij will return "" if it couldn't find the
- # program; in this case we want to skip the test.
- if {$INTERPRETER == "yes" && $gij != ""} {
- libjava_invoke $errname "gij test" opts $gij \
- $inpfile $resultfile "" $main_name
- }
-
- # Initial arguments.
- set args [libjava_arguments $mode]
- eval lappend args $largs
-
- if { $compile_args != "" } {
- lappend args "additional_flags=$compile_args"
- }
-
- if { $compile_args != "" } {
- set errname "$errname $compile_args"
- }
-
- verbose "compilation command = $args" 2
- # When compiling and not linking, we have to build each .o
- # separately. We do this because DejaGNU's target_compile won't
- # accept an empty "destfile" argument when the mode is "compile".
- if {$mode == "compile"} {
- foreach c_file $class_files {
- set executable [file rootname [file tail $c_file]].o
- # Don't write files which contain $ chars.
- regsub -all "\\$" $executable "\^" executable
- set x [libjava_prune_warnings \
- [libjava_tcompile '$c_file' "$executable" $type $args]]
- lappend removeList $executable
- if {$x != ""} {
- break
- }
- }
- } else {
- # This is so evil: we de-listify CLASS_FILES so that we can
- # turn around and quote the `$' in it for the shell. I really
- # hate DejaGNU. It is so !@#$!@# unpredictable.
- set hack ""
- foreach stupid $class_files {
- set hack "$hack $stupid"
- }
- lappend removeList $executable
- set x [libjava_prune_warnings \
- [libjava_tcompile $hack "$executable" $type $args]]
- }
- if {[info exists opts(xfail-byte)]} {
- setup_xfail *-*-*
- }
- if { $x != "" } {
- verbose "target_compile failed: $x" 2
- fail "$errname compilation from bytecode"
- if {! [info exists opts(no-exec)]
- || [info exists opts(need-threads)]} {
- untested "$errname execution from bytecode->native test"
- untested "$errname output from bytecode->native test"
- }
- return;
- }
- pass "$errname compilation from bytecode"
-
- # Set up the options the way they are expected by libjava_invoke.
- if {[info exists opts(xfail-byte-output)]} {
- set opts(xfail-output) x
- }
- if {[libjava_invoke $errname "bytecode->native test" opts $executable \
- $inpfile $resultfile ""]} {
- # Everything ok, so clean up.
- eval gcj_cleanup $removeList
- }
-}
-
-#
-# Run the test specified by srcfile and resultfile. compile_args and
-# exec_args are options telling this proc how to work.
# `no-link' don't try to link the program
# `no-exec' don't try to run the test
# `xfail-gcj' compilation from source will fail