rebuilding a string from the autotree datastructure.
[email protected] (David Holden) Tue, 15 Jun 2004 16:18:04 +0100
| Newsgroups | perl.recdescent |
|---|---|
| Organization | IUCr |
| Message-ID | <[email protected]> |
Hello,
I would like to rebuild a parsed string from the datastructure given by
autotree.
For example
Given the date string "(2001)."
using the following rules:-
Date: lft_bracket Year YearLabel(?) rgt_bracket point
Year: /\d{4}/
YearLabel: /[a-z]/
point: '.'
lft_bracket: '('
rgt_bracket: ')'
autotree gives the following datastructure
$VAR1 = bless( {
'Year' => bless( {
'__VALUE__' => '2001'
}, 'Year' ),
'__RULE__' => 'Date',
'point' => bless( {
'__VALUE__' => '.'
}, 'point' ),
'lft_bracket' => bless( {
'__VALUE__' => '('
}, 'lft_bracket' ),
'rgt_bracket' => bless( {
'__VALUE__' => ')'
}, 'rgt_bracket' ),
'YearLabel(?)' => []
}, 'Date' );
I would like to be able to reconstruct the string "(2001)." from this
structure the problem I have is that because it is a HASH it does not have
order information, e.g. in the above "Year" key comes before "lft_bracket".
Am I missing somethings?
thanks in advance.
Dave.
--
Dr. David Holden.
Thanks in advance:-
Please avoid sending me Word or PowerPoint attachments.
See: <http://www.fsf.org/philosophy/no-word-attachments.html>
Show me your papers..: http://www.no2id.net/index.html
Public GPG key available on request.
-------------------------------------------------------------