Skip to content

Commit

Permalink
Now files that start with 'a' letter can be compiled.
Browse files Browse the repository at this point in the history
I'm not sure about Type/IO/Socket/Async, since it contains examples that are running infinitely. Because of that I
just skipped this pieces of code, but it will be great if someone can find more awesome solution. Rest of the changes
is trivial: empty bodies for a method signatures, catching of exceptions with formatted output and some skipping for
console-line command, etc.
  • Loading branch information
Altai-man committed Aug 2, 2016
1 parent 14a6114 commit 6304b24
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 34 deletions.
6 changes: 5 additions & 1 deletion doc/Language/about.pod6
Expand Up @@ -39,12 +39,16 @@ highlighting
Then, to generate the documentation into the C<html/> folder, run:
=begin code :skip-test
perl6 htmlify.p6
=end code
Currently, to serve the generated documentation for your browser, Perl 5
with Mojolicious::Lite must be installed. Then run:
=begin code :skip-test
perl app.pl daemon
=end code
=head1 Contributing
Expand All @@ -57,7 +61,7 @@ All of the paragraphs and blocks following that directive, up until the
next directive of the same level, will be considered part of the
documentable. So, in:
=begin code :allow<R>
=begin code :allow<R> :skip-test
=head2 R<My Definition>
Some paragraphs, followed by some code:
Expand Down
28 changes: 14 additions & 14 deletions doc/Type/IO/Socket/Async.pod6
Expand Up @@ -12,7 +12,7 @@ server and the client side.
Here is the equivalent example to that in L<IO::Socket::INET> of a simple
echo server that listens on port 3333:
=begin code
=begin code :skip-test
use v6;
react {
Expand All @@ -26,7 +26,7 @@ react {
And a client that connects to it, and prints out what the server answers:
=begin code
=begin code :skip-test
use v6;
await IO::Socket::Async.connect('localhost', 3333).then( -> $p {
Expand All @@ -48,7 +48,7 @@ await IO::Socket::Async.connect('localhost', 3333).then( -> $p {
Alternatively L<IO::Socket::Async> can send and receive UDP messages.
An example server that outputs all the data it receives would be:
=begin code
=begin code :skip-test
my $socket = IO::Socket::Async.bind-udp('localhost', 3333);
react {
Expand All @@ -62,7 +62,7 @@ react {
And an associated client might be:
=begin code
=begin code :skip-test
my $socket = IO::Socket::Async.udp();
await $socket.print-to('localhost', 3333, "Hello, Perl 6!");
Expand All @@ -77,14 +77,14 @@ data,) should be used to create a client or a server respectively.
=head2 method connect
method connect(Str $host, Int $port) returns Promise
method connect(Str $host, Int $port) returns Promise {}
Attempts to connect to the TCP server specified by C<$host> and C<$port>,
returning a L<Promise> that will either be kept with a connected L<IO::Socket::Async> or broken if the connection cannot be made.
=head2 method listen
method listen(Str $host, Int $port) returns Supply
method listen(Str $host, Int $port) returns Supply {}
Creates a listening socket on the specified C<$host> and C<$port>, returning
a L<Supply> to which the accepted client L<IO::Socket::Async>s will be C<emit>ted. This L<Supply> should be tapped to
Expand All @@ -95,7 +95,7 @@ should be C<close>d.
=head2 method udp
method udp(IO::Socket::Async:U: :$broadcast ) returns IO::Socket::Async
method udp(IO::Socket::Async:U: :$broadcast ) returns IO::Socket::Async {}
Returns an initialised C<IO::Socket::Async> client object that is
configured to send UDP messages using C<print-to> or C<write-to>. The
Expand All @@ -104,7 +104,7 @@ the socket to send packets to a broadcast address.
=head2 method bind-udp
method bind-udp(IO::Socket::Async:U: Str() $host, Int() $port, :$broadcast) returns IO::Socket::Async
method bind-udp(IO::Socket::Async:U: Str() $host, Int() $port, :$broadcast) returns IO::Socket::Async {}
This returns an initialised C<IO::Socket::Async> server object that is
configured to receive UDP messages sent to the specified C<$host> and C<$port>
Expand All @@ -114,7 +114,7 @@ address.
=head2 method print
method print(Str $str) returns Promise
method print(Str $str) returns Promise {}
Attempt to send C<$str> on the L<IO::Socket::Async> that will
have been obtained indirectly via C<connect> or C<listen>, returning a
Expand All @@ -123,7 +123,7 @@ sent or broken if there was an error sending.
=head2 method print-to
method print-to(IO::Socket::Async:D: Str() $host, Int() $port, Str() $str) returns Promise
method print-to(IO::Socket::Async:D: Str() $host, Int() $port, Str() $str) returns Promise {}
This is the equivalent of C<print> for UDP sockets that have been created with
the C<udp> method, it will try send a UDP message of C<$str> to the specified
Expand All @@ -134,7 +134,7 @@ have been specified when the socket was created.
=head2 method write
method write(Blob $b) returns Promise
method write(Blob $b) returns Promise {}
Attempt to send the bytes in C<$b> on the L<IO::Socket::Async> that will
have been obtained indirectly via C<connect> or C<listen>, returning a
Expand All @@ -143,7 +143,7 @@ sent or broken if there was an error sending.
=head2 method write-to
method write-to(IO::Socket::Async:D: Str() $host, Int() $port, Blob $b) returns Promise
method write-to(IO::Socket::Async:D: Str() $host, Int() $port, Blob $b) returns Promise {}
This is the equivalent of C<write> for UDP sockets that have been created
with the C<udp> method, it will try send a UDP message comprised of
Expand All @@ -155,7 +155,7 @@ flag must have been specified when the socket was created.
=head2 method Supply
method Supply(:$bin, :$buf = buf8.new) returns Supply
method Supply(:$bin, :$buf = buf8.new) returns Supply {}
Returns a L<Supply> which can be tapped to obtain the data read from
the connected L<IO::Socket::Async> as it arrives. By default the data
Expand All @@ -165,7 +165,7 @@ case you can provide your own C<Buf> with the C<:buf> named parameter.
=head2 method close
method close()
method close() {}
Close the connected client L<IO::Socket::Async> which will have been
obtained from the C<listen> L<Supply> or the C<connect>
Expand Down
14 changes: 7 additions & 7 deletions doc/Type/Setty.pod6
Expand Up @@ -13,7 +13,7 @@ See L<Set> and L<SetHash>.
=head2 method grab
method grab($count = 1)
method grab($count = 1) {}
Removes and returns C<$count> elements chosen at random (without repetition)
from the set.
Expand All @@ -26,7 +26,7 @@ exception.
=head2 method grabpairs
method grabpairs($count = 1)
method grabpairs($count = 1) {}
Removes C<$count> elements chosen at random (without repetition) from the set,
and returns a list of C<Pair> objects whose keys are the grabbed elements and
Expand All @@ -41,7 +41,7 @@ exception.
=head2 method pick
multi method pick($count = 1)
multi method pick($count = 1) {}
Returns C<$count> elements chosen at random (without repetition) from the set.
Expand All @@ -50,7 +50,7 @@ size of the set, then all its elements are returned in random order.
=head2 method roll
multi method roll($count = 1)
multi method roll($count = 1) {}
Returns a lazy list of C<$count> elements, each randomly selected from the set.
Each random choice is made independently, like a separate die roll where each
Expand All @@ -72,20 +72,20 @@ Returns a list of the set's elements and C<True> values interleaved.
=head2 method elems
method elems(--> Int)
method elems(--> Int) {}
The number of elements of the set.
=head2 method total
method total(--> Int)
method total(--> Int) {}
The total of all the values of the C<QuantHash> object. For a C<Setty>
object, this is just the number of elements.
=head2 method ACCEPTS
method ACCEPTS($other)
method ACCEPTS($other) {}
Returns C<True> if C<$other> and C<self> contain all the same elements,
and no others.
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/X/AdHoc.pod6
Expand Up @@ -33,7 +33,7 @@ C<.message> method, which all C<Exception>s must have, is preferable.
=head2 method payload
method payload(X::AdHoc:D)
method payload(X::AdHoc:D) {}
Returns the original object which was passed to C<die>.
Expand Down
6 changes: 5 additions & 1 deletion doc/Type/X/Anon/Augment.pod6
Expand Up @@ -10,19 +10,23 @@ Compile time error thrown when trying to augment an anonymous package.
For example
=begin code :skip-test
use MONKEY-TYPING;
augment class { }
=end code
Dies with
=begin code :skip-test
===SORRY!===
Cannot augment anonymous class
=end code
=head1 Methods
=head2 method package-kind
method package-kind returns Str:D
method package-kind returns Str:D {}
Returns the kind of package (module, class, grammar, ...) that the code
tried to augment.
Expand Down
2 changes: 2 additions & 0 deletions doc/Type/X/Assignment/RO.pod6
Expand Up @@ -10,6 +10,8 @@ Code like
sub f() { 42 };
f() = 'new value'; # throws an X::Assignment::RO
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Assignment::RO: Cannot modify an immutable Any␤»
throws an exception of type C<X::Assignment::RO>.
Expand Down
2 changes: 1 addition & 1 deletion doc/Type/X/Proc/Async.pod6
Expand Up @@ -12,7 +12,7 @@ All exceptions thrown by L<Proc::Async> do this common role.
=head2 method proc
method fproc(X::Proc::Async:D) returns Proc::Async
method fproc(X::Proc::Async:D) returns Proc::Async {}
Returns the object that threw the exception.
Expand Down
4 changes: 3 additions & 1 deletion doc/Type/X/Proc/Async/AlreadyStarted.pod6
Expand Up @@ -12,6 +12,8 @@ C<X::Proc::Async::AlreadyStarted> exception.
my $proc = Proc::Async.new("echo");
$proc.start;
$proc.start; # Process has already been started
$proc.start;
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Proc::Async::AlreadyStarted: Process has already been started␤»
=end pod
6 changes: 4 additions & 2 deletions doc/Type/X/Syntax/Regex/Adverb.pod6
Expand Up @@ -11,22 +11,24 @@ encountered.
For example C<rx:g/a/> dies with
=begin code :skip-test
===SORRY!===
Adverb g not allowed on rx
=end code
because C<:g> belongs to a match operation, not a regex itself.
=head1 Methods
=head2 method adverb
method adverb() returns Str:D
method adverb() returns Str:D {}
Returns the illegally used adverb
=head2 method construct
method construct() returns Str:D
method construct() returns Str:D {}
Returns the name of the construct that adverb was used on (C<m>, C<ms>,
C<rx>, C<s>, C<ss>).
Expand Down
10 changes: 4 additions & 6 deletions doc/Type/X/TypeCheck/Assignment.pod6
Expand Up @@ -8,13 +8,11 @@
Error class thrown when the type check of an assignment fails.
For example
For example, this will die
my Int $x = "foo"
dies with
Type check failed in assignment to '$x'; expected 'Int' but got 'Str'
my Int $x = "foo";
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Assignment::RO: Cannot modify an immutable Any␤»
though compilers are allowed to detect obvious cases like this example
and complain at compile time with a different error.
Expand Down

0 comments on commit 6304b24

Please sign in to comment.