On Fri, Dec 8, 2017 at 1:17 AM, Hans Åberg <[email protected]> wrote: > >> On 7 Dec 2017, at 18:59, Harsha Sharma <[email protected]> wrote: >> >> I'm looking for a way to parse input string and input file (pushing >> buffer state created with yy_scan_string to buffer state created with >> yy_create_buffer to parse input file). It either causes segmentation >> fault or parses either the string or the input file. > > The string pointed to (in a lexer generated by Flex) must be copied before > passed on elsewhere, as it is just a pointer in a buffer, temporarily > null-terminated. > > This is what I'm exactly trying to do . I have a string passed from command line which needs to be parsed 'define test="foo"' and input file references this variable. Same thing can be done by prepending this line in input file 'define test="foo"' but I want to have a command line option for the same. https://gist.github.com/hs256/fb7fa55949f57a26d4e43924e75adb1d -- This is the code but it parses only the input file and not the string. Thanks for your time :)
Regards, Harsha Sharma _______________________________________________ [email protected] https://lists.gnu.org/mailman/listinfo/help-bison
