~ubuntu-branches/ubuntu/jaunty/horae/jaunty

« back to all changes in this revision

Viewing changes to 0CPAN/Parse-RecDescent-1.94/demo/demo_lisplike.pl

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2008-02-23 23:13:02 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080223231302-mnyyxs3icvrus4ke
Tags: 066-3
Apply patch to athena_parts/misc.pl for compatibility with 
perl-tk 804.28.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/local/bin/perl -w
2
 
 
3
 
use Parse::RecDescent;
4
 
use Data::Dumper;
5
 
 
6
 
my $grammar = q{
7
 
 
8
 
        s_expr: '(' s_expr(s) ')'               # NESTED S-EXPRS
9
 
                        { $return = $item[2] }
10
 
              | /" [^\\"]* (\\. [^\\"]*)* "/x   # STRINGS
11
 
              | /[^()\s]+/                      # ANYTHING ELSE
12
 
 
13
 
 
14
 
};
15
 
 
16
 
my $parser = Parse::RecDescent->new($grammar) or die;
17
 
 
18
 
undef $/;
19
 
my $data = <DATA>;
20
 
 
21
 
my $nested_array = $parser->s_expr($data);
22
 
 
23
 
 
24
 
print Data::Dumper->Dump($nested_array);
25
 
 
26
 
__DATA__
27
 
 
28
 
     (net
29
 
       (rename VDDTX "vddtx")
30
 
       (joined
31
 
         (portRef VDDTX)
32
 
         (portRef &2
33
 
           (instanceRef I_45_1102680350)))
34
 
       (figure WIRE
35
 
         (path
36
 
           (pointList
37
 
             (pt 6700 -2100)
38
 
             (pt 6900 -2100)))
39
 
         (path
40
 
           (pointList
41
 
             (pt 6900 -2100)
42
 
             (pt 6900 -2500)))))
43
 
     (net
44
 
       (rename N00023 "N00023")
45
 
       (joined
46
 
         (portRef &2
47
 
           (instanceRef I_45_1215476478))
48
 
         (portRef &1
49
 
           (instanceRef I_45_1102680350))
50
 
         (portRef &2
51
 
           (instanceRef I_45_1215470655)))
52
 
       (figure WIRE
53
 
         (path
54
 
           (pointList
55
 
             (pt 5800 -3400)
56
 
             (pt 6900 -3400)))
57
 
         (path
58
 
           (pointList
59
 
             (pt 5800 -3400)
60
 
             (pt 5800 -3700)))
61
 
         (path
62
 
           (pointList
63
 
             (pt 6900 -3100)
64
 
             (pt 6900 -3400)))
65
 
         (path
66
 
           (pointList
67
 
             (pt 8000 -3400)
68
 
             (pt 8000 -3700)))
69
 
         (path
70
 
           (pointList
71
 
             (pt 6900 -3400)
72
 
             (pt 8000 -3400))))
73
 
       (instance
74
 
         (rename TIE1 "TIE1")
75
 
         (viewRef XTIE0A2Y2
76
 
           (cellRef XTIE0A2Y2
77
 
             (libraryRef RIPPER_LIBRARY)))
78
 
         (transform
79
 
           (origin
80
 
             (pt 6900 -3400)))))
81