~ubuntu-branches/ubuntu/precise/rakudo/precise

« back to all changes in this revision

Viewing changes to src/builtins/match.pir

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur
  • Date: 2009-10-04 14:31:57 UTC
  • Revision ID: james.westby@ubuntu.com-20091004143157-ubq3wu0grk0f1e6a
Tags: upstream-0.1~2009.09
ImportĀ upstreamĀ versionĀ 0.1~2009.09

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## $Id$
 
2
 
 
3
=head1 NAME
 
4
 
 
5
src/builtins/match.pir - Perl6 builtins for smart matching
 
6
 
 
7
=head1 Functions
 
8
 
 
9
=over 4
 
10
 
 
11
=cut
 
12
 
 
13
.namespace []
 
14
 
 
15
.sub 'infix:~~' :multi()
 
16
    .param pmc topic
 
17
    .param pmc x
 
18
    .tailcall x.'ACCEPTS'(topic)
 
19
.end
 
20
 
 
21
 
 
22
.sub 'infix:!~~'
 
23
    .param pmc topic
 
24
    .param pmc x
 
25
    .tailcall x.'REJECTS'(topic)
 
26
.end
 
27
 
 
28
=item make($item)
 
29
 
 
30
Equivalent to C<$/."!make"($item)>.  This sets the ast value of 
 
31
the current match object.
 
32
 
 
33
=cut
 
34
 
 
35
.sub 'make'
 
36
    .param pmc value
 
37
    $P0 = getinterp
 
38
    $P1 = $P0['lexpad';1]
 
39
    $P2 = $P1['$/']
 
40
    $I0 = can $P2, '!make'
 
41
    unless $I0 goto err_make
 
42
    $P2.'!make'(value)
 
43
    .return ()
 
44
  err_make:
 
45
    'die'("make() cannot set result of non-Match object in $/")
 
46
    .return ()
 
47
.end
 
48
 
 
49
 
 
50
=back
 
51
 
 
52
=cut
 
53
 
 
54
# Local Variables:
 
55
#   mode: pir
 
56
#   fill-column: 100
 
57
# End:
 
58
# vim: expandtab shiftwidth=4 ft=pir: