/* Parser for GNU CHILL (CCITT High-Level Language) -*- C -*-
- Copyright (C) 1992, 1993, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GNU CC.
/* Since parsers are distinct for each language, put the
language string definition here. (fnf) */
-char *language_string = "GNU CHILL";
+const char * const language_string = "GNU CHILL";
/* Common code to be done before expanding any action. */
#define INIT_ACTION { \
/* Cause the `yydebug' variable to be defined. */
#define YYDEBUG 1
-extern struct rtx_def* gen_label_rtx PROTO((void));
-extern void emit_jump PROTO((struct rtx_def *));
-extern struct rtx_def* emit_label PROTO((struct rtx_def *));
+extern struct rtx_def* gen_label_rtx PARAMS ((void));
+extern void emit_jump PARAMS ((struct rtx_def *));
+extern struct rtx_def* emit_label PARAMS ((struct rtx_def *));
/* This is a hell of a lot easier than getting expr.h included in
by parse.c. */
-extern struct rtx_def *expand_expr PROTO((tree, struct rtx_def *,
+extern struct rtx_def *expand_expr PARAMS ((tree, struct rtx_def *,
enum machine_mode, int));
-static int parse_action PROTO((void));
+static int parse_action PARAMS ((void));
+static void ch_parse_init PARAMS ((void));
+static void check_end_label PARAMS ((tree, tree));
+static void end_function PARAMS ((void));
+static tree build_prefix_clause PARAMS ((tree));
+static enum terminal PEEK_TOKEN PARAMS ((void));
+static int peek_token_ PARAMS ((int));
+static void pushback_token PARAMS ((int, tree));
+static void forward_token_ PARAMS ((void));
+static void require PARAMS ((enum terminal));
+static int check_token PARAMS ((enum terminal));
+static int expect PARAMS ((enum terminal, const char *));
+static void define__PROCNAME__ PARAMS ((void));
extern int lineno;
-extern char *input_filename;
extern tree generic_signal_type_node;
extern tree signal_code;
extern int all_static_flag;
if (result_never_set
&& TREE_CODE (TREE_TYPE (TREE_TYPE (current_function_decl)))
!= VOID_TYPE)
- warning ("No RETURN or RESULT in procedure");
+ warning ("no RETURN or RESULT in procedure");
chill_expand_return (NULL_TREE, 1);
}
}
if (!id)
{
if (current_module && current_module->name)
- { char *module_name = IDENTIFIER_POINTER (current_module->name);
+ { const char *module_name = IDENTIFIER_POINTER (current_module->name);
if (module_name[0] && module_name[0] != '_')
return current_module->name;
}
return terminal_buffer[0];
}
#define PEEK_TREE() val_buffer[0].ttype
-#define PEEK_TOKEN1() peek_token_(1)
-#define PEEK_TOKEN2() peek_token_(2)
+#define PEEK_TOKEN1() peek_token_ (1)
+#define PEEK_TOKEN2() peek_token_ (2)
+
static int
peek_token_ (i)
int i;
{
if (i > MAX_LOOK_AHEAD)
- fatal ("internal error - too much lookahead");
+ abort ();
if (terminal_buffer[i] == TOKEN_NOT_READ)
{
terminal_buffer[i] = yylex();
{
int i;
if (terminal_buffer[MAX_LOOK_AHEAD] != TOKEN_NOT_READ)
- fatal ("internal error - cannot pushback token");
+ abort ();
for (i = MAX_LOOK_AHEAD; i > 0; i--)
{
terminal_buffer[i] = terminal_buffer[i - 1];
}
terminal_buffer[MAX_LOOK_AHEAD] = TOKEN_NOT_READ;
}
-#define FORWARD_TOKEN() forward_token_()
+#define FORWARD_TOKEN() forward_token_ ()
/* Skip the next token.
if it isn't TOKEN, the parser is broken. */
-void
-require(token)
+static void
+require (token)
enum terminal token;
{
if (PEEK_TOKEN() != token)
- {
- char buf[80];
- sprintf (buf, "internal parser error - expected token %d", (int)token);
- fatal(buf);
- }
+ internal_error ("internal parser error - expected token %d", (int) token);
FORWARD_TOKEN();
}
-int
+static int
check_token (token)
enum terminal token;
{
/* return 0 if expected token was not found,
else return 1.
*/
-int
+static int
expect(token, message)
enum terminal token;
- char *message;
+ const char *message;
{
if (PEEK_TOKEN() != token)
{
if (pass == 1)
- error(message ? message : "syntax error");
+ error("%s", message ? message : "syntax error");
return 0;
}
else
static void
define__PROCNAME__ ()
{
- char *fname;
+ const char *fname;
tree string;
tree procname;
}
/* Forward declarations. */
-static tree parse_expression ();
-static tree parse_primval ();
-static tree parse_mode PROTO((void));
-static tree parse_opt_mode PROTO((void));
-static tree parse_untyped_expr ();
-static tree parse_opt_untyped_expr ();
-static int parse_definition PROTO((int));
-static void parse_opt_actions ();
-static void parse_body PROTO((void));
-static tree parse_if_expression_body PROTO((void));
-static tree parse_opt_handler PROTO((void));
+static tree parse_expression PARAMS ((void));
+static tree parse_primval PARAMS ((void));
+static tree parse_mode PARAMS ((void));
+static tree parse_opt_mode PARAMS ((void));
+static tree parse_untyped_expr PARAMS ((void));
+static tree parse_opt_untyped_expr PARAMS ((void));
+static int parse_definition PARAMS ((int));
+static void parse_opt_actions PARAMS ((void));
+static void parse_body PARAMS ((void));
+static tree parse_if_expression_body PARAMS ((void));
+static tree parse_opt_handler PARAMS ((void));
+static tree parse_opt_name_string PARAMS ((int));
+static tree parse_simple_name_string PARAMS ((void));
+static tree parse_name_string PARAMS ((void));
+static tree parse_defining_occurrence PARAMS ((void));
+static tree parse_name PARAMS ((void));
+static tree parse_optlabel PARAMS ((void));
+static void parse_opt_end_label_semi_colon PARAMS ((tree));
+static void parse_modulion PARAMS ((tree));
+static void parse_spec_module PARAMS ((tree));
+static void parse_semi_colon PARAMS ((void));
+static tree parse_defining_occurrence_list PARAMS ((void));
+static void parse_mode_definition PARAMS ((int));
+static void parse_mode_definition_statement PARAMS ((int));
+static void parse_synonym_definition PARAMS ((void));
+static void parse_synonym_definition_statement PARAMS ((void));
+static tree parse_on_exception_list PARAMS ((void));
+static void parse_on_alternatives PARAMS ((void));
+static void parse_loc_declaration PARAMS ((int));
+static void parse_declaration_statement PARAMS ((int));
+static tree parse_optforbid PARAMS ((void));
+static tree parse_postfix PARAMS ((enum terminal));
+static tree parse_postfix_list PARAMS ((enum terminal));
+static void parse_rename_clauses PARAMS ((enum terminal));
+static tree parse_opt_prefix_clause PARAMS ((void));
+static void parse_grant_statement PARAMS ((void));
+static void parse_seize_statement PARAMS ((void));
+static tree parse_param_name_list PARAMS ((void));
+static tree parse_param_attr PARAMS ((void));
+static tree parse_formpar PARAMS ((void));
+static tree parse_formparlist PARAMS ((void));
+static tree parse_opt_result_spec PARAMS ((void));
+static tree parse_opt_except PARAMS ((void));
+static tree parse_opt_recursive PARAMS ((void));
+static tree parse_procedureattr PARAMS ((void));
+static void parse_proc_body PARAMS ((tree, tree));
+static void parse_procedure_definition PARAMS ((int));
+static tree parse_processpar PARAMS ((void));
+static tree parse_processparlist PARAMS ((void));
+static void parse_process_definition PARAMS ((int));
+static void parse_signal_definition PARAMS ((void));
+static void parse_signal_definition_statement PARAMS ((void));
+static void parse_then_clause PARAMS ((void));
+static void parse_opt_else_clause PARAMS ((void));
+static tree parse_expr_list PARAMS ((void));
+static tree parse_range_list_clause PARAMS ((void));
+static void pushback_paren_expr PARAMS ((tree));
+static tree parse_case_label PARAMS ((void));
+static tree parse_case_label_list PARAMS ((tree, int));
+static tree parse_case_label_specification PARAMS ((tree));
+static void parse_single_dimension_case_action PARAMS ((tree));
+static void parse_multi_dimension_case_action PARAMS ((tree));
+static void parse_case_action PARAMS ((tree));
+static tree parse_asm_operands PARAMS ((void));
+static tree parse_asm_clobbers PARAMS ((void));
+static void ch_expand_asm_operands PARAMS ((tree, tree, tree, tree,
+ int, const char *, int));
+static void parse_asm_action PARAMS ((void));
+static void parse_begin_end_block PARAMS ((tree));
+static void parse_if_action PARAMS ((tree));
+static void parse_iteration PARAMS ((void));
+static tree parse_delay_case_event_list PARAMS ((void));
+static void parse_delay_case_action PARAMS ((tree));
+static void parse_do_action PARAMS ((tree));
+static tree parse_receive_spec PARAMS ((void));
+static void parse_receive_case_action PARAMS ((tree));
+static void parse_send_action PARAMS ((void));
+static void parse_start_action PARAMS ((void));
+static tree parse_call PARAMS ((tree));
+static tree parse_tuple_fieldname_list PARAMS ((void));
+static tree parse_tuple_element PARAMS ((void));
+static tree parse_opt_element_list PARAMS ((void));
+static tree parse_tuple PARAMS ((tree));
+static tree parse_operand6 PARAMS ((void));
+static tree parse_operand5 PARAMS ((void));
+static tree parse_operand4 PARAMS ((void));
+static tree parse_operand3 PARAMS ((void));
+static tree parse_operand2 PARAMS ((void));
+static tree parse_operand1 PARAMS ((void));
+static tree parse_operand0 PARAMS ((void));
+static tree parse_case_expression PARAMS ((void));
+static tree parse_then_alternative PARAMS ((void));
+static tree parse_else_alternative PARAMS ((void));
+static tree parse_if_expression PARAMS ((void));
+static tree parse_index_mode PARAMS ((void));
+static tree parse_set_mode PARAMS ((void));
+static tree parse_pos PARAMS ((void));
+static tree parse_step PARAMS ((void));
+static tree parse_opt_layout PARAMS ((int));
+static tree parse_field_name_list PARAMS ((void));
+static tree parse_fixed_field PARAMS ((void));
+static tree parse_variant_field_list PARAMS ((void));
+static tree parse_variant_alternative PARAMS ((void));
+static tree parse_field PARAMS ((void));
+static tree parse_structure_mode PARAMS ((void));
+static tree parse_opt_queue_size PARAMS ((void));
+static tree parse_procedure_mode PARAMS ((void));
+static void parse_program PARAMS ((void));
+static void parse_pass_1_2 PARAMS ((void));
static tree
parse_opt_name_string (allow_all)
ignoring = save_ignoring;
}
-void
+static void
parse_mode_definition_statement (is_newmode)
int is_newmode;
{
ignoring = save_ignoring;
}
if (init_value == NULL_TREE && loc_decl && pass == 1)
- error ("loc-identity declaration without initialisation");
+ error ("loc-identity declaration without initialization");
do_decls (names, mode,
is_static || global_bindings_p ()
/* the variable becomes STATIC if all_static_flag is set and
parse_semi_colon ();
}
-tree
+static tree
parse_optforbid ()
{
if (check_token (FORBID) == 0)
/* Matches: <grant postfix> or <seize postfix>
Returns: A (singleton) TREE_LIST. */
-tree
+static tree
parse_postfix (grant_or_seize)
enum terminal grant_or_seize;
{
return build_tree_list (forbid, name);
}
-tree
+static tree
parse_postfix_list (grant_or_seize)
enum terminal grant_or_seize;
{
return list;
}
-void
+static void
parse_rename_clauses (grant_or_seize)
enum terminal grant_or_seize;
{
return build_prefix_clause (parse_opt_name_string (0));
}
-void
+static void
parse_grant_statement ()
{
require (GRANT);
}
}
-void
+static void
parse_seize_statement ()
{
require (SEIZE);
ignoring = 0;
require (COLON); require (PROCESS);
expect (LPRN, "missing '(' after PROCESS");
- params = parse_processparlist (in_spec_module);
+ params = parse_processparlist ();
expect (RPRN, "missing ')' in PROCESS");
ignoring = save_ignoring;
if (in_spec_module)
return NULL_TREE;
while (check_token (COMMA))
{
- name = parse_name_string (0);
+ name = parse_name_string ();
}
if (check_token (SC))
{
tree action_labels = NULL_TREE;
tree tests = NULL_TREE;
int save_lineno = lineno;
- char *save_filename = input_filename;
+ const char *save_filename = input_filename;
/* We can't compute the range of an (ELSE) label until all of the CASE
label specifications have been seen, however, the code for the actions
return list;
}
-void
+static void
ch_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
tree string, outputs, inputs, clobbers;
int vol;
- char *filename;
+ const char *filename;
int line;
{
int noutputs = list_length (outputs);
{
push_handler ();
parse_opt_actions ();
- expect (OD, "Missing 'OD' after 'DO'");
+ expect (OD, "missing 'OD' after 'DO'");
parse_opt_handler ();
parse_opt_end_label_semi_colon (label);
return;
parse_opt_actions ();
if (! ignoring)
build_loop_end ();
- expect (OD, "Missing 'OD' after 'DO'");
+ expect (OD, "missing 'OD' after 'DO'");
/* Note that the handler is inside the reach of the DO. */
parse_opt_handler ();
end_loop_scope (label);
no_handler_action:
if (parse_opt_handler () != NULL_TREE && pass == 1)
- error ("no handler is permitted on this action.");
+ error ("no handler is permitted on this action");
parse_semi_colon ();
return 1;
finish_outer_function ();
}
-void
+static void
parse_pass_1_2()
{
parse_program();
#if YYDEBUG != 0
yydebug = value;
#else
- warning ("YYDEBUG not defined.");
+ warning ("YYDEBUG not defined");
#endif
}
#endif