$ perl make_parser.pl && perl test.pl >> dfpm dataset add [-D] [-N ] { [] | [] | [] | [] | [] } $params = [ 'dfpm', { 'type' => 'literal', 'value' => 'dataset' }, { 'type' => 'literal', 'value' => 'add' }, { 'type' => 'option', 'children' => [ { 'type' => 'switch', 'name' => '-D', 'value' => undef } ] }, { 'type' => 'option', 'children' => [ { 'type' => 'switch', 'name' => '-N', 'value' => 'node-name' } ] }, { 'type' => 'variable', 'name' => 'data-set-name-or-id' }, { 'type' => 'option', 'children' => [ { 'type' => 'alternation', 'choices' => [ [ { 'type' => 'variable', 'name' => 'volume-name-or-id' } ], [ { 'type' => 'variable', 'name' => 'qtree-name-or-id' } ], [ { 'type' => 'variable', 'name' => 'ossv-dir-name-or-id' } ], [ { 'type' => 'variable', 'name' => 'storage-system-name-or-id' } ], [ { 'type' => 'variable', 'name' => 'host-name-or-id' } ] ] } ] } ]; >> nested-square [ [ param ] ] $params = [ 'nested-square', { 'type' => 'option', 'children' => [ { 'type' => 'literal', 'value' => 'param' } ] } ]; >> multi-child { foo | bar } $params = [ 'multi-child', { 'type' => 'alternation', 'choices' => [ [ { 'type' => 'literal', 'value' => 'foo' }, { 'type' => 'variable', 'name' => 'foo' } ], [ { 'type' => 'literal', 'value' => 'bar' }, { 'type' => 'variable', 'name' => 'bar' } ] ] } ]; >> partially-optimisable { | [] | [] [] } $params = [ 'partially-optimisable', { 'type' => 'option', 'children' => [ { 'type' => 'alternation', 'choices' => [ [ { 'type' => 'variable', 'name' => 'foo' } ], [ { 'type' => 'variable', 'name' => 'bar' } ], [ { 'type' => 'option', 'children' => [ { 'type' => 'variable', 'name' => 'cat' } ] }, { 'type' => 'option', 'children' => [ { 'type' => 'variable', 'name' => 'dog' } ] } ] ] } ] } ];