in reply to parse lisp style config

Why is (ignore ...) converted to an array but (config ...) converted to a hash(ref) ?

Is it because (ignore is followed by a list of lists but (config is followed by a list of pairs?

Knowing how to differentiate between the two is important.

Replies are listed 'Best First'.
Re^2: parse lisp style config
by vincentaxhe (Scribe) on Nov 27, 2024 at 11:05 UTC
    Because its siblings are incremental from zero, They are arrays, if not they are hash.It can be no ambiguity and iterateable, if key is 0, It see himself as an array to expect 1 2 and so on.

      How would your configuration file represent a hash with only one element whose key is 0?


      🦛

        that's rare, I'm not meant to make it a new all rounded config format, But with '0' ,it is interpreted as string key. It will not deal multi line or escaped something. Just notice single quote mark and content should never contain single quote mark.Or just never contain any space, get the parse to array and hash ref right first.