MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / yy_get_next_buffer

Function yy_get_next_buffer

src/parser/ds_lexer.cpp:3980–4115  ·  view source on GitHub ↗

yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */

Source from the content-addressed store, hash-verified

3978 * EOB_ACT_END_OF_FILE - end of file
3979 */
3980static int yy_get_next_buffer (yyscan_t yyscanner)
3981{
3982 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3983 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3984 char *source = yyg->yytext_ptr;
3985 int number_to_move, i;
3986 int ret_val;
3987
3988 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
3989 YY_FATAL_ERROR(
3990 "fatal flex scanner internal error--end of buffer missed" );
3991
3992 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3993 { /* Don't try to fill the buffer, so this is an EOF. */
3994 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
3995 {
3996 /* We matched a single character, the EOB, so
3997 * treat this as a final EOF.
3998 */
3999 return EOB_ACT_END_OF_FILE;
4000 }
4001
4002 else
4003 {
4004 /* We matched some text prior to the EOB, first
4005 * process it.
4006 */
4007 return EOB_ACT_LAST_MATCH;
4008 }
4009 }
4010
4011 /* Try to read more data. */
4012
4013 /* First move last chars to start of buffer. */
4014 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
4015
4016 for ( i = 0; i < number_to_move; ++i )
4017 *(dest++) = *(source++);
4018
4019 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
4020 /* don't do the read, it's not guaranteed to return an EOF,
4021 * just force an EOF
4022 */
4023 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
4024
4025 else
4026 {
4027 int num_to_read =
4028 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
4029
4030 while ( num_to_read <= 0 )
4031 { /* Not enough room in the buffer - grow it. */
4032
4033 /* just a shorter name for the current buffer */
4034 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
4035
4036 int yy_c_buf_p_offset =
4037 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);

Callers 2

ds_lexer.cppFile · 0.70
inputFunction · 0.70

Calls 2

yyreallocFunction · 0.70
yyrestartFunction · 0.70

Tested by

no test coverage detected