String input to flex lexer

前端 未结 8 568
梦如初夏
梦如初夏 2020-11-29 04:42

I want to create a read-eval-print loop using flex/bison parser. Trouble is, the flex generated lexer wants input of type FILE* and i would like it to be char*. Is there an

8条回答
  •  粉色の甜心
    2020-11-29 05:02

    There's this funny code in libmatheval:

    /* Redefine macro to redirect scanner input from string instead of
     * standard input.  */
    #define YY_INPUT( buffer, result, max_size ) \
    { result = input_from_string (buffer, max_size); }
    

提交回复
热议问题