/* Language lexer definitions for the GNU compiler for the Java(TM) language.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+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.
-GNU CC is distributed in the hope that it will be useful,
+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 GNU CC; see the file COPYING. If not, write to
+along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
#ifndef GCC_JAVA_LEX_H
#define GCC_JAVA_LEX_H
+#include "input.h"
+
/* Extern global variables declarations */
extern FILE *finput;
-extern int lineno;
/* A Unicode character, as read from the input file */
typedef unsigned short unicode_t;
int error;
};
-typedef struct _java_lc {
+typedef struct java_lc_s GTY(()) {
int line;
int prev_col;
int col;
} java_lc;
-typedef struct java_lexer
+struct java_lexer
{
/* The file from which we're reading. */
FILE *finput;
int out_last;
#endif /* HAVE_ICONV */
-} java_lexer;
+};
+typedef struct java_lexer java_lexer;
/* Destroy a lexer object. */
-extern void java_destroy_lexer PARAMS ((java_lexer *));
+extern void java_destroy_lexer (java_lexer *);
#define JAVA_LINE_MAX 80
#define SET_LVAL_NODE_TYPE(NODE, TYPE)
#define BUILD_ID_WFL(EXP) (EXP)
#define JAVA_FLOAT_RANGE_ERROR(S) {}
-#define JAVA_INTEGRAL_RANGE_ERROR(S) {}
+#define JAVA_INTEGRAL_RANGE_ERROR(S) do { } while (0)
#else
ctxp->c_line->current = i; \
}
#define JAVA_INTEGRAL_RANGE_ERROR(m) \
- { \
+ do { \
int i = ctxp->c_line->current; \
ctxp->c_line->current = number_beginning; \
java_lex_error (m, 0); \
ctxp->c_line->current = i; \
- }
+ } while (0)
#endif /* Definitions for jc1 compilation only */
#define RANGE(c, l, h) (((c) >= l && (c) <= h))
#define JAVA_WHITE_SPACE_P(c) (c == ' ' || c == '\t' || c == '\f')
#define JAVA_START_CHAR_P(c) ((c < 128 \
- && (RANGE (c, 'A', 'Z') \
- || RANGE (c, 'a', 'z') \
- || c == '_' \
- || c == '$')) \
+ && (ISIDST (c) || c == '$')) \
|| (c >= 128 && java_start_char_p (c)))
#define JAVA_PART_CHAR_P(c) ((c < 128 \
- && (RANGE (c, 'A', 'Z') \
- || RANGE (c, 'a', 'z') \
- || RANGE (c, '0', '9') \
- || c == '_' \
+ && (ISIDNUM (c) \
|| c == '$' \
|| c == 0x0000 \
|| RANGE (c, 0x01, 0x08) \
|| RANGE (c, 0x0e, 0x1b) \
|| c == 0x7f)) \
|| (c >= 128 && java_part_char_p (c)))
-#define JAVA_ASCII_DIGIT(c) RANGE (c, '0', '9')
+#define JAVA_ASCII_DIGIT(c) ISDIGIT (c)
#define JAVA_ASCII_OCTDIGIT(c) RANGE (c, '0', '7')
-#define JAVA_ASCII_HEXDIGIT(c) (RANGE (c, '0', '9') || \
- RANGE (c, 'a', 'f') || \
- RANGE (c, 'A', 'F'))
+#define JAVA_ASCII_HEXDIGIT(c) ISXDIGIT (c)
#define JAVA_ASCII_FPCHAR(c) (RANGE (c, 'd', 'f') || RANGE (c, 'D', 'F') || \
c == '.' || JAVA_ASCII_DIGIT (c))
#define JAVA_FP_SUFFIX(c) (c == 'D' || c == 'd' || c == 'f' || c == 'F')
#define JAVA_FP_EXP(c) (c == 'E' || c == 'F')
#define JAVA_FP_PM(c) (c == '-' || c == '+')
-#define JAVA_ASCII_LETTER(c) (RANGE (c, 'a', 'z') || RANGE (c, 'A', 'Z'))
+#define JAVA_ASCII_LETTER(c) ISALPHA (c)
/* Constants */
#define JAVA_READ_BUFFER 256