Matching empty string at eol with simplemode

I’m trying to create a mode using simplemode, and I need to be able to trigger a pop when I’ve read all of one line.

Unfortunately it seems that once the last character of a line has been matched or eaten, the mode driver does not try to get any more tokens. So a rule like

{regexp: /$/, pop: true}

does not work.

I’ve managed a workaround for now by matching the empty string at the beginning of the next line, but I don’t think that will be enough for all cases as I move forward.

I’m thinking that a way to specify an EOL-rule for a state could be useful, but I’m not sure how difficult that would be to implement.

So, any advice on how I can get past this?

What problems come up with matching at the beginning of the line? I can’t think of an elegant way to add support for this specific use case. I might do more work on allowing a more gradual adding of imperative code to simple modes (rather than forcing people to move a classical mode entirely once they hit a case that the simple mode state machine doesn’t support), and once I get to that, I’ll keep this use case in mind.

I want my mode to be able to handle continued lines (backslash-terminated), and that may become very hairy in the end.
Each state that needs an eol-action have to be split into a start-state and an end-state, and as this pattern tends to repeat itself I get a lot of repetition in my states and rules.

Having done som more work on my mode I think I will have to move to a proper mode anyway to support all the cases I want, but it might still be useful to have an action at the end of line. something like:

{eol: true, pop: true}

or even

{eol: true, regex: /foo/,....}

It is still an issue that the driver wont check for eol rules when the stream reaches end of line, and obviously it should only do it once.