Skip to content

Berry 're.dump()'#23162

Merged
s-hadinger merged 1 commit into
arendst:developmentfrom
s-hadinger:berry_re_dump
Mar 17, 2025
Merged

Berry 're.dump()'#23162
s-hadinger merged 1 commit into
arendst:developmentfrom
s-hadinger:berry_re_dump

Conversation

@s-hadinger
Copy link
Copy Markdown
Collaborator

Description:

Berry added re.dump(pattern_compiled:bytes) -> nil, print a dump of the compiled pattern into the state-machine used by regex engine. This is only available if compiled with #define USE_BERRY_DEBUG

Example:

> import re
> var rb = re.compilebytes("a.*?b(z+)")
> print(rb)
bytes('1B0000000F0000000100000062030260FB7E00016162030260FB01627E02017A...')

> re.dump(rb)
 0: rsplit 5 (3)
 2: any
 3: jmp 0 (-5)
 5: save 0
 7: char a
 9: rsplit 14 (3)
11: any
12: jmp 9 (-5)
14: char b
16: save 2
18: char z
20: rsplit 18 (-4)
22: save 3
24: save 1
26: match
Bytes: 27, insts: 15

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.8
  • The code change is tested and works with Tasmota core ESP32 V.3.1.3.250302
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@s-hadinger s-hadinger merged commit c0d15de into arendst:development Mar 17, 2025
echo-bravo-yahoo pushed a commit to echo-bravo-yahoo/Tasmota that referenced this pull request Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant