in reply to Re^2: snakes and ladders
in thread snakes and ladders
So I just did a more complex example by hand, now I need to figure out a way to iterate across such a complex data structure :/
What's going to make life fun is the recursive nature of the thing, each line may have attr's which then may have muliple lines to describe them.# <html lang="<qd>lang</>"> # (sql mode="mask" table="users") # <query> # SELECT * FROM users # </> # <mask> # Profile : [link action="profile" # username="<d>username</>" # ]<d>username</>[/link] # <br/> # </> # (/) # </> #TODO: translate above, into this : @_ = ( { type => '<', value => 'html', attr => { lang => ( { type => '<', value => 'qd' }, { type => 'data', value => 'lang' }, { type => '>' } ) } }, { type => '(', value => 'sql', attr => { mode => 'mask', table => 'users' } }, { type => '<', value => 'query' }, { type => 'data', value => 'SELECT * FROM users' }, { type => '>' }, { type => '<', value => 'mask' }, { type => 'd', value => 'Profile : ' }, { type => '[', value => 'link', attr => { action => 'profile', username => ( { type => '<', value => 'd' + }, { type => 'data', value => +'username' }, { type => '>' } ) } }, { type => '<', value => 'd' }, { type => 'data', value => 'username' }, { type => '>' }, { type => ']' }, { type => 'data', value => '<br/>' }, { type => '>' }, { type => ')' }, { type => '>' } );
|
|---|