aboutsummaryrefslogtreecommitdiff
path: root/examples/ini
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-04 17:06:09 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-04 17:06:09 -0400
commit0b8074154e2671691050bdb3bcb33245625a056c (patch)
tree1410e0c4e05c6372e876cd08f16d117e12868f41 /examples/ini
parentfadcb45baf1274e06cfe37b87655b9146aa52874 (diff)
First working compile of refactor to add explicit typing to declarations
and support untyped empty collections and `none`s
Diffstat (limited to 'examples/ini')
-rw-r--r--examples/ini/ini.tm6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm
index 1e8e015f..d67dd0d5 100644
--- a/examples/ini/ini.tm
+++ b/examples/ini/ini.tm
@@ -11,8 +11,8 @@ _HELP := "
func parse_ini(path:Path -> {Text={Text=Text}}):
text := path:read() or exit("Could not read INI file: $\[31;1]$(path)$\[]")
- sections := @{:Text=@{Text=Text}}
- current_section := @{:Text=Text}
+ sections : @{Text=@{Text=Text}} = @{}
+ current_section : @{Text=Text} = @{}
# Line wraps:
text = text:replace_pattern($Pat/\{1 nl}{0+space}/, " ")
@@ -22,7 +22,7 @@ func parse_ini(path:Path -> {Text={Text=Text}}):
skip if line:starts_with(";") or line:starts_with("#")
if line:matches_pattern($Pat/[?]/):
section_name := line:replace($Pat/[?]/, "\1"):trim():lower()
- current_section = @{:Text=Text}
+ current_section = @{}
sections[section_name] = current_section
else if line:matches_pattern($Pat/{..}={..}/):
key := line:replace_pattern($Pat/{..}={..}/, "\1"):trim():lower()