[Add] Keyword and %% parsing and block interruptions

Signed-off-by: oleg komarov <o.komarov11@imperial.ac.uk>
[Change] Assign as idx and not pos, minor perf improv

Signed-off-by: oleg komarov <o.komarov11@imperial.ac.uk>
[Minor] wrapped into function (no in/out), justified :)

Signed-off-by: oleg komarov <o.komarov11@imperial.ac.uk>