~ubuntu-branches/ubuntu/oneiric/padre/oneiric

« back to all changes in this revision

Viewing changes to eg/outline_test.p6

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2009-04-28 16:21:53 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090428162153-9p3ygfznr9xt08sn
Tags: 0.34-1
* New upstream release

* bump liborlite-perl (build-)dependency to 1.20
* bump liborlite-migrate-perl (build-)dependency to 0.03
* refresh patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# put stuff in GLOBAL package
 
2
use Foo;
 
3
require Bar;
 
4
 
 
5
sub foo-sub { }
 
6
method foo-method { }
 
7
submethod foo_submethod { }
 
8
macro foo_macro { }
 
9
regex foo_regex { 
 
10
        <sym> 
 
11
}
 
12
token foo_token { 
 
13
        <sym> 
 
14
}
 
15
rule foo_rule { 
 
16
        <foo_rule> <foo_token> 
 
17
}
 
18
 
 
19
#A class example 
 
20
class FooClass {
 
21
        constant $PI = 22/7;
 
22
        
 
23
        my $.foo;
 
24
        our $!foo;
 
25
 
 
26
        has $field1 is rw;
 
27
        has $.public is rw;
 
28
        has $!private is rw;
 
29
 
 
30
        use Bar;
 
31
        
 
32
        sub foo_sub { }
 
33
        method !private_method {}
 
34
        method ^how_method { }
 
35
        method foo_method { }
 
36
        submethod foo_submethod { }
 
37
        macro foo_macro { }
 
38
        regex foo_regex {
 
39
                <sym> 
 
40
        }
 
41
        token foo_token {
 
42
                <sym>  
 
43
        }
 
44
        rule foo_rule {
 
45
                <foo_rule> <foo_token>
 
46
        }
 
47
 
48
 
 
49
#A grammar example
 
50
grammar Person {
 
51
         rule name { 
 
52
                Name '=' (\N+) 
 
53
         }
 
54
         rule age  { 
 
55
                Age  '=' (\d+) 
 
56
         }
 
57
         rule desc {
 
58
             <name> \n
 
59
             <age>  \n
 
60
         }
 
61
         # etc.
 
62
}
 
63
 
 
64
#A module example
 
65
module Foo {
 
66
        sub foo_sub { }
 
67
        method foo_method { }
 
68
        submethod foo_submethod { }
 
69
        macro foo_macro { }
 
70
        regex foo_regex {
 
71
                <sym> 
 
72
        }
 
73
        token foo_token {
 
74
                <sym>  
 
75
        }
 
76
        rule foo_rule {
 
77
                <foo_rule> <foo_token>
 
78
        }
 
79
}
 
80
 
 
81
#A package example
 
82
package FooPackage {
 
83
        sub foo_sub { }
 
84
        method foo_method { }
 
85
        submethod foo_submethod { }
 
86
        macro foo_macro { }
 
87
        regex foo_regex {
 
88
                <sym> 
 
89
        }
 
90
        token foo_token {
 
91
                <sym>  
 
92
        }
 
93
        rule foo_rule {
 
94
                <foo_rule> <foo_token>
 
95
        }
 
96
}
 
97
 
 
98
#A role example
 
99
role Pet {
 
100
        method feed ($food) {
 
101
            $food.open_can;
 
102
            $food.put_in_bowl;
 
103
            self.eat($food);
 
104
        }
 
105
}
 
 
b'\\ No newline at end of file'