foonathan / lexy

C++ parsing DSL
https://lexy.foonathan.net
Boost Software License 1.0
1.01k stars 67 forks source link

Problems using the scan action with parser state #142

Closed rkaminsk closed 1 year ago

rkaminsk commented 1 year ago

There seems to be an issue with using parser state and the scan action. As a quick fix, I tried to use the following, which seems to work:

diff --git a/include/lexy/action/scan.hpp b/include/lexy/action/scan.hpp
index 02f811d6..882db409 100644
--- a/include/lexy/action/scan.hpp
+++ b/include/lexy/action/scan.hpp
@@ -70,7 +70,7 @@ private:

     _detail::any_holder<const Input*>                 _input;
     _detail::any_holder<_error_sink_t<ErrorCallback>> _sink;
-    _detail::parse_context_control_block<_handler>    _cb;
+    _detail::parse_context_control_block<_handler, State> _cb;
     _pc<_handler, State, _production>                 _context;

     friend _impl;
foonathan commented 1 year ago

Fixed it with your diff, thanks.