From c60ea2079fb230213308904cd0966e5481d2d994 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 12 Jan 2025 16:54:37 -0500 Subject: Fix up examples --- examples/ini/ini.tm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/ini') diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm index 9575b9fd..46c25860 100644 --- a/examples/ini/ini.tm +++ b/examples/ini/ini.tm @@ -6,10 +6,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.text_content)$\[]") - sections := @{:Text:@{Text:Text}} - current_section := @{:Text:Text} + sections := @{:Text,@{Text,Text}} + current_section := @{:Text,Text} # Line wraps: text = text:replace($/\{1 nl}{0+space}/, " ") @@ -19,14 +19,14 @@ func parse_ini(path:Path -> {Text:{Text:Text}}): skip if line:starts_with(";") or line:starts_with("#") if line:matches($/[?]/): section_name := line:replace($/[?]/, "\1"):trim():lower() - current_section = @{:Text:Text} + current_section = @{:Text,Text} sections[section_name] = current_section else if line:matches($/{..}={..}/): key := line:replace($/{..}={..}/, "\1"):trim():lower() value := line:replace($/{..}={..}/, "\2"):trim() current_section[key] = value - return {k:v[] for k,v in sections[]} + return {k=v[] for k,v in sections[]} func main(path:Path, key:Text?): keys := (key or ""):split($|/|) -- cgit v1.2.3