MCPcopy Create free account
hub / github.com/Entware/Entware / yy_get_next_buffer

Function yy_get_next_buffer

scripts/config/lexer.lex.c:3094–3228  ·  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

3092 * EOB_ACT_END_OF_FILE - end of file
3093 */
3094static int yy_get_next_buffer (void)
3095{
3096 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
3097 char *source = (yytext_ptr);
3098 int number_to_move, i;
3099 int ret_val;
3100
3101 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
3102 YY_FATAL_ERROR(
3103 "fatal flex scanner internal error--end of buffer missed" );
3104
3105 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
3106 { /* Don't try to fill the buffer, so this is an EOF. */
3107 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
3108 {
3109 /* We matched a single character, the EOB, so
3110 * treat this as a final EOF.
3111 */
3112 return EOB_ACT_END_OF_FILE;
3113 }
3114
3115 else
3116 {
3117 /* We matched some text prior to the EOB, first
3118 * process it.
3119 */
3120 return EOB_ACT_LAST_MATCH;
3121 }
3122 }
3123
3124 /* Try to read more data. */
3125
3126 /* First move last chars to start of buffer. */
3127 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
3128
3129 for ( i = 0; i < number_to_move; ++i )
3130 *(dest++) = *(source++);
3131
3132 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
3133 /* don't do the read, it's not guaranteed to return an EOF,
3134 * just force an EOF
3135 */
3136 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
3137
3138 else
3139 {
3140 int num_to_read =
3141 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
3142
3143 while ( num_to_read <= 0 )
3144 { /* Not enough room in the buffer - grow it. */
3145
3146 /* just a shorter name for the current buffer */
3147 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
3148
3149 int yy_c_buf_p_offset =
3150 (int) ((yy_c_buf_p) - b->yy_ch_buf);
3151

Callers 2

lexer.lex.cFile · 0.85
inputFunction · 0.85

Calls 2

yyreallocFunction · 0.85
yyrestartFunction · 0.85

Tested by

no test coverage detected