aboutsummaryrefslogtreecommitdiff
path: root/examples/ini/ini.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-02 16:14:20 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-02 16:14:20 -0400
commit6ec8f20fc506af4af5513803fb9a708e4f7b5040 (patch)
tree8b952073f6eda5b85c375a65c73647a85fa16f27 /examples/ini/ini.tm
parentecaf34247eb0728a913804033cf302dada417028 (diff)
Syntax change: table types are now: `{K=V; default=...}` and tables
use `{:K=V, ...; default=...}`
Diffstat (limited to 'examples/ini/ini.tm')
-rw-r--r--examples/ini/ini.tm8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm
index 1c90b715..1e8e015f 100644
--- a/examples/ini/ini.tm
+++ b/examples/ini/ini.tm
@@ -9,10 +9,10 @@ _HELP := "
$_USAGE
"
-func parse_ini(path:Path -> {Text,{Text,Text}}):
+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 = @{:Text=Text}
sections[section_name] = current_section
else if line:matches_pattern($Pat/{..}={..}/):
key := line:replace_pattern($Pat/{..}={..}/, "\1"):trim():lower()