in reply to use return in regex => allowed or side effects ?

Statements that sneakily alter the control flow are indeed bad style.

There are many alternative forms to choose from.

Bottom line is, it sounds like you really need a lexer/scanner, not contorted regexes. Could you give more information pertaining to the problem at hand (the purpose of the wheel you're building)?

Replies are listed 'Best First'.
Re^2: use return in regex => allowed or side effects ?
by Anonymous Monk on Apr 16, 2018 at 18:09 UTC

    Thanks for your answer !

    It is a very simple assembler (for a proprietary risc uP). The job can be done with 2 hashes and some regex.

    I never invested the time to get familiar with parser, like Marpa. Could be worth to do this.

    Would be interesting, whats less efford to program, if the language is very reduced, like in my example.