/* This generated file is licenced and copyrighted under the same
* conditions as the sourcefile. Happy debugging:) */
/*
defines:
*/
#define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output
#define RESTORE {__BNF_level = hold___BNF_level; __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}
#ifdef __TURBOC__
# pragma warn -pro
# pragma warn -nod
#endif
#ifdef _MSC_VER
# pragma warning (disable:4013)
# pragma warning (disable:4005)
#endif
/*
externals:
*/
extern char *__BNF_input, *__BNF_output;
extern unsigned __BNF_level;
extern unsigned int __BNF_tabsize;
extern int __BNF_trans_string(char *),
__BNF_input_string(char *), __BNF_output_string(char *),
__BNF_trans_char(void), __BNF_swap(char *, char *, char *);
extern void user_error(char *); /* user provided error handler must TERMINATE */
/**/
/* ---------------------------------------------------------------------*/
/**/
/* GRAMMAR SECTION*/
/**/
/* ---------------------------------------------------------------------*/
/**/
/* ---------------------------------------------------------------------*/
/* <grammar> ::= [{ <assignment> | <comment> | <white> }] EOF*/
/**/
/**/
int grammar(void)
{
int state;
do {
HOLD;
state = out_header( ); /* --- Call function --- */
if (state) break;
{
int firstloop = 1;
do {
do {
HOLD;
do {
state = assignment( ); /* --- Call function --- */
if (!state) break;
state = wc( ); /* --- Call function --- */
} while( 0 );
if (state) break;
state = flush( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
state = 0;
if (state) { RESTORE; break; };
do {
HOLD;
state = __BNF_input_string( "%%" ); /* --- Call function --- */
if (state) break;
{
int firstloop = 1;
do {
state = __BNF_trans_char( ); /* --- Call function --- */
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
state = 0;
if (state) { RESTORE; break; };
} while( 0 );
state = 0;
if (state) { RESTORE; break; };
do {
do {
HOLD;
state = eoi( ); /* --- Call function --- */
if (state) break;
state = out_footer( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
user_error( "Syntax error" ); /* --- Call function --- */
state = 0;
} while( 0 );
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <comment> ::= '#' ~[{ not '\n' }]~ '\n'*/
/**/
/* where the internal routine 'commentchars' does a transparent parse on*/
/* the expression '~[{ not '\n' }]~'.*/
/**/
int comment(void)
{
int state;
do {
do {
HOLD;
state = __BNF_input_string( "##" ); /* --- Call function --- */
if (state) break;
state = ignorechars( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_input_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
do {
HOLD;
state = __BNF_input_string( "#" ); /* --- Call function --- */
if (state) break;
state = out_comment_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = commentchars( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_input_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_comment_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <assignment> ::= <name> [<wc>] ('=' | '::=') <expression> ';'*/
/**/
int assignment(void)
{
int state;
do {
HOLD;
state = out_func_type( ); /* --- Call function --- */
if (state) break;
state = name( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
do {
state = __BNF_input_string( "=" ); /* --- Call function --- */
if (!state) break;
state = __BNF_input_string( "::=" ); /* --- Call function --- */
if (!state) break;
user_error( " \'=\' or \'::=\' expected" ); /* --- Call function --- */
state = 0;
} while( 0 );
if (state) { RESTORE; break; };
state = out_func_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = expression( ); /* --- Call function --- */
if (state) { RESTORE; break; };
do {
do {
HOLD;
state = __BNF_input_string( ";" ); /* --- Call function --- */
if (state) break;
state = inc_rule( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
user_error( "\';\' expected" ); /* --- Call function --- */
state = 0;
} while( 0 );
if (state) { RESTORE; break; };
state = out_func_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <expression> ::= term [{ '|' term }]*/
/**/
int expression(void)
{
int state;
do {
do {
HOLD;
state = wc( ); /* --- Call function --- */
state = 0;
if (state) break;
do {
do {
HOLD;
state = out_or_begin( ); /* --- Call function --- */
if (state) break;
state = term( ); /* --- Call function --- */
if (state) { RESTORE; break; };
{
int firstloop = 1;
do {
do {
HOLD;
state = wc( ); /* --- Call function --- */
state = 0;
if (state) break;
state = __BNF_input_string( "|" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = out_or_operator( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = term( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
if (state) { RESTORE; break; };
state = out_or_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
state = term( ); /* --- Call function --- */
} while( 0 );
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
user_error( "Expression expected" ); /* --- Call function --- */
state = 0;
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <term> ::= <ordinary_and> | <swapped_and> | <factor>*/
/**/
int term(void)
{
int state;
do {
state = ordinary_and( ); /* --- Call function --- */
if (!state) break;
state = swapped_and( ); /* --- Call function --- */
if (!state) break;
state = factor( ); /* --- Call function --- */
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <ordinary_and> ::= factor { wc <factor> }*/
/**/
int ordinary_and(void)
{
int state;
do {
HOLD;
state = out_and_begin( ); /* --- Call function --- */
if (state) break;
state = factor( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_and_1( ); /* --- Call function --- */
if (state) { RESTORE; break; };
{
int firstloop = 1;
do {
do {
HOLD;
state = wc( ); /* --- Call function --- */
if (state) break;
state = factor( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_and_2( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
if (state) { RESTORE; break; };
state = out_and_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <swapped_and> ::= factor { '#' <factor> }*/
/**/
int swapped_and(void)
{
int state;
do {
HOLD;
state = out_swp_begin( ); /* --- Call function --- */
if (state) break;
state = factor( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_swp_1( ); /* --- Call function --- */
if (state) { RESTORE; break; };
{
int firstloop = 1;
do {
do {
do {
HOLD;
state = wc( ); /* --- Call function --- */
state = 0;
if (state) break;
state = __BNF_input_string( "#" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = out_swp_2( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = factor( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_swp_3( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
do {
HOLD;
state = wc( ); /* --- Call function --- */
if (state) break;
state = factor( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_swp_4( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
if (state) { RESTORE; break; };
state = out_swp_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <factor> ::= <IO> | ident | '(' expression rparen | option | repetition*/
/**/
/* postfix operators are quite time consuming :(*/
int factor(void)
{
int state;
do {
do {
HOLD;
state = __BNF_input_string( "!" ); /* --- Call function --- */
if (state) break;
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = simple_factor( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
/* The 'not' operator.*/
if (!state) break;
do {
HOLD;
state = simple_factor( ); /* --- Call function --- */
if (state) break;
do {
HOLD;
state = wc( ); /* --- Call function --- */
state = 0;
if (state) break;
do {
state = __BNF_input_string( "*" ); /* --- Call function --- */
if (!state) break;
state = __BNF_input_string( "+" ); /* --- Call function --- */
} while( 0 );
if (state) { RESTORE; break; };
} while( 0 );
state = 0;
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* Kleene's '*' and '+'.*/
int simple_factor(void)
{
int state;
do {
state = IO( ); /* --- Call function --- */
if (!state) break;
state = function( ); /* --- Call function --- */
if (!state) break;
state = identifier( ); /* --- Call function --- */
if (!state) break;
state = option( ); /* --- Call function --- */
if (!state) break;
state = repetition( ); /* --- Call function --- */
if (!state) break;
do {
HOLD;
state = __BNF_input_string( "(" ); /* --- Call function --- */
if (state) break;
state = expression( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = rparen( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* --------------------------------------------------------------------*/
/* <IO> ::= <input> | <output> | <trans> | '.' | <error>*/
/**/
int IO(void)
{
int state;
do {
state = input( ); /* --- Call function --- */
if (!state) break;
state = output( ); /* --- Call function --- */
if (!state) break;
state = trans( ); /* --- Call function --- */
if (!state) break;
do {
HOLD;
state = __BNF_input_string( "." ); /* --- Call function --- */
if (state) break;
state = out_trans_char( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
state = syntax_error( ); /* --- Call function --- */
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* input ::= ['in' [wc] '(' [wc]] <string> [ [wc] rparen]*/
/**/
int input(void)
{
int state;
do {
do {
HOLD;
state = __BNF_input_string( "in" ); /* --- Call function --- */
if (state) break;
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = __BNF_input_string( "(" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = out_str_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = string( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_str_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = rparen( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
do {
HOLD;
state = out_str_begin( ); /* --- Call function --- */
if (state) break;
state = string( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_str_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* output ::= 'out' [<wc>] '(' [<wc>] <string> [<wc>] rparen*/
/* | '`' [{o_stringchar}] '`'*/
/**/
int output(void)
{
int state;
do {
do {
HOLD;
state = __BNF_input_string( "out" ); /* --- Call function --- */
if (state) break;
state = out_out_1_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = __BNF_input_string( "(" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = string( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = rparen( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_out_1_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
do {
HOLD;
state = __BNF_input_string( "`" ); /* --- Call function --- */
if (state) break;
state = out_out_2_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
{
int firstloop = 1;
do {
state = o_stringchar( ); /* --- Call function --- */
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
state = 0;
if (state) { RESTORE; break; };
do {
do {
HOLD;
state = __BNF_input_string( "`" ); /* --- Call function --- */
if (state) break;
state = out_out_2_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
user_error( "Unterminated output string" ); /* --- Call function --- */
state = 0;
} while( 0 );
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* trans ::= 'trans' [<wc>] '(' [<wc>] <string> [<wc>] rparen*/
/* | '\"' [{t_stringchar}] '\"'*/
/**/
int trans(void)
{
int state;
do {
do {
HOLD;
state = out_tran_1_begin( ); /* --- Call function --- */
if (state) break;
state = __BNF_input_string( "trans" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = __BNF_input_string( "(" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = string( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = rparen( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_tran_1_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
do {
HOLD;
state = __BNF_input_string( "\"" ); /* --- Call function --- */
if (state) break;
state = out_tran_2_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
{
int firstloop = 1;
do {
state = t_stringchar( ); /* --- Call function --- */
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
state = 0;
if (state) { RESTORE; break; };
do {
do {
HOLD;
state = __BNF_input_string( "\"" ); /* --- Call function --- */
if (state) break;
state = out_tran_2_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (!state) break;
user_error( "Unterminated trans string" ); /* --- Call function --- */
state = 0;
} while( 0 );
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* syntax_error ::= 'error' [wc] '(' [wc] string [wc] rparen*/
/**/
int syntax_error(void)
{
int state;
do {
HOLD;
state = __BNF_input_string( "error" ); /* --- Call function --- */
if (state) break;
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = __BNF_input_string( "(" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = out_err_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = string( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = wc( ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
state = rparen( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_err_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* There is NO white allowed between name and '(', or we would*/
/* have a serious problem. still I think that this solution is*/
/* NOT clear, and this should be changed in the future...*/
/**/
int function(void)
{
int state;
do {
state = valid_name( ); /* --- Call function --- */
if (!state) break;
do {
HOLD;
state = name( ); /* --- Call function --- */
if (state) break;
state = __BNF_input_string( "(" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = expression( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = rparen( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <identifier> ::= <name>*/
/**/
int identifier(void)
{
int state;
do {
state = valid_name( ); /* --- Call function --- */
if (!state) break;
do {
HOLD;
state = out_call_begin( ); /* --- Call function --- */
if (state) break;
state = name( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_call_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
} while( 0 );
return state;}
/* --------------------------------------------------------------------*/
/**/
/**/
int valid_name(void)
{
int state;
do {
HOLD;
state = __BNF_input_string( "__BNF_" ); /* --- Call function --- */
if (state) break;
user_error( "names beginning with \'__BNF_\' are reserved" ); /* --- Call function --- */
state = 0;
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <option> ::= '[' <expression> ']'*/
/**/
int option(void)
{
int state;
do {
HOLD;
state = __BNF_input_string( "[" ); /* --- Call function --- */
if (state) break;
state = expression( ); /* --- Call function --- */
if (state) { RESTORE; break; };
do {
state = __BNF_input_string( "]" ); /* --- Call function --- */
if (!state) break;
user_error( "\']\' expected" ); /* --- Call function --- */
state = 0;
} while( 0 );
if (state) { RESTORE; break; };
state = out_option( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <repetition> ::= '{' <expression> '}'*/
/**/
int repetition(void)
{
int state;
do {
HOLD;
state = __BNF_input_string( "{" ); /* --- Call function --- */
if (state) break;
state = out_rep_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = expression( ); /* --- Call function --- */
if (state) { RESTORE; break; };
do {
state = __BNF_input_string( "}" ); /* --- Call function --- */
if (!state) break;
user_error( "\'}\' expected" ); /* --- Call function --- */
state = 0;
} while( 0 );
if (state) { RESTORE; break; };
state = out_rep_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <name> ::= <letter> (letter | digit)**/
/**/
int name(void)
{
int state;
do {
HOLD;
state = letter( ); /* --- Call function --- */
if (state) break;
{
int firstloop = 1;
do {
do {
state = letter( ); /* --- Call function --- */
if (!state) break;
state = digit( ); /* --- Call function --- */
} while( 0 );
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
state = 0;
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <string> ::= string_el ( wc string_el )**/
/**/
int string(void)
{
int state;
do {
HOLD;
state = string_el( ); /* --- Call function --- */
if (state) break;
{
int firstloop = 1;
do {
do {
HOLD;
state = wc( ); /* --- Call function --- */
if (state) break;
state = out_str_seperator( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = string_el( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
state = 0;
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* <string_el ::= '\'' [{stringchar}] '\''*/
/**/
int string_el(void)
{
int state;
do {
HOLD;
state = __BNF_input_string( "\'" ); /* --- Call function --- */
if (state) break;
state = out_str_ch( ); /* --- Call function --- */
if (state) { RESTORE; break; };
{
int firstloop = 1;
do {
state = stringchar( ); /* --- Call function --- */
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
state = 0;
if (state) { RESTORE; break; };
state = __BNF_input_string( "\'" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_str_ch( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ----------------------------------------------------------------------*/
/* rparen ::= ')'*/
/**/
int rparen(void)
{
int state;
do {
state = __BNF_input_string( ")" ); /* --- Call function --- */
if (!state) break;
user_error( "\')\' expected" ); /* --- Call function --- */
state = 0;
} while( 0 );
return state;}
/* ----------------------------------------------------------------------*/
/* wc ::= white or comment in an expression*/
/**/
int wc(void)
{
int state;
{
int firstloop = 1;
do {
do {
state = white( ); /* --- Call function --- */
if (!state) break;
state = comment( ); /* --- Call function --- */
} while( 0 );
if (firstloop)
{
if (state) break;
firstloop = 0;
}
} while ( !state );
state = firstloop;
}
return state;}
/**/
/* ---------------------------------------------------------------------*/
/**/
/* OUTPUT SECTION*/
/**/
/* ---------------------------------------------------------------------*/
/**/
int out_lbrace(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) break;
state = inc_level( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_rbrace(void)
{
int state;
do {
HOLD;
state = dec_level( ); /* --- Call function --- */
if (state) break;
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_state_zero(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "state = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_do_begin(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "do " ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_lbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_do_end(void)
{
int state;
do {
HOLD;
state = out_rbrace( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( " while( 0 );\n\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_hold(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "HOLD; /* --- remember current I/O state --- */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_restore(void)
{
int state;
state = __BNF_output_string( "RESTORE; /* --- restore I/O state --- */" ); /* --- Call function --- */
return state;}
int out_do_hold_begin(void)
{
int state;
do {
HOLD;
state = out_do_begin( ); /* --- Call function --- */
if (state) break;
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "HOLD;\n\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_endfn(void)
{
int state;
state = __BNF_output_string( " ); /* --- Call function --- */\n" ); /* --- Call function --- */
return state;}
int out_end_strfn(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( " " ); /* --- Call function --- */
if (state) break;
state = out_endfn( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_set_state(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "state = " ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_break_on_accept(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "if (!state) break;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_break_on_reject(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "if (state) break;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_break_and_restore_on_reject(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "if (state) { RESTORE; break; };\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* out_header, out_footer: Generated code in the grammar rule*/
/**/
int out_header(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "/* This generated file is licenced and copyrighted under the same \n" ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( " * conditions as the sourcefile. Happy debugging:) */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/*\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " defines:\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "*/\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define RESTORE {__BNF_level = hold___BNF_level; __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#ifdef __TURBOC__\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "# pragma warn -pro\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "# pragma warn -nod\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#endif\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#ifdef _MSC_VER\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "# pragma warning (disable:4013)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "# pragma warning (disable:4005)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#endif\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/*\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " externals:\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "*/\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "extern char *__BNF_input, *__BNF_output;\nextern unsigned __BNF_level;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "extern unsigned int __BNF_tabsize;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "extern int __BNF_trans_string(char *),\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_input_string(char *), __BNF_output_string(char *),\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_trans_char(void), __BNF_swap(char *, char *, char *);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "extern void user_error(char *); /* user provided error handler must TERMINATE */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_footer(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "\n\n" ); /* --- Call function --- */
if (state) break;
state = out_comment_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " begining of standard utility functions " ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_comment_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = now_do_the_builtins_dump_mister( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = now_do_the_strfilio_mister( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* out_comment_begin, out_comment_end: Generated code in the comment rule*/
/**/
int out_comment_begin(void)
{
int state;
state = __BNF_output_string( "/*" ); /* --- Call function --- */
return state;}
int out_comment_end(void)
{
int state;
state = __BNF_output_string( "*/\n" ); /* --- Call function --- */
return state;}
/* ---------------------------------------------------------------------*/
/* out_func_begin, out_func_end:*/
/* Generated code in the assigment rule.*/
/**/
int out_func_type(void)
{
int state;
state = __BNF_output_string( "\nint " ); /* --- Call function --- */
return state;}
int out_func_begin(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "(void)\n" ); /* --- Call function --- */
if (state) break;
state = out_lbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int state;\n\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_expr_empty(void)
{
int state;
state = out_state_zero( ); /* --- Call function --- */
return state;}
int out_func_end(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "return state;" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_rbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------------------------------*/
/* out_or_begin, out_or_end, out_or_end:*/
/**/
int out_or_begin(void)
{
int state;
state = out_do_begin( ); /* --- Call function --- */
return state;}
int out_or_operator(void)
{
int state;
state = out_break_on_accept( ); /* --- Call function --- */
return state;}
int out_or_end(void)
{
int state;
state = out_do_end( ); /* --- Call function --- */
return state;}
/* ---------------------------------------------------------------------*/
/* out_and_begin,out_and_1,out_and_2,out_and_end:*/
/**/
int out_and_begin(void)
{
int state;
state = out_do_hold_begin( ); /* --- Call function --- */
return state;}
int out_and_1(void)
{
int state;
state = out_break_on_reject( ); /* --- Call function --- */
return state;}
int out_and_2(void)
{
int state;
state = out_break_and_restore_on_reject( ); /* --- Call function --- */
return state;}
int out_and_end(void)
{
int state;
state = out_do_end( ); /* --- Call function --- */
return state;}
/*------------------------------------------------------*/
/* output for 'swapped and'*/
/**/
int out_swp_begin(void)
{
int state;
do {
HOLD;
state = out_do_hold_begin( ); /* --- Call function --- */
if (state) break;
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "register char *swap_first = __BNF_output, *swap_second;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_swp_1(void)
{
int state;
state = out_break_on_reject( ); /* --- Call function --- */
return state;}
int out_swp_2(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "swap_second = __BNF_output;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_swp_3(void)
{
int state;
do {
HOLD;
state = out_break_and_restore_on_reject( ); /* --- Call function --- */
if (state) break;
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "__BNF_swap( swap_first, swap_second, __BNF_output );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "swap_first = __BNF_output;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_swp_4(void)
{
int state;
state = out_break_and_restore_on_reject( ); /* --- Call function --- */
return state;}
int out_swp_end(void)
{
int state;
state = out_do_end( ); /* --- Call function --- */
return state;}
/*-------------------------------------------------------*/
/* output for 'option'*/
/**/
int out_option(void)
{
int state;
state = out_state_zero( ); /* --- Call function --- */
return state;}
/*------------------------------------------*/
/* output for 'repetition'*/
/**/
int out_rep_begin(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = out_lbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int firstloop = 1;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_do_begin( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_rep_end(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "if (firstloop)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_lbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "if (state) break;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "firstloop = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_rbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_rbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " while ( !state );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "state = firstloop;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_rbrace( ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/*---------------------------------------------*/
/* output for 'trans any character' (a shortcut...)*/
/**/
int out_trans_char(void)
{
int state;
do {
HOLD;
state = out_call_begin( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "__BNF_trans_char" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = out_call_end( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------------------*/
/* output for 'input a string'*/
/**/
int out_str_begin(void)
{
int state;
do {
HOLD;
state = out_set_state( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "__BNF_input_string( " ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_str_end(void)
{
int state;
state = out_end_strfn( ); /* --- Call function --- */
return state;}
/*------------------------------------------------------*/
/* output for 'output a string'*/
/**/
int out_out_1_begin(void)
{
int state;
do {
HOLD;
state = out_set_state( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "__BNF_output_string( " ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_out_1_end(void)
{
int state;
state = out_end_strfn( ); /* --- Call function --- */
return state;}
int out_out_2_begin(void)
{
int state;
do {
HOLD;
state = out_set_state( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "__BNF_output_string( \"" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_out_2_end(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "\"" ); /* --- Call function --- */
if (state) break;
state = out_end_strfn( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/*---------------------------------*/
/* output for 'trans a string'*/
/**/
int out_tran_1_begin(void)
{
int state;
do {
HOLD;
state = out_call_begin( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "__BNF_trans_string( " ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_tran_1_end(void)
{
int state;
state = out_end_strfn( ); /* --- Call function --- */
return state;}
int out_tran_2_begin(void)
{
int state;
do {
HOLD;
state = out_call_begin( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "__BNF_trans_string( \"" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_tran_2_end(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "\"" ); /* --- Call function --- */
if (state) break;
state = out_end_strfn( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* ---------------------------------*/
/* output for 'error(...)' call*/
/**/
int out_err_begin(void)
{
int state;
do {
HOLD;
state = out_indent( ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "user_error( " ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int out_err_end(void)
{
int state;
do {
HOLD;
state = out_end_strfn( ); /* --- Call function --- */
if (state) break;
state = out_state_zero( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/*--------------------------------------------*/
/* output for <call>*/
/**/
int out_call_begin(void)
{
int state;
state = out_set_state( ); /* --- Call function --- */
return state;}
int out_call_end(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "(" ); /* --- Call function --- */
if (state) break;
state = out_endfn( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/*----------------------------------------------*/
/* output a 'string start/stop symbol' (`"` in C)*/
/**/
int out_str_ch(void)
{
int state;
state = __BNF_output_string( "\"" ); /* --- Call function --- */
return state;}
/*-------------------------*/
/* output between multiple spaces*/
/**/
int out_str_seperator(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) break;
state = out_indent( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* eof*/
int now_do_the_builtins_dump_mister(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#include <stdio.h> /* for EOF */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#include <ctype.h>\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#include <stdlib.h>\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#include <string.h>\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/*#define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define RESTORE {__BNF_level = hold___BNF_level, __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}*/\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define DEFUN(f) int f(void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define CALL(f) state = f();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define IN__BNF_put(s) state = __BNF_input_string( s );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define OUT__BNF_put(s) state = __BNF_output_string( s );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define FUN_begin { int state; HOLD;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define FUN_end if (state) RESTORE; return state; }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define AND_begin do { HOLD;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define AND_1 if (state) break;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define AND_2 if (state) { RESTORE; break; }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define AND_end } while (0);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define OR_begin do {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define OR_1 if (!state) break;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define OR_end } while (0);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define OPT_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define OPT_end state = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define REP_begin { inte firstloop=1; do {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define REP_end if (firstloop) {if(state) break; firstloop=0;} } while (!state); state=firstloop; }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "extern char *__BNF_input, *__BNF_output;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "unsigned __BNF_level;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "unsigned int __BNF_rulecnt;" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/* we need some prototypes .... */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_get(void); /* returns EOF when eof read... */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_flush(void);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define __BNF_put(ch) *__BNF_output++ = (ch)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_input_string( char *s )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " char *t;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " for (t = s, state = 0; *t; t++)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ((state = (__BNF_get() != *t)) != 0) break;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_output_string( char *source )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " register char *s = source, *t = __BNF_output;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " while ( *s ) *t++ = *s++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_output = t;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_trans_string( char *str )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " char *s, ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " for ( s = str; *s; s++) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( ch == *s )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " RESTORE;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_swap( char *first, char *second, char *third )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " unsigned len1 = second - first, len2 = third - second;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " char *hold = strncpy( (char *) malloc(len1+1), first, len1 );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " strncpy( first, second, len2 );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " strncpy( first+len2, hold, len1 );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " free(hold);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(__BNF_trans_char)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( (state = ((ch = __BNF_get()) == EOF)) == 0) __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(eoi)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !(__BNF_get() == EOF);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(commentchars)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " register char ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " for ( ch = __BNF_get(); ch != '\\n'; ch = __BNF_get() )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put(ch);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " --__BNF_input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int ignorechars (void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " while ( ch != '\\n' && ch != EOF )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " -- __BNF_input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(stringchar)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !(isprint( ch ) && ch != '\\n' && ch != '\\'');\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( ch == '\\\\' ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !isprint( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (!state) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( '\\\\' );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( !state ) __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(o_stringchar)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !(isprint( ch ) && ch != '\\n' && ch != '" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "`" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "');\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( ch == '\\\\' ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !isprint( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (!state) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " *__BNF_output++ = '\\\\';\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " *__BNF_output++ = ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( !state ) *__BNF_output++ = ch ;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(t_stringchar)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !(isprint( ch ) && ch != '\\n' && ch != '\"');\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( ch == '\\\\' ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !isprint( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (!state)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " { __BNF_put( '\\\\' );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( !state ) __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(letter)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch=__BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !(isalpha( ch ) || ch == '_');\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(digit)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !isdigit( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(special)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !isgraph( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(control)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch = __BNF_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !iscntrl( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (state)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " RESTORE\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put( ch );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(character)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " OR_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " CALL(stringchar)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " OR_1\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " CALL(control)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " OR_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(white)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state = !isspace( __BNF_get() );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( !state ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " while ( isspace( __BNF_get() ) )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " --__BNF_input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " };\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(inc_level)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ++__BNF_level;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state=0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(dec_level)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " --__BNF_level;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state=0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "DEFUN(out_indent)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_begin\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " unsigned i,j;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " for (i=0; i<__BNF_level; i++ )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if (__BNF_tabsize) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " for(j=0;j<__BNF_tabsize;j++) __BNF_put(' ');\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_put('\t');\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " state=0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FUN_end\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int inc_rule (void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ++ __BNF_rulecnt;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int flush( void )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return __BNF_flush();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/* eof */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int now_do_the_strfilio_mister(void)
{
int state;
do {
HOLD;
state = ndt_a( ); /* --- Call function --- */
if (state) break;
state = ndt_b( ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int ndt_a(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#include <stdio.h>\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " * We have either a strings or files as input and output.\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_str_io_parser(char* input,char* output,int (*syntax)());\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_fil_io_parser(FILE* input,FILE* output,int (*syntax)());\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " * STRIO/FILIO COMMON DEFS\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#include <stdlib.h>\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#define BUFFER_SIZE (4*20480)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "unsigned __BNF_err_line;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "unsigned long __BNF_no_read, __BNF_no_written;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "char *__BNF_input, *__BNF_output;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "unsigned int __BNF_tabsize = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "static int __is_file_io = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " * FILIO\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "FILE *if_ptr = NULL, *of_ptr = NULL;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "static char *max___BNF_input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "static char *__BNF_input_buffer = NULL, *__BNF_output_buffer = NULL;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "static int init(void);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "static int done(void);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_fil_io_parser( FILE *input, FILE *output, int (*syntax)() )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int retval;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
int ndt_b(void)
{
int state;
do {
HOLD;
state = __BNF_output_string( " __is_file_io = 1;\n" ); /* --- Call function --- */
if (state) break;
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " /* --- initialisation --- */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_level = __BNF_rulecnt = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if_ptr = input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " of_ptr = output;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( init() ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " fprintf( stderr, \"Fatal: Cannot allocate enough memory.\\n\" );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " /* --- call the syntax parser --- */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " retval = (*syntax)();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " /* --- clean up --- */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " done();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return retval;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_fil_get(void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( __BNF_input == max___BNF_input ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( (ch = fgetc(if_ptr)) != 0 ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " *__BNF_input++ = ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " max___BNF_input++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_no_read++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( ch == '\\n' ) __BNF_err_line++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return *__BNF_input++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_fil_put(int ch)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( __BNF_output == __BNF_output_buffer+BUFFER_SIZE ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " *__BNF_output++ = ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_fil_flush(void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " char *s = __BNF_output_buffer;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " while ( s < __BNF_output ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_no_written++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " fputc( *s++, of_ptr );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_output = __BNF_output_buffer;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "static int init(void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( (__BNF_input_buffer = malloc( BUFFER_SIZE )) != NULL ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( (__BNF_output_buffer = malloc( BUFFER_SIZE )) != NULL ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_input = max___BNF_input = __BNF_input_buffer;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_output = __BNF_output_buffer;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_no_read = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_no_written = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_err_line=1;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " free( __BNF_input_buffer );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 1;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "static int done(void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_flush();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " free( __BNF_output_buffer);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " free( __BNF_input_buffer );\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_input_buffer = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_output_buffer = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "* STRIO\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "****************************************************************************************/\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_str_io_parser( char *input, char *output, int (*syntax)() )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " int retval;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " char *s;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __is_file_io = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " /* --- initialisation --- */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_input = max___BNF_input = __BNF_input_buffer = input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_output = __BNF_output_buffer = output;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_no_read = __BNF_no_written = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_err_line = 1;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " __BNF_level = __BNF_rulecnt = 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " /* --- call the syntax parser --- */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " retval = syntax();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " /* --- count the number of output-bytes --- */\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " for ( s = __BNF_output_buffer; s < __BNF_output ; s++ )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ++ __BNF_no_written;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return retval;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_str_get( void )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " register ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( __BNF_input == max___BNF_input ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " \n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( (ch = *max___BNF_input) != '\\0' ) {\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ++ max___BNF_input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ++ __BNF_input;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " ++ __BNF_no_read;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " \n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " if ( ch == '\\n' ) __BNF_err_line++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " \n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return EOF;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " }\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " else\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return *__BNF_input++;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_str_put( int ch )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " *__BNF_output++ = ch;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_str_flush( void )\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return 0;\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "/****************************************************************************************\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "* STRIO/FILIO COMMON HOOKS\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "****************************************************************************************/\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#if 0\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_put(int ch)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return (__is_file_io == 1) ? __BNF_fil_put(ch) : __BNF_str_put(ch);\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "#endif\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_get(void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return (__is_file_io == 1) ? __BNF_fil_get() : __BNF_str_get();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "int __BNF_flush(void)\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "{\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( " return (__is_file_io == 1) ? __BNF_fil_flush() : __BNF_str_flush();\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "}\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
state = __BNF_output_string( "\n" ); /* --- Call function --- */
if (state) { RESTORE; break; };
} while( 0 );
return state;}
/* begining of standard utility functions */
#include <stdio.h> /* for EOF */
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
/*#define HOLD unsigned hold___BNF_level = __BNF_level; char *hold___BNF_input = __BNF_input, *hold___BNF_output = __BNF_output
#define RESTORE {__BNF_level = hold___BNF_level, __BNF_input = hold___BNF_input; __BNF_output = hold___BNF_output;}*/
#define DEFUN(f) int f(void)
#define CALL(f) state = f();
#define IN__BNF_put(s) state = __BNF_input_string( s );
#define OUT__BNF_put(s) state = __BNF_output_string( s );
#define FUN_begin { int state; HOLD;
#define FUN_end if (state) RESTORE; return state; }
#define AND_begin do { HOLD;
#define AND_1 if (state) break;
#define AND_2 if (state) { RESTORE; break; }
#define AND_end } while (0);
#define OR_begin do {
#define OR_1 if (!state) break;
#define OR_end } while (0);
#define OPT_begin
#define OPT_end state = 0;
#define REP_begin { inte firstloop=1; do {
#define REP_end if (firstloop) {if(state) break; firstloop=0;} } while (!state); state=firstloop; }
extern char *__BNF_input, *__BNF_output;
unsigned __BNF_level;
unsigned int __BNF_rulecnt;
/* we need some prototypes .... */
int __BNF_get(void); /* returns EOF when eof read... */
int __BNF_flush(void);
#define __BNF_put(ch) *__BNF_output++ = (ch)
int __BNF_input_string( char *s )
FUN_begin
char *t;
for (t = s, state = 0; *t; t++)
if ((state = (__BNF_get() != *t)) != 0) break;
FUN_end
int __BNF_output_string( char *source )
{
register char *s = source, *t = __BNF_output;
while ( *s ) *t++ = *s++;
__BNF_output = t;
return 0;
}
int __BNF_trans_string( char *str )
FUN_begin
char *s, ch;
for ( s = str; *s; s++) {
ch = __BNF_get();
if ( ch == *s )
__BNF_put( ch );
else {
RESTORE;
return 1;
}
}
state = 0;
FUN_end
int __BNF_swap( char *first, char *second, char *third )
{
unsigned len1 = second - first, len2 = third - second;
char *hold = strncpy( (char *) malloc(len1+1), first, len1 );
strncpy( first, second, len2 );
strncpy( first+len2, hold, len1 );
free(hold);
return 0;
}
DEFUN(__BNF_trans_char)
FUN_begin
int ch;
if ( (state = ((ch = __BNF_get()) == EOF)) == 0) __BNF_put( ch );
FUN_end
DEFUN(eoi)
FUN_begin
state = !(__BNF_get() == EOF);
FUN_end
DEFUN(commentchars)
{
register char ch;
for ( ch = __BNF_get(); ch != '\n'; ch = __BNF_get() )
__BNF_put(ch);
--__BNF_input;
return 0;
}
int ignorechars (void)
{
int ch;
ch = __BNF_get();
while ( ch != '\n' && ch != EOF )
ch = __BNF_get();
-- __BNF_input;
return 0;
}
DEFUN(stringchar)
FUN_begin
int ch=__BNF_get();
state = !(isprint( ch ) && ch != '\n' && ch != '\'');
if ( ch == '\\' ) {
ch = __BNF_get();
if ( !state ) {
state = !isprint( ch );
if (!state) {
__BNF_put( '\\' );
__BNF_put( ch );
}
}
}
else
if ( !state ) __BNF_put( ch );
FUN_end
DEFUN(o_stringchar)
FUN_begin
int ch=__BNF_get();
state = !(isprint( ch ) && ch != '\n' && ch != '`');
if ( ch == '\\' ) {
ch = __BNF_get();
if ( !state ) {
state = !isprint( ch );
if (!state) {
*__BNF_output++ = '\\';
*__BNF_output++ = ch;
}
}
}
else
if ( !state ) *__BNF_output++ = ch ;
FUN_end
DEFUN(t_stringchar)
FUN_begin
int ch=__BNF_get();
state = !(isprint( ch ) && ch != '\n' && ch != '"');
if ( ch == '\\' ) {
ch = __BNF_get();
if ( !state ) {
state = !isprint( ch );
if (!state)
{ __BNF_put( '\\' );
__BNF_put( ch );
}
}
}
else
if ( !state ) __BNF_put( ch );
FUN_end
DEFUN(letter)
FUN_begin
int ch=__BNF_get();
state = !(isalpha( ch ) || ch == '_');
if (state)
RESTORE
else
__BNF_put( ch );
FUN_end
DEFUN(digit)
FUN_begin
int ch = __BNF_get();
state = !isdigit( ch );
if (state)
RESTORE
else
__BNF_put( ch );
FUN_end
DEFUN(special)
FUN_begin
int ch = __BNF_get();
state = !isgraph( ch );
if (state)
RESTORE
else
__BNF_put( ch );
FUN_end
DEFUN(control)
FUN_begin
int ch = __BNF_get();
state = !iscntrl( ch );
if (state)
RESTORE
else
__BNF_put( ch );
FUN_end
DEFUN(character)
FUN_begin
OR_begin
CALL(stringchar)
OR_1
CALL(control)
OR_end
FUN_end
DEFUN(white)
FUN_begin
state = !isspace( __BNF_get() );
if ( !state ) {
while ( isspace( __BNF_get() ) )
;
--__BNF_input;
};
FUN_end
DEFUN(inc_level)
FUN_begin
++__BNF_level;
state=0;
FUN_end
DEFUN(dec_level)
FUN_begin
--__BNF_level;
state=0;
FUN_end
DEFUN(out_indent)
FUN_begin
unsigned i,j;
for (i=0; i<__BNF_level; i++ )
if (__BNF_tabsize) {
for(j=0;j<__BNF_tabsize;j++) __BNF_put(' ');
}
else
__BNF_put(' ');
state=0;
FUN_end
int inc_rule (void)
{
++ __BNF_rulecnt;
return 0;
}
int flush( void )
{
return __BNF_flush();
}
/* eof */
#include <stdio.h>
/****************************************************************************************
* We have either a strings or files as input and output.
*/
int __BNF_str_io_parser(char* input,char* output,int (*syntax)());
int __BNF_fil_io_parser(FILE* input,FILE* output,int (*syntax)());
/****************************************************************************************
* STRIO/FILIO COMMON DEFS
*/
#include <stdlib.h>
#define BUFFER_SIZE (4*20480)
unsigned __BNF_err_line;
unsigned long __BNF_no_read, __BNF_no_written;
char *__BNF_input, *__BNF_output;
unsigned int __BNF_tabsize = 0;
static int __is_file_io = 0;
/****************************************************************************************
* FILIO
*/
FILE *if_ptr = NULL, *of_ptr = NULL;
static char *max___BNF_input;
static char *__BNF_input_buffer = NULL, *__BNF_output_buffer = NULL;
static int init(void);
static int done(void);
int __BNF_fil_io_parser( FILE *input, FILE *output, int (*syntax)() )
{
int retval;
__is_file_io = 1;
/* --- initialisation --- */
__BNF_level = __BNF_rulecnt = 0;
if_ptr = input;
of_ptr = output;
if ( init() ) {
fprintf( stderr, "Fatal: Cannot allocate enough memory.\n" );
return 1;
}
/* --- call the syntax parser --- */
retval = (*syntax)();
/* --- clean up --- */
done();
return retval;
}
int __BNF_fil_get(void)
{
int ch;
if ( __BNF_input == max___BNF_input ) {
if ( (ch = fgetc(if_ptr)) != 0 ) {
*__BNF_input++ = ch;
max___BNF_input++;
__BNF_no_read++;
}
if ( ch == '\n' ) __BNF_err_line++;
return ch;
}
else
return *__BNF_input++;
}
int __BNF_fil_put(int ch)
{
if ( __BNF_output == __BNF_output_buffer+BUFFER_SIZE ) {
return 1;
}
*__BNF_output++ = ch;
return 0;
}
int __BNF_fil_flush(void)
{
char *s = __BNF_output_buffer;
while ( s < __BNF_output ) {
__BNF_no_written++;
fputc( *s++, of_ptr );
}
__BNF_output = __BNF_output_buffer;
return 0;
}
static int init(void)
{
if ( (__BNF_input_buffer = malloc( BUFFER_SIZE )) != NULL ) {
if ( (__BNF_output_buffer = malloc( BUFFER_SIZE )) != NULL ) {
__BNF_input = max___BNF_input = __BNF_input_buffer;
__BNF_output = __BNF_output_buffer;
__BNF_no_read = 0;
__BNF_no_written = 0;
__BNF_err_line=1;
return 0;
}
else
free( __BNF_input_buffer );
}
return 1;
}
static int done(void)
{
__BNF_flush();
free( __BNF_output_buffer);
free( __BNF_input_buffer );
__BNF_input_buffer = 0;
__BNF_output_buffer = 0;
return 0;
}
/****************************************************************************************
* STRIO
****************************************************************************************/
int __BNF_str_io_parser( char *input, char *output, int (*syntax)() )
{
int retval;
char *s;
__is_file_io = 0;
/* --- initialisation --- */
__BNF_input = max___BNF_input = __BNF_input_buffer = input;
__BNF_output = __BNF_output_buffer = output;
__BNF_no_read = __BNF_no_written = 0;
__BNF_err_line = 1;
__BNF_level = __BNF_rulecnt = 0;
/* --- call the syntax parser --- */
retval = syntax();
/* --- count the number of output-bytes --- */
for ( s = __BNF_output_buffer; s < __BNF_output ; s++ )
++ __BNF_no_written;
return retval;
}
int __BNF_str_get( void )
{
register ch;
if ( __BNF_input == max___BNF_input ) {
if ( (ch = *max___BNF_input) != '\0' ) {
++ max___BNF_input;
++ __BNF_input;
++ __BNF_no_read;
if ( ch == '\n' ) __BNF_err_line++;
return ch;
}
else
return EOF;
}
else
return *__BNF_input++;
}
int __BNF_str_put( int ch )
{
*__BNF_output++ = ch;
return 0;
}
int __BNF_str_flush( void )
{
return 0;
}
/****************************************************************************************
* STRIO/FILIO COMMON HOOKS
****************************************************************************************/
#if 0
int __BNF_put(int ch)
{
return (__is_file_io == 1) ? __BNF_fil_put(ch) : __BNF_str_put(ch);
}
#endif
int __BNF_get(void)
{
return (__is_file_io == 1) ? __BNF_fil_get() : __BNF_str_get();
}
int __BNF_flush(void)
{
return (__is_file_io == 1) ? __BNF_fil_flush() : __BNF_str_flush();
}
syntax highlighted by Code2HTML, v. 0.9.1