Ejemplo n.º 1
0
void output(void)
{
    const_array = jflag ? "private final static " : "";
    free_itemsets();
    free_shifts();
    free_reductions();
    output_prefix();
    output_stored_text();
    output_defines();
    output_rule_data();
    output_yydefred();
    output_actions();
    free_parser();
    output_debug();
    if (!jflag) {
	output_stype();
	if (rflag) write_section(tables);
	write_section(header);
	output_trailing_text();
    }
    write_section(jflag ? jbody : body);
    output_semantic_actions();
    write_section(jflag ? jtrailer : trailer);
    if (jflag)
	output_trailing_text();
}
Ejemplo n.º 2
0
Archivo: output.c Proyecto: npe9/sprite
output()
{
  int c;

  /* output_token_defines(ftable);	/* JF put out token defines FIRST */
  if (!semantic_parser)		/* JF Put out other stuff */
    {
      rewind(fattrs);
      while ((c=getc(fattrs))!=EOF)
        putc(c,ftable);
    }

  if (debugflag)
    fprintf(ftable, "#define YYDEBUG\n");

  if (semantic_parser)
    fprintf(ftable, "#include \"%s\"\n", attrsfile);
  fprintf(ftable, "#include <stdio.h>\n\n");

  /* Make "const" do nothing if not in ANSI C.  */
  fprintf (ftable, "#ifndef __STDC__\n#define const\n#endif\n\n");

  free_itemsets();
  output_defines();
  output_token_translations();
  if (semantic_parser)
    output_gram();
  FREE(ritem);
  if (semantic_parser)
    output_stos();
  output_rule_data();
  output_actions();
  output_parser();
  output_program();
}
Ejemplo n.º 3
0
Archivo: output.c Proyecto: ombt/ombt
void output(void)
{
    free_itemsets();
    free_shifts();
    free_reductions();
    output_stored_text();
    if (jflag)    /*rwj*/
      {
      write_section(jheader);
      output_stype();
      }
    output_defines();
    output_rule_data();
    output_yydefred();
    output_actions();
    free_parser();
    output_debug();
    if (!jflag)    /*rwj*/
      output_stype();
    if (rflag) write_section(tables);
    if (!jflag)    /*rwj*/
      write_section(header);
    output_trailing_text();
    if (jflag)   /*rwj*/
      write_section(jbody);
    else
      write_section(body);
    output_semantic_actions();
    if (jflag)   /*rwj*/
      write_section(jtrailer);
    else
      write_section(trailer);
}
Ejemplo n.º 4
0
void output()
#endif
{
    free_itemsets();
    free_shifts();
    free_reductions();
    output_stored_text();
    output_defines();
    output_rule_data();
    output_yydefred();
    output_actions();
    free_parser();
    output_debug();
    output_stype();
    if (rflag) write_section(tables);
    write_section(header);
    if (language == C)
	output_trailing_text();
    write_section(body);
    output_semantic_actions();
    write_section(trailer);
    if ((language == PERL) || (language == PYTHON))
	output_trailing_text();
    free_derives();
    free_nullable();
}
Ejemplo n.º 5
0
void output(void)
{
    free_itemsets();
    free_shifts();
    free_reductions();
    output_stored_text();
    if (jflag)    /*rwj*/
      {
      write_section(jheader);
      output_stype();
      }
    output_defines();
    output_rule_data();
    output_yydefred();
    output_actions();
    free_parser();
    output_debug();
    if (!jflag)    /*rwj*/
      output_stype();
    if (rflag) write_section(tables);
    if (!jflag)    /*rwj*/
      write_section(header);
    output_trailing_text();
    if (jflag)  { /*rwj*/
		/* yio 20020304: nodebug and throws options */
		if (jdebug == TRUE) {
			write_section(jbody_a);
			if (strlen(jyyparse_throws)>0)
				fprintf(code_file,"throws %s\n",jyyparse_throws);
			write_section(jbody_b);
		}
		else {
			write_section(jbody_nodebug_a);
			if (strlen(jyyparse_throws)>0)
				fprintf(code_file,"throws %s\n",jyyparse_throws);
			write_section(jbody_nodebug_b);
		}
	}
    else
		write_section(body);

    output_semantic_actions();
    if (jflag) {  /*rwj*/
		/* yio 20020304: nodebug option */
		if (jdebug == TRUE)
			write_section(jtrailer);
		else
			write_section(jtrailer_nodebug);
	}
    else
		write_section(trailer);
}
Ejemplo n.º 6
0
void output()
{
    free_itemsets();
    free_shifts();
    free_reductions();
    output_stored_text();
    output_defines();
    output_rule_data();
    output_yydefred();
    output_actions();
    free_parser();
    output_debug();
    output_stype();
    if (rflag) write_section("tables");
    write_section("header");
    output_trailing_text();
    write_section("body");
    output_semantic_actions();
    write_section("trailer");
}
Ejemplo n.º 7
0
output()
{
    free_itemsets();
    free_shifts();
    free_reductions();
    output_prefix();
    output_stored_text();
    output_defines();
    output_rule_data();
    output_yydefred();
    output_actions();
    free_parser();
    output_debug();
    output_stype();
    if (rflag) write_section(tables);
    write_section(header);
    output_trailing_text();
    write_section(body);
    output_semantic_actions();
    write_section(trailer);
}
Ejemplo n.º 8
0
void
output(void)
{
    FILE *fp;

    free_itemsets();
    free_shifts();
    free_reductions();

    if (iflag)
    {
	++outline;
	fprintf(code_file, "#include \"%s\"\n", externs_file_name);
	fp = externs_file;
    }
    else
	fp = code_file;

    output_prefix(iflag ? externs_file : output_file);
    output_pure_parser(fp);
    output_stored_text(fp);
    output_stype(fp);
    output_parse_decl(fp);
    output_lex_decl(fp);
    output_error_decl(fp);
    write_section(fp, xdecls);

    if (iflag)
    {
	output_externs(externs_file, global_vars);
	if (!pure_parser)
	    output_externs(externs_file, impure_vars);
    }

    if (iflag)
    {
	++outline;
	fprintf(code_file, "#include \"%s\"\n", defines_file_name);
	if (!dflag)
	    output_defines(externs_file);
    }
    else
    {
	putc_code(code_file, '\n');
	output_defines(code_file);
    }

    if (dflag)
	output_defines(defines_file);

    output_rule_data();
    output_yydefred();
    output_actions();
    free_parser();
    output_debug();
    if (rflag)
    {
	output_prefix(code_file);
	write_section(code_file, xdecls);
	write_section(code_file, tables);
    }
    write_section(code_file, global_vars);
    if (!pure_parser)
    {
	write_section(code_file, impure_vars);
    }
    write_section(code_file, hdr_defs);
    if (!pure_parser)
    {
	write_section(code_file, hdr_vars);
    }
    output_trailing_text();
    write_section(code_file, body_1);
    if (pure_parser)
    {
	write_section(code_file, body_vars);
    }
    write_section(code_file, body_2);
    output_yyerror_call("syntax error");
    write_section(code_file, body_3);
    output_semantic_actions();
    write_section(code_file, trailer);
    output_yyerror_call("yacc stack overflow");
    write_section(code_file, trailer_2);
}