LanX has asked for the wisdom of the Perl Monks concerning the following question:

as a follow up of Parsing and translating Perl Regexes

Could someone please point me to the code emitting the Regex Opcodes from use re "debug"

For instance

Compiling REx "(\.|[%"']|x)" Final program: 1: OPEN1 (3) 3: BRANCH (6) 4: EXACT <.> (21) 6: BRANCH (18) 7: ANYOF["'] (21) 18: BRANCH (FAIL) 19: EXACT <x> (21) 21: CLOSE1 (23) 23: END (0) minlen 1 Freeing REx: "(\.|[%"']|x)"

where do the Opcodes OPEN BRANCH ANYOF ... come from, where do I find a complete list?

I looked into perlreguts , the source of the re pragma and in the perl5 github mirror but couldn't indentify the code, most probably because I'm not a C programmer.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

update

OK found

but they don't include things like TRIE-EXACT

Replies are listed 'Best First'.
Re: code of re pragma?
by beech (Parson) on May 07, 2017 at 00:38 UTC

    OK found regcomp.sym but they don't include things like TRIE-EXACT

    Hi,

    TRIE_STUDY_OPT at regcomp.c#l4668 looks interesting

    4660 if ( last && trietype ) { 4661 if ( trietype != NOTHING ) { 4662 /* the last branch of the sequenc +e was part of 4663 * a trie, so we have to construc +t it here 4664 * outside of the loop */ 4665 made= make_trie( pRExC_state, sta +rtbranch, 4666 first, scan, tai +l, count, 4667 trietype, depth+ +1 ); 4668 #ifdef TRIE_STUDY_OPT 4669 if ( ((made == MADE_EXACT_TRIE && 4670 startbranch == first) 4671 || ( first_non_open == first + )) && 4672 depth==0 ) { 4673 flags |= SCF_TRIE_RESTUDY;
      Thanks great!

      That's definitely the sourcecode producing the re "debug" dump. :)

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!