Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */
| 2126 | * @return the newly allocated buffer state object. |
| 2127 | */ |
| 2128 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
| 2129 | { |
| 2130 | YY_BUFFER_STATE b; |
| 2131 | |
| 2132 | if ( size < 2 || |
| 2133 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
| 2134 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
| 2135 | /* They forgot to leave room for the EOB's. */ |
| 2136 | return NULL; |
| 2137 | |
| 2138 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
| 2139 | if ( ! b ) |
| 2140 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
| 2141 | |
| 2142 | b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ |
| 2143 | b->yy_buf_pos = b->yy_ch_buf = base; |
| 2144 | b->yy_is_our_buffer = 0; |
| 2145 | b->yy_input_file = NULL; |
| 2146 | b->yy_n_chars = b->yy_buf_size; |
| 2147 | b->yy_is_interactive = 0; |
| 2148 | b->yy_at_bol = 1; |
| 2149 | b->yy_fill_buffer = 0; |
| 2150 | b->yy_buffer_status = YY_BUFFER_NEW; |
| 2151 | |
| 2152 | yy_switch_to_buffer( b , yyscanner ); |
| 2153 | |
| 2154 | return b; |
| 2155 | } |
| 2156 | |
| 2157 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
| 2158 | * scan from a @e copy of @a str. |
no test coverage detected
searching dependent graphs…