Commit f8976021 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

java-tree.def (NEW_ARRAY_INIT): New Java tree code.

Wed Dec  9 15:37:05 1998  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* java-tree.def (NEW_ARRAY_INIT): New Java tree code.
	* lex.c (java_lex): Remember column position before advancing one
 	token. Retain location information on OCB_TK.
	* lex.h (typedef struct java_lc): Added new field.
	* parse.h (GET_SKIP_TYPE): New macro.
	(QUAL_DECL_TYPE): Redefined using GET_SKIP_TYPE.
	* parse.y (build_new_array_init, patch_new_array_init,
 	patch_array_constructor, maybe_build_array_element_wfl,
 	array_constructor_check_entry): New function prototypes.
	(switch_block:): Tagged <node>.
	(OCB_TK): Tagged <operator>.
	(array_initializer:): Installed actions.
	(variable_initializer): Build location information on element if
 	necessary.
	(switch_statement:): Fixed indentation typo.
	(switch_block:): Redefined default action.
	(java_complete_tree): Handle NEW_ARRAY_INIT in MODIFY_EXPR:.
	(patch_assignment): Removed duplicate code.
	(maybe_build_array_element_wfl, build_new_array_init,
 	patch_new_array_init, patch_array_constructor,
 	array_constructor_check_entry): New functions.
Parse and walk array initializer nodes.

From-SVN: r24224
parent 996d0685
Wed Dec 9 15:37:05 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
* java-tree.def (NEW_ARRAY_INIT): New Java tree code.
* lex.c (java_lex): Remember column position before advancing one
token. Retain location information on OCB_TK.
* lex.h (typedef struct java_lc): Added new field.
* parse.h (GET_SKIP_TYPE): New macro.
(QUAL_DECL_TYPE): Redefined using GET_SKIP_TYPE.
* parse.y (build_new_array_init, patch_new_array_init,
patch_array_constructor, maybe_build_array_element_wfl,
array_constructor_check_entry): New function prototypes.
(switch_block:): Tagged <node>.
(OCB_TK): Tagged <operator>.
(array_initializer:): Installed actions.
(variable_initializer): Build location information on element if
necessary.
(switch_statement:): Fixed indentation typo.
(switch_block:): Redefined default action.
(java_complete_tree): Handle NEW_ARRAY_INIT in MODIFY_EXPR:.
(patch_assignment): Removed duplicate code.
(maybe_build_array_element_wfl, build_new_array_init,
patch_new_array_init, patch_array_constructor,
array_constructor_check_entry): New functions.
Mon Dec 7 15:13:52 1998 Alexandre Petit-Bianco <apbianco@cygnus.com> Mon Dec 7 15:13:52 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (array_initializer): Tagged <node>. * parse.y (array_initializer): Tagged <node>.
......
...@@ -76,4 +76,8 @@ DEFTREECODE (CONDITIONAL_EXPR, "?:", 'e', 3) ...@@ -76,4 +76,8 @@ DEFTREECODE (CONDITIONAL_EXPR, "?:", 'e', 3)
Operand 1 is the class used for the test. */ Operand 1 is the class used for the test. */
DEFTREECODE (INSTANCEOF_EXPR, "instanceof", 'e', 2) DEFTREECODE (INSTANCEOF_EXPR, "instanceof", 'e', 2)
/* Array initializers.
Operand 0 is the (sub) array target to initialize, left to NULL_TREE
when the node is created.
Operand 1 is a CONSTRUCTOR node. */
DEFTREECODE (NEW_ARRAY_INIT, "new_array_init", '1', 1)
...@@ -567,6 +567,7 @@ java_lex (java_lval) ...@@ -567,6 +567,7 @@ java_lex (java_lval)
} }
ctxp->elc.line = ctxp->c_line->lineno; ctxp->elc.line = ctxp->c_line->lineno;
ctxp->elc.prev_col = ctxp->elc.col;
ctxp->elc.col = ctxp->c_line->char_col - JAVA_COLUMN_DELTA (-1); ctxp->elc.col = ctxp->c_line->char_col - JAVA_COLUMN_DELTA (-1);
if (ctxp->elc.col < 0) if (ctxp->elc.col < 0)
fatal ("ctxp->elc.col < 0 - java_lex"); fatal ("ctxp->elc.col < 0 - java_lex");
...@@ -924,7 +925,7 @@ java_lex (java_lval) ...@@ -924,7 +925,7 @@ java_lex (java_lval)
if (ctxp->ccb_indent == 1) if (ctxp->ccb_indent == 1)
ctxp->first_ccb_indent1 = lineno; ctxp->first_ccb_indent1 = lineno;
ctxp->ccb_indent++; ctxp->ccb_indent++;
return OCB_TK; BUILD_OPERATOR (OCB_TK);
case '}': case '}':
JAVA_LEX_SEP (c); JAVA_LEX_SEP (c);
ctxp->ccb_indent--; ctxp->ccb_indent--;
......
...@@ -92,6 +92,7 @@ struct java_error { ...@@ -92,6 +92,7 @@ struct java_error {
typedef struct _java_lc { typedef struct _java_lc {
int line; int line;
int prev_col;
int col; int col;
} java_lc; } java_lc;
......
...@@ -482,9 +482,11 @@ static jdeplist *reverse_jdep_list (); ...@@ -482,9 +482,11 @@ static jdeplist *reverse_jdep_list ();
#define EXPR_WFL_QUALIFICATION(WFL) TREE_OPERAND ((WFL), 1) #define EXPR_WFL_QUALIFICATION(WFL) TREE_OPERAND ((WFL), 1)
#define QUAL_WFL(NODE) TREE_PURPOSE (NODE) #define QUAL_WFL(NODE) TREE_PURPOSE (NODE)
#define QUAL_RESOLUTION(NODE) TREE_VALUE (NODE) #define QUAL_RESOLUTION(NODE) TREE_VALUE (NODE)
#define QUAL_DECL_TYPE(NODE) \ #define QUAL_DECL_TYPE(NODE) GET_SKIP_TYPE (NODE)
#define GET_SKIP_TYPE(NODE) \
(TREE_CODE (TREE_TYPE (NODE)) == POINTER_TYPE ? \ (TREE_CODE (TREE_TYPE (NODE)) == POINTER_TYPE ? \
TREE_TYPE (TREE_TYPE (NODE)) : TREE_TYPE (NODE)) TREE_TYPE (TREE_TYPE (NODE)): TREE_TYPE (NODE))
/* Handy macros for the walk operation */ /* Handy macros for the walk operation */
#define COMPLETE_CHECK_OP(NODE, N) \ #define COMPLETE_CHECK_OP(NODE, N) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment