Пример #1
0
static int input()

    {
    int c;
	unsigned char  *yy_cp = yy_c_buf_p;

    *yy_cp = yy_hold_char;

    if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
	{ /* need more input */
	yytext = yy_c_buf_p;
	++yy_c_buf_p;

	switch ( yy_get_next_buffer() )
	    {
	    /* this code, unfortunately, is somewhat redundant with
	     * that above
	     */
	    case EOB_ACT_END_OF_FILE:
		{
		if ( yywrap() )
		    {
		    yy_c_buf_p = yytext;
		    return ( EOF );
		    }

		yy_ch_buf[0] = '\n';
		yy_n_chars = 1;
		yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
		yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
		yy_eof_has_been_seen = 0;
		yytext = yy_c_buf_p = &yy_ch_buf[1];
		yy_hold_char = *yy_c_buf_p;

		return ( input() );
		}
		break;

	    case EOB_ACT_RESTART_SCAN:
		yy_c_buf_p = yytext;
		break;

	    case EOB_ACT_LAST_MATCH:
		YY_FATAL_ERROR( "unexpected last match in input()" );
	    }
	}

    c = *yy_c_buf_p;
    yy_hold_char = *++yy_c_buf_p;

    return ( c );
    }
Пример #2
0
    static int input  (void)
#endif

{
	int c;
    
	*(yy_c_buf_p) = (yy_hold_char);

	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
		{
		/* yy_c_buf_p now points to the character we want to return.
		 * If this occurs *before* the EOB characters, then it's a
		 * valid NUL; if not, then we've hit the end of the buffer.
		 */
		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			/* This was really a NUL. */
			*(yy_c_buf_p) = '\0';

		else
			{ /* need more input */
			int offset = (yy_c_buf_p) - (yytext_ptr);
			++(yy_c_buf_p);

			switch ( yy_get_next_buffer(  ) )
				{
				case EOB_ACT_LAST_MATCH:
					/* This happens because yy_g_n_b()
					 * sees that we've accumulated a
					 * token and flags that we need to
					 * try matching the token before
					 * proceeding.  But for input(),
					 * there's no matching to consider.
					 * So convert the EOB_ACT_LAST_MATCH
					 * to EOB_ACT_END_OF_FILE.
					 */

					/* Reset buffer status. */
					yyrestart(yyin );

					/*FALLTHROUGH*/

				case EOB_ACT_END_OF_FILE:
					{
					if ( yywrap( ) )
						return EOF;

					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
#ifdef __cplusplus
					return yyinput();
#else
					return input();
#endif
					}

				case EOB_ACT_CONTINUE_SCAN:
					(yy_c_buf_p) = (yytext_ptr) + offset;
					break;
				}
			}
		}

	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
	*(yy_c_buf_p) = '\0';	/* preserve yytext */
	(yy_hold_char) = *++(yy_c_buf_p);

	return c;
}