Skip to content

Instantly share code, notes, and snippets.

View josebraz's full-sized avatar

José Braz josebraz

  • Porto Alegre, Brazil
View GitHub Profile
@albertklik
albertklik / Delphy-to-kotlin.py
Last active April 4, 2022 18:29
Delphy-to-kotlin script
import re
reg_list = [
(r'for[ ]+([_A-Z-a-z][_A-Z-a-z0-9]*)[ ]+:=[ ]+(.*)[ ]+downto[ ]+(\d)[ ]+do[ ]*', r'for (\1 in \2 downto \3)'),
(r'for[ ]+([_A-Z-a-z][_A-Z-a-z0-9]*)[ ]+:=[ ]+(\d)[ ]+to[ ]+(.*)[ ]+do[ ]*', r'for (\1 in \2..\3)'),
(r'if[ ]+(.*)[ ]+then', r'if (\1)'),
(r'\bvar\b', r''),
(r'\bbegin\b', r'{'),
(r'\bend\b', r'}'),
(r' = ', r' == '),
(r'inc\((.*)\)', r'\1++'),