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. */
| 2207 | * @return the newly allocated buffer state object. |
| 2208 | */ |
| 2209 | YY_BUFFER_STATE ap_expr_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
| 2210 | { |
| 2211 | YY_BUFFER_STATE b; |
| 2212 | |
| 2213 | if ( size < 2 || |
| 2214 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
| 2215 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
| 2216 | /* They forgot to leave room for the EOB's. */ |
| 2217 | return 0; |
| 2218 | |
| 2219 | b = (YY_BUFFER_STATE) ap_expr_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); |
| 2220 | if ( ! b ) |
| 2221 | YY_FATAL_ERROR( "out of dynamic memory in ap_expr_yy_scan_buffer()" ); |
| 2222 | |
| 2223 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
| 2224 | b->yy_buf_pos = b->yy_ch_buf = base; |
| 2225 | b->yy_is_our_buffer = 0; |
| 2226 | b->yy_input_file = 0; |
| 2227 | b->yy_n_chars = b->yy_buf_size; |
| 2228 | b->yy_is_interactive = 0; |
| 2229 | b->yy_at_bol = 1; |
| 2230 | b->yy_fill_buffer = 0; |
| 2231 | b->yy_buffer_status = YY_BUFFER_NEW; |
| 2232 | |
| 2233 | ap_expr_yy_switch_to_buffer(b ,yyscanner ); |
| 2234 | |
| 2235 | return b; |
| 2236 | } |
| 2237 | |
| 2238 | /** Setup the input buffer state to scan a string. The next call to ap_expr_yylex() will |
| 2239 | * scan from a @e copy of @a str. |
no test coverage detected