⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lex.h

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Language lexer definitions for the GNU compiler for the Java(TM) language.   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.   Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe 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,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING.  If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA.Java and all Java-based marks are trademarks or registered trademarksof Sun Microsystems, Inc. in the United States and other countries.The Free Software Foundation is independent of Sun Microsystems, Inc.  */#ifndef JV_LEX_H#define JV_LEX_H#include <setjmp.h>		/* set_float_handler argument uses it *//* Extern global variables declarations  */extern FILE *finput;extern int   lineno;/* A Unicode character, as read from the input file  */typedef unsigned short unicode_t;/* Debug macro to print-out what we match  */#ifdef JAVA_LEX_DEBUG#ifdef JAVA_LEX_DEBUG_CHAR#define JAVA_LEX_CHAR(c)      printf ("java_lex:%d: char '%c'.%d\n", 	\				      lineno, (c < 128 ? c : '.'), c);#else#define JAVA_LEX_CHAR(c)#endif#define JAVA_LEX_KW(c)        printf ("java_lex:%d: keyword: '%s'\n", lineno,c)#define JAVA_LEX_ID(s)        printf ("java_lex:%d: ID: '%s'\n",	\				      lineno,				\				      (all_ascii ? s : "<U>"))#define JAVA_LEX_LIT(s, r)    printf ("java_lex:%d: literal '%s'_%d\n",	\				      lineno, s, r)#define JAVA_LEX_CHAR_LIT(s)  printf ("java_lex:%d: literal '%d'\n", lineno, s)#define JAVA_LEX_STR_LIT(s)   {						 \				 int i;					 \				 printf ("java_lex:%d: literal '%s'\n",  \					 lineno, s);			 \			       }#define JAVA_LEX_SEP(c)       printf ("java_lex:%d: separator '%c'\n",lineno,c)#define JAVA_LEX_OP(c)        printf ("java_lex:%d: operator '%s'\n", lineno,c)#else#define JAVA_LEX_CHAR(c)#define JAVA_LEX_KW(c)#define JAVA_LEX_ID(s)#define JAVA_LEX_LIT(s,r)#define JAVA_LEX_CHAR_LIT(s)#define JAVA_LEX_STR_LIT(s)#define JAVA_LEX_SEP(c)#define JAVA_LEX_OP(s)#endif/* Line information containers  */struct java_line {  unicode_t *line;		/* The line's unicode */  char      *unicode_escape_p;	/* The maching char was a unicode escape */  unicode_t ahead[1];		/* Character ahead */  char unicode_escape_ahead_p;	/* Character ahead is a unicode escape */  int max;			/* buffer's max size */  int size;			/* number of unicodes */  int current;			/* Current position, unicode based */  int char_col;			/* Current position, input char based */  int lineno;			/* Its line number */  int white_space_only;		/* If it contains only white spaces */};#define JAVA_COLUMN_DELTA(p)						\  (ctxp->c_line->unicode_escape_p [ctxp->c_line->current+(p)] ? 6 : 	\   (ctxp->c_line->line [ctxp->c_line->current+(p)] == '\t' ? 8 : 1))struct java_error {  struct java_line *line;  int error;};typedef struct _java_lc {  int line;  int prev_col;  int col;} java_lc;#define JAVA_LINE_MAX 80/* Macro to read and unread bytes */#define UNGETC(c) ungetc(c, finput)#define GETC()    getc(finput)/* Build a location compound integer */#define BUILD_LOCATION() ((ctxp->elc.line << 12) | (ctxp->elc.col & 0xfff))/* Those macros are defined differently if we compile jc1-lite   (JC1_LITE defined) or jc1.  */#ifdef JC1_LITE#define DCONST0 0#define REAL_VALUE_TYPE int#define SET_FLOAT_HANDLER(H)#define GET_IDENTIFIER(S) xstrdup ((S))#define REAL_VALUE_ATOF(LIT,MODE) 0#define REAL_VALUE_ISINF(VALUE)   0#define REAL_VALUE_ISNAN(VALUE)   0#define SET_REAL_VALUE_ATOF(TARGET,SOURCE)#define FLOAT_TYPE_NODE 0#define DOUBLE_TYPE_NODE 0#define SET_MODIFIER_CTX(TOKEN) java_lval->value = (TOKEN)#define GET_TYPE_PRECISION(NODE) 4#define BUILD_OPERATOR(TOKEN)	return TOKEN#define BUILD_OPERATOR2(TOKEN)	return TOKEN#define SET_LVAL_NODE(NODE)#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) {}#elseextern void set_float_handler PROTO((jmp_buf));#define SET_FLOAT_HANDLER(H) set_float_handler ((H))#define DCONST0 dconst0#define GET_IDENTIFIER(S) get_identifier ((S))#define SET_REAL_VALUE_ATOF(TARGET,SOURCE) (TARGET) = (SOURCE)#define FLOAT_TYPE_NODE float_type_node#define DOUBLE_TYPE_NODE double_type_node/* Set modifier_ctx according to TOKEN */#define SET_MODIFIER_CTX(TOKEN)						   \  {									   \    ctxp->modifier_ctx [(TOKEN)-PUBLIC_TK] = build_wfl_node (NULL_TREE); \    java_lval->value = (TOKEN)-PUBLIC_TK;				   \  }/* Type precision for long */#define GET_TYPE_PRECISION(NODE) TYPE_PRECISION (long_type_node) / 8;/* Build an operator tree node and return TOKEN */#define BUILD_OPERATOR(TOKEN)				\  {							\    java_lval->operator.token = (TOKEN);		\    java_lval->operator.location = BUILD_LOCATION();	\    return (TOKEN);					\  }/* Build an operator tree node but return ASSIGN_ANY_TK */#define BUILD_OPERATOR2(TOKEN)				\  {							\    java_lval->operator.token = (TOKEN);		\    java_lval->operator.location = BUILD_LOCATION();	\    return ASSIGN_ANY_TK;				\  }/* Set java_lval->node and TREE_TYPE(java_lval->node) in macros */#define SET_LVAL_NODE(NODE) java_lval->node = (NODE)#define SET_LVAL_NODE_TYPE(NODE,TYPE)		\  {						\    java_lval->node = (NODE);			\    TREE_TYPE (java_lval->node) = (TYPE);	\  }/* Wrap identifier around a wfl */#define BUILD_ID_WFL(EXP) build_wfl_node ((EXP))/* Special ways to report error on numeric literals  */#define JAVA_FLOAT_RANGE_ERROR(m)					  \  {									  \    char msg [1024];							  \    int i = ctxp->c_line->current;					  \    ctxp->c_line->current = number_beginning;				  \    sprintf (msg, "Floating pointer literal exceeds range of `%s'", (m)); \    java_lex_error (msg, 0);						  \    ctxp->c_line->current = i;						  \    value = dconst0;							  \  }#define JAVA_INTEGRAL_RANGE_ERROR(m)		\  {						\    int i = ctxp->c_line->current;		\    ctxp->c_line->current = number_beginning;	\    java_lex_error (m, 0);			\    ctxp->c_line->current = i;			\  }#endif /* Definitions for jc1 compilation only *//* Macros to decode character ranges */#define RANGE(c, l, h)           (((c) >= l && (c) <= h))#define JAVA_WHITE_SPACE_P(c) (c == ' ' || c == '\t' || c == '\f')#define JAVA_ID_CHAR_P(c)     ((c < 128 && (RANGE (c, 'A', 'Z') ||	\					    RANGE (c, 'a', 'z') ||	\					    RANGE (c, '0', '9') ||	\					    c == '_'         ||		\					    c == '$'))       ||		\			       (c > 127 && java_letter_or_digit_p (c)))#define JAVA_ASCII_DIGIT(c)    RANGE(c,'0', '9')#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_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_DIGIT_P(c)							      \   (RANGE (c, 0x030, 0x039) || /* ISO-Latin-1 (and ASCII) digits ('0'-'9') */ \    RANGE (c, 0x660, 0x669) || /* Arabic-Indic digits */		      \    RANGE (c, 0x6F0, 0x6F9) || /* Eastern Arabic-Indic digits */	      \    RANGE (c, 0x966, 0x96F) || /* Devanagari digits */			      \    RANGE (c, 0x9E6, 0x9EF) || /* Bengali digits */			      \    RANGE (c, 0xA66, 0xA6F) || /* Gurmukhi digits */			      \    RANGE (c, 0xAE6, 0xAEF) || /* Gujarati digits */			      \    RANGE (c, 0xB66, 0xB6F) || /* Oriya digits */			      \    RANGE (c, 0xBE7, 0xBEF) || /* Tamil digits */			      \    RANGE (c, 0xC66, 0xC6F) || /* Telugu digits */			      \    RANGE (c, 0xCE6, 0xCEF) || /* Kannada digits */			      \    RANGE (c, 0xD66, 0xD6F) || /* Malayalam digits */			      \    RANGE (c, 0xE50, 0xE59) || /* Thai digits */			      \    RANGE (c, 0xED0, 0xED9))   /* Lao digits *//* This is not to be used as a stand alone macro. Use JAVA_ID_CHAR_P()   or the forcoming JAVA_LETTER_OR_DIGIT_P() instead.   It need to be split by region. FIXME.  */#define _JAVA_LETTER_OR_DIGIT_P(c)		\   (RANGE (c, 0x00C0, 0x00D6) ||		\    RANGE (c, 0x00D8, 0x00F6) ||		\    RANGE (c, 0x00F8, 0x01F5) ||		\    RANGE (c, 0x01FA, 0x0217) ||		\    RANGE (c, 0x0250, 0x02A8) ||		\    RANGE (c, 0x02B0, 0x02DE) ||		\    RANGE (c, 0x02E0, 0x02E9) ||		\    RANGE (c, 0x0300, 0x0345) ||		\    RANGE (c, 0x0360, 0x0361) ||		\    RANGE (c, 0x0374, 0x0375) ||		\    c == 0x037A            ||			\    c == 0x037E            ||			\    RANGE (c, 0x0384, 0x038A) ||		\    c == 0x038C            ||			\    c == 0x038E            ||			\    RANGE (c, 0x038F, 0x03A1) ||		\    RANGE (c, 0x03A3, 0x03CE) ||		\    RANGE (c, 0x03D0, 0x03D6) ||		\    RANGE (c, 0x03DA, 0x03E2) ||		\

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -