-/* C code produced by gperf version 2.7.2 */
-/* Command-line: gperf -L C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k'1,4,$' keyword.gperf */
+/* C code produced by gperf version 2.7 */
+/* Command-line: gperf -L C -C -F , 0 -p -t -j1 -i 1 -g -o -N java_keyword -k1,4,$ keyword.gperf */
/* Keyword definition for the GNU compiler for the Java(TM) language.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
#endif
const struct java_keyword *java_keyword PARAMS ((const char *, unsigned int));
-#define TOTAL_KEYWORDS 51
+#define TOTAL_KEYWORDS 52
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 12
#define MIN_HASH_VALUE 7
-#define MAX_HASH_VALUE 95
-/* maximum key range = 89, duplicates = 0 */
+#define MAX_HASH_VALUE 85
+/* maximum key range = 79, duplicates = 0 */
#ifdef __GNUC__
__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
#endif
static unsigned int
hash (str, len)
{
static const unsigned char asso_values[] =
{
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 9, 17, 3,
- 1, 1, 20, 13, 15, 29, 96, 21, 1, 96,
- 35, 39, 1, 96, 15, 6, 2, 1, 41, 17,
- 96, 7, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 96, 96
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 1, 34, 3,
+ 1, 1, 18, 7, 21, 28, 86, 14, 1, 86,
+ 18, 20, 37, 86, 15, 6, 2, 5, 40, 36,
+ 86, 36, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86
};
register int hval = len;
{
static const struct java_keyword wordlist[] =
{
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0},
+ {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
{"else", ELSE_TK},
{"true", TRUE_TK},
{"case", CASE_TK},
+ {"assert", ASSERT_TK},
+ {"default", DEFAULT_TK},
{"", 0},
- {"public", PUBLIC_TK},
- {"try", TRY_TK},
- {"protected", PROTECTED_TK},
+ {"abstract", ABSTRACT_TK},
{"continue", CONTINUE_TK},
{"extends", EXTENDS_TK},
{"const", CONST_TK},
{"static", STATIC_TK},
{"this", THIS_TK},
- {"default", DEFAULT_TK},
+ {"long", LONG_TK},
{"class", CLASS_TK},
- {"abstract", ABSTRACT_TK},
+ {"", 0},
{"synchronized", SYNCHRONIZED_TK},
- {"byte", BYTE_TK},
- {"while", WHILE_TK},
- {"double", DOUBLE_TK},
- {"catch", CATCH_TK},
+ {"do", DO_TK},
+ {"null", NULL_TK},
+ {"final", FINAL_TK},
+ {"float", FLOAT_TK},
{"super", SUPER_TK},
{"short", SHORT_TK},
- {"switch", SWITCH_TK},
- {"package", PACKAGE_TK},
- {"long", LONG_TK},
- {"false", FALSE_TK},
{"", 0},
+ {"false", FALSE_TK},
+ {"transient", TRANSIENT_TK},
+ {"catch", CATCH_TK},
{"int", INT_TK},
- {"final", FINAL_TK},
- {"float", FLOAT_TK},
- {"char", CHAR_TK},
+ {"throws", THROWS_TK},
+ {"switch", SWITCH_TK},
{"for", FOR_TK},
+ {"char", CHAR_TK},
{"", 0},
{"interface", INTERFACE_TK},
- {"null", NULL_TK},
- {"do", DO_TK},
- {"finally", FINALLY_TK},
- {"strictfp", STRICT_TK},
- {"", 0},
+ {"byte", BYTE_TK},
+ {"try", TRY_TK},
+ {"double", DOUBLE_TK},
+ {"while", WHILE_TK},
+ {"return", RETURN_TK},
{"implements", IMPLEMENTS_TK},
{"void", VOID_TK},
- {"transient", TRANSIENT_TK},
- {"", 0},
- {"private", PRIVATE_TK},
+ {"public", PUBLIC_TK},
{"if", IF_TK},
+ {"protected", PROTECTED_TK},
+ {"volatile", VOLATILE_TK},
+ {"goto", GOTO_TK},
+ {"", 0},
+ {"native", NATIVE_TK},
{"break", BREAK_TK},
- {"throws", THROWS_TK},
{"", 0},
+ {"import", IMPORT_TK},
{"new", NEW_TK},
- {"", 0},
- {"return", RETURN_TK},
- {"", 0},
- {"volatile", VOLATILE_TK},
- {"boolean", BOOLEAN_TK},
{"instanceof", INSTANCEOF_TK},
+ {"package", PACKAGE_TK},
+ {"boolean", BOOLEAN_TK},
{"", 0},
+ {"finally", FINALLY_TK},
{"throw", THROW_TK},
+ {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
{"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0},
- {"native", NATIVE_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"import", IMPORT_TK},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
- {"goto", GOTO_TK}
+ {"strictfp", STRICT_TK},
+ {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
+ {"private", PRIVATE_TK}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
static tree patch_string_cst PARAMS ((tree));
static tree patch_string PARAMS ((tree));
static tree encapsulate_with_try_catch PARAMS ((int, tree, tree, tree));
+static tree build_assertion PARAMS ((int, tree, tree));
static tree build_try_statement PARAMS ((int, tree, tree));
static tree build_try_finally_statement PARAMS ((int, tree, tree));
static tree patch_try_statement PARAMS ((tree));
%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
left_hand_side assignment for_header for_begin
constant_expression do_statement_begin empty_statement
switch_statement synchronized_statement throw_statement
- try_statement switch_expression switch_block
+ try_statement assert_statement
+ switch_expression switch_block
catches catch_clause catch_clause_parameter finally
anonymous_class_creation trap_overflow_corner_case
%type <node> return_statement break_statement continue_statement
-%type <operator> ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
+%type <operator> ASSIGN_TK MULT_ASSIGN_TK DIV_ASSIGN_TK
%type <operator> REM_ASSIGN_TK PLUS_ASSIGN_TK MINUS_ASSIGN_TK
%type <operator> LS_ASSIGN_TK SRS_ASSIGN_TK ZRS_ASSIGN_TK
%type <operator> AND_ASSIGN_TK XOR_ASSIGN_TK OR_ASSIGN_TK
%token <operator> OP_TK OSB_TK DOT_TK THROW_TK INSTANCEOF_TK
%type <operator> THIS_TK SUPER_TK RETURN_TK BREAK_TK CONTINUE_TK
%type <operator> CASE_TK DEFAULT_TK TRY_TK CATCH_TK SYNCHRONIZED_TK
-%type <operator> NEW_TK
+%type <operator> NEW_TK ASSERT_TK
%type <node> method_body
| synchronized_statement
| throw_statement
| try_statement
+| assert_statement
;
empty_statement:
{yyerror ("';' expected"); RECOVER;}
;
+assert_statement:
+ ASSERT_TK expression REL_CL_TK expression SC_TK
+ {
+ $$ = build_assertion ($1.location, $2, $4);
+ }
+| ASSERT_TK expression SC_TK
+ {
+ $$ = build_assertion ($1.location, $2, NULL_TREE);
+ }
+| ASSERT_TK error
+ {yyerror ("Missing term"); RECOVER;}
+| ASSERT_TK expression error
+ {yyerror ("';' expected"); RECOVER;}
+;
+
synchronized_statement:
synchronized OP_TK expression CP_TK block
{
return node;
}
+/* Assertions. */
+
+/* Build an assertion expression for `assert CONDITION : VALUE'; VALUE
+ might be NULL_TREE. */
+static tree
+build_assertion (location, condition, value)
+ int location;
+ tree condition, value;
+{
+ tree node;
+ tree klass = GET_CPC ();
+
+ if (! CLASS_USES_ASSERTIONS (klass))
+ {
+ tree field, classdollar, id, call;
+ tree class_type = TREE_TYPE (klass);
+
+ field = add_field (class_type,
+ get_identifier ("$assertionsDisabled"),
+ boolean_type_node,
+ ACC_PRIVATE | ACC_STATIC | ACC_FINAL);
+ MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field);
+ FIELD_SYNTHETIC (field) = 1;
+
+ if (!TYPE_DOT_CLASS (class_type))
+ build_dot_class_method (class_type);
+ classdollar = build_dot_class_method_invocation (class_type);
+
+ /* Call CLASS.desiredAssertionStatus(). */
+ id = build_wfl_node (get_identifier ("desiredAssertionStatus"));
+ call = build (CALL_EXPR, NULL_TREE, id, NULL_TREE, NULL_TREE);
+ call = make_qualified_primary (classdollar, call, location);
+ TREE_SIDE_EFFECTS (call) = 1;
+ DECL_INITIAL (field) = call;
+
+ /* Record the initializer in the initializer statement list. */
+ call = build (MODIFY_EXPR, NULL_TREE, field, call);
+ TREE_CHAIN (call) = CPC_STATIC_INITIALIZER_STMT (ctxp);
+ SET_CPC_STATIC_INITIALIZER_STMT (ctxp, call);
+ MODIFY_EXPR_FROM_INITIALIZATION_P (call) = 1;
+
+ CLASS_USES_ASSERTIONS (klass) = 1;
+ }
+
+ if (value != NULL_TREE)
+ value = tree_cons (NULL_TREE, value, NULL_TREE);
+
+ node = build_wfl_node (get_identifier ("java"));
+ node = make_qualified_name (node, build_wfl_node (get_identifier ("lang")),
+ location);
+ node = make_qualified_name (node, build_wfl_node (get_identifier ("AssertionError")),
+ location);
+
+ node = build (NEW_CLASS_EXPR, NULL_TREE, node, value, NULL_TREE);
+ TREE_SIDE_EFFECTS (node) = 1;
+ /* It is too early to use BUILD_THROW. */
+ node = build1 (THROW_EXPR, NULL_TREE, node);
+ TREE_SIDE_EFFECTS (node) = 1;
+
+ /* We invert the condition; if we just put NODE as the `else' part
+ then we generate weird-looking bytecode. */
+ condition = build1 (TRUTH_NOT_EXPR, NULL_TREE, condition);
+ /* Check $assertionsDisabled. */
+ condition
+ = build (TRUTH_ANDIF_EXPR, NULL_TREE,
+ build1 (TRUTH_NOT_EXPR, NULL_TREE,
+ build_wfl_node (get_identifier ("$assertionsDisabled"))),
+ condition);
+ node = build_if_else_statement (location, condition, node, NULL_TREE);
+ return node;
+}
+
/* 14.18 The try/catch statements */
/* Encapsulate TRY_STMTS' in a try catch sequence. The catch clause