While this might be intended it doesn't seem to be the correct format of "keyed lists"! ³
A keyed list is a list in which each element contains a key and value pair. These element pairs are stored as lists themselves, where the key is the first element of the list, and the value is the second. The key-value pairs are referred to as fields. This is an example of a keyed list:Fields may contain subfields; `.' is the separator character. Subfields are actually fields where the value is another keyed list. Thus the following list has the top level fields ID and NAME, and subfields NAME.FIRST and NAME.LAST:% package require Tclx 8.4 % keylset person NAME {Frank Zappa} JOB {musician and composer} % list $person {{NAME {Frank Zappa}} {JOB {musician and composer}}}{ID 106} {NAME {{FIRST Frank} {LAST Zappa}}}
The difficulty to find valid information on TCL¹ plus the broken data the OP (or his TCL application) provided made me stop working on this task.²
But I like your recursive parser, it's only usable for this special thread (hardcoded levels) , but nevertheless nicely made! =)
Cheers Rolf
( addicted to the Perl Programming Language)
¹) glad to be a Perler...
²) to be honest I finished a kl2hash parser but I don't intend to publish.
³) Never mind, it's legal string syntax in TCL. There is no big difference between lists and strings in that language.
In reply to Re^2: Convert Tcl Keyed List to Perl
by LanX
in thread Convert Tcl Keyed List to Perl
by bkobs39
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |