1 # Copyright (C) 2009, Parrot Foundation.
6 PCT::Dumper - various dumper formats for PCT
10 This file implements a dumper that attempts to output PAST,
11 Match, and Capture objects in a format that can be easily
12 consumed by syntax highlighters (such as Padre).
13 Yes, the code is probably much uglier and convoluted than
14 it should be. No, I'm not proud of it, but it works for now.
18 .namespace ['PCT';'Dumper']
23 .param pmc options :slurpy :named
25 'padre_item'(obj, name)
29 .sub 'padre_item' :multi(_)
35 .sub 'padre_item' :multi(['PGE';'Match'])
42 if $I0 < 48 goto have_str
43 str = substr str, 0, 48
49 unless $S0 goto have_name
53 $P0 = new 'ResizablePMCArray'
62 $S0 = sprintf ' %4d %4d %-20s "%s"', $P0
65 .local pmc hash, hash_it
69 unless hash_it goto hash_it_done
73 'padre_item'($P0, key)
78 'padre_item'($P0, name)
83 .sub 'padre_item' :multi(['ResizablePMCArray'])
90 unless list_it goto list_it_done
92 'padre_item'($P0, name)
99 Patrick R. Michaud <pmichaud@pobox.com>
107 # vim: expandtab shiftwidth=4 ft=pir: