Hi all,

I am trying to use yy_scan_string on a program which also uses buffer
state stacks ({yypush, yypop}_buffer_state). According to the
documentation, yy_scan_string switches current buffer so a string is
parsed, but my desired behaviour is to get back to parsing the file
(using yypop?) once the string has been parsed.

I have seen some references on the web to using

yypush_buffer_state(yy_parse_string(...))

but I have noticed the inner yy_parse_string subsitutes the current
buffer state, which then gets pushed, and the original state gets lost
(no way to get back to file parsing).

The solution I have found is a little bit weird:

yypush_buffer_state (YY_CURRENT_BUFFER);
yy_scan_string (m.definition.c_str());

Thus first the *current* state is pushed (effectively creating a copy),
but then the yy_scan_string changes current buffer to the string.

It works, but just wanted to ask if somebody knows a better way to do
it.

Thanks!

Carlos


_______________________________________________
help-flex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-flex

Reply via email to