Skip to content

Commit 170f2b9

Browse files
committed
Merge branch 'master' of github.com:perl6/doc
2 parents 806a373 + aa2c225 commit 170f2b9

File tree

2 files changed

+123
-50
lines changed

2 files changed

+123
-50
lines changed

lib/Language/5to6.pod

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ Instead, use a C<NEXT> block within the body of the loop.
518518
519519
=head2 Regular Expressions ( Regex / Regexp )
520520
521-
=item 1. Change C<=~> and C<!~> to C<~~> and C<!~~> .
521+
=head3 Change C<=~> and C<!~> to C<~~> and C<!~~> .
522522
523523
In Perl 5, matches and substitutions are done against a variable using the
524524
C<=~> regexp-binding op.
@@ -537,29 +537,68 @@ In Perl 6, the C<~~> smartmatch op is used instead.
537537
Alternately, the new C<.match> and C<.subst> methods can be used. Note that
538538
C<.subst> is non-mutating. See L<S05/Substitution>
539539
540-
=item 2. Move modifiers
540+
=head3 Move modifiers
541541
542542
Move any modifiers from the end of the regex to the beginning. This may
543543
require you to add the optional C<m> on a plain match like C«/abc/».
544544
545545
next if $line =~ /static/i ; # Perl 5
546546
next if $line ~~ m:i/static/ ; # Perl 6
547547
548-
=item 3. Add P5 or translate
548+
=head3 Add :P5 or :Perl5 adverb
549549
550550
If the actual regex is complex, you may want to use it as-is, by adding the C<P5> modifier.
551551
552552
next if $line =~ m/[aeiou]/ ; # Perl 5
553553
next if $line ~~ m:P5/[aeiou]/ ; # Perl 6, using P5 modifier
554554
next if $line ~~ m/ <[aeiou]> / ; # Perl 6, native new syntax
555555
556-
If you do not want to leave your regex in its legacy form, here are the
557-
rules for its translation.
556+
=head3 Special matchers generally fall under the <> syntax
558557
559-
XXX Add those rules here. Use C<translate_regex.pl> from Blue Tiger in the meantime.
558+
There are many cases of special matching syntax that Perl 5 regexes
559+
support. They won't all be listed here, but often instead of being
560+
surrounded by C<()>, the assertions will be surrouned by C«<>».
560561
562+
For character classes, this means that:
561563
564+
=item C<[abc]> becomes C«<[abc]>»
562565
566+
=item C<[^abc]> becomes C«<-[abc]>»
567+
568+
=item C<[a-zA-Z]> becomes C«<[a..zA..Z]>»
569+
570+
=item C<[[:upper:]]> becomes C«<:Upper>»
571+
572+
=item C<[abc[:upper:]]> becomes C«<[abc]+:Upper>»
573+
574+
For look-around assertions:
575+
576+
=item C<(?=[abc])> becomes C«<?[abc]>»
577+
578+
=item C<(?=ar?bitrary* pattern)> becomes C«<before ar?bitrary pattern>»
579+
580+
=item C<(?!=[abc])> becomes C«<![abc]>»
581+
582+
=item C<(?!=ar?bitrary* pattern)> becomes C«<!before ar?bitrary pattern>»
583+
584+
=item C«(?<=ar?bitrary* pattern)» becomes C«<after ar?bitrary pattern>»
585+
586+
=item C«(?<!ar?bitrary* pattern)» becomes C«<!after ar?bitrary pattern>»
587+
588+
(Unrelated to <> syntax, the "lookaround" C</foo\Kbar/> becomes C</foo <( bar /> )>
589+
590+
=item C<(?(?{condition))yes-pattern|no-pattern)> becomes C«[ <?{condition}> yes-pattern | no-pattern ]»
591+
592+
=head3 Longest token matching (LTM) displaces alternation
593+
594+
In Perl 6 regexen, C<|> does LTM, which decides which alternation wins
595+
an ambiguous match based off of a set of rules, rather than about which
596+
was written first.
597+
598+
The simplest way to deal with this is just to change any C<|> in your
599+
Perl 5 regex to a C<||>.
600+
601+
TODO more rules. Use C<translate_regex.pl> from Blue Tiger in the meantime.
563602
564603
=head2 Pragmas
565604

type-graph.txt

Lines changed: 78 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -323,72 +323,106 @@ class X::IO::Chmod is Exception does X::IO
323323
[Exceptions]
324324
# Exceptions: Compile-Time
325325
role X::Comp is Exception
326+
class X::Comp::Group is Exception
327+
class X::Anon::Augment does X::Comp
328+
class X::Anon::Multi does X::Comp
329+
class X::Attribute::NoPackage does X::Comp
330+
class X::Attribute::Package does X::Comp
331+
class X::Attribute::Undeclared is X::Undeclared
332+
class X::Augment::NoSuchType does X::Comp
333+
class X::Bind is Exception
334+
class X::Bind::NativeType does X::Comp
335+
class X::Bind::Slice is Exception
336+
class X::Bind::ZenSlice is X::Bind::Slice
326337
class X::Comp::AdHoc is X::AdHoc does X::Comp
327-
class X::NYI is Exception
328338
class X::Comp::NYI is X::NYI does X::Comp
329-
class X::Signature::Placeholder does X::Comp
330-
class X::Placeholder::Block does X::Comp
331-
class X::Placeholder::Mainline is X::Placeholder::Block
332-
class X::Attribute::Undeclared is X::Undeclared
333-
class X::Redeclaration does X::Comp
334-
class X::Undeclared does X::Comp
335-
class X::Phaser::Multiple does X::Comp
339+
class X::Comp::Trait::NotOnNative is X::Trait::NotOnNative does X::Comp
340+
class X::Comp::Trait::Scope is X::Trait::Scope does X::Comp
341+
class X::Comp::Trait::Unknown is X::Trait::Unknown does X::Comp
342+
class X::Declaration::Scope does X::Comp
343+
class X::Declaration::Scope::Multi is X::Declaration::Scope
344+
class X::Does::TypeObject is Exception
345+
class X::EXPORTHOW::Conflict does X::Comp
346+
class X::EXPORTHOW::InvalidDirective does X::Comp
347+
class X::EXPORTHOW::NothingToSupersede does X::Comp
348+
class X::Import::OnlystarProto does X::Comp
349+
class X::Import::Redeclaration does X::Comp
350+
class X::Method::Private::Permission does X::Comp
351+
class X::Method::Private::Unqualified does X::Comp
352+
class X::NYI is Exception
353+
class X::Obsolete does X::Comp
336354
class X::Obsolete does X::Comp
355+
class X::Package::Stubbed does X::Comp
337356
class X::Parameter::Default does X::Comp
357+
class X::Parameter::InvalidType does X::Comp
358+
class X::Parameter::MultipleTypeConstraints does X::Comp
338359
class X::Parameter::Placeholder does X::Comp
339360
class X::Parameter::Twigil does X::Comp
340-
class X::Parameter::MultipleTypeConstraints does X::Comp
341361
class X::Parameter::WrongOrder does X::Comp
342-
class X::Signature::NameClash does X::Comp
343-
class X::Method::Private::Permission does X::Comp
344-
class X::Method::Private::Unqualified does X::Comp
345-
class X::Bind is Exception
346-
class X::Bind::NativeType does X::Comp
347-
class X::Bind::Slice is Exception
348-
class X::Bind::ZenSlice is X::Bind::Slice
349-
class X::Does::TypeObject is Exception
362+
class X::Phaser::Multiple does X::Comp
363+
class X::Placeholder::Block does X::Comp
364+
class X::Placeholder::Mainline is X::Placeholder::Block
365+
class X::Placeholder::NonPlaceholder does X::Comp
366+
class X::PoisonedAlias does X::Comp
367+
class X::PseudoPackage::InDeclaration does X::Comp
368+
class X::Redeclaration does X::Comp
369+
class X::Redeclaration::Outer does X::Comp
350370
class X::Role::Initialization is Exception
371+
class X::Signature::NameClash does X::Comp
372+
class X::Signature::Placeholder does X::Comp
373+
class X::Undeclared does X::Comp
374+
class X::Undeclared::Symbols does X::Comp
351375
class X::Value::Dynamic does X::Comp
352-
class X::Attribute::Package does X::Comp
353-
class X::Attribute::NoPackage does X::Comp
354-
class X::Declaration::Scope does X::Comp
355-
class X::Declaration::Scope::Multi is X::Declaration::Scope
356-
class X::Anon::Multi does X::Comp
357-
class X::Anon::Augment does X::Comp
358-
class X::Augment::NoSuchType does X::Comp
359-
class X::Package::Stubbed does X::Comp
360-
class X::Obsolete does X::Comp
361376

362377
[Exceptions]
363378
# Exceptions: Syntax
364379
role X::Pod
365380
role X::Syntax does X::Comp
366-
class X::Syntax::Name::Null does X::Syntax
367-
class X::Syntax::UnlessElse does X::Syntax
368-
class X::Syntax::Reserved does X::Syntax
369-
class X::Syntax::P5 does X::Syntax
370-
class X::Syntax::NegatedPair does X::Syntax
371-
class X::Syntax::Variable::Numeric does X::Syntax
372-
class X::Syntax::Variable::Match does X::Syntax
373-
class X::Syntax::Variable::Twigil does X::Syntax
374-
class X::Syntax::Variable::IndirectDeclaration does X::Syntax
375-
class X::Syntax::Augment::WithoutMonkeyTyping does X::Syntax
381+
class X::Backslash::NonVariableDollar does X::Syntax
382+
class X::Backslash::UnrecognizedSequence does X::Syntax
383+
class X::SemicolonForm::Invalid does X::Syntax
384+
class X::SemicolonForm::TooLate does X::Syntax
385+
class X::Syntax::Argument::MOPMacro does X::Syntax
386+
class X::Syntax::Augment::Illegal does X::Syntax
387+
class X::Syntax::BlockGobbled does X::Syntax
388+
class X::Syntax::Can'tMeta does X::Syntax
389+
class X::Syntax::Extension::Null does X::Syntax
390+
class X::Syntax::KeywordAsFunction does X::Syntax
391+
class X::Syntax::Malformed::Elsif does X::Syntax
392+
class X::Syntax::NonAssociative does X::Syntax
393+
class X::Syntax::Perl5Var does X::Syntax
394+
class X::Syntax::Regex::MalformedRange does X::Syntax
395+
class X::Syntax::Regex::NullRegex does X::Syntax
396+
class X::Syntax::Regex::SpacesInBareRange does X::Syntax
397+
class X::Syntax::Regex::UnrecognizedMetachar does X::Syntax
398+
class X::Syntax::Regex::Unspace does X::Syntax
399+
class X::Syntax::Regex::Unterminated does X::Syntax
400+
class X::Syntax::AddCategorial::MissingSeparator does X::Syntax
376401
class X::Syntax::Augment::Role does X::Syntax
402+
class X::Syntax::Augment::WithoutMonkeyTyping does X::Syntax
377403
class X::Syntax::Comment::Embedded does X::Syntax
378404
class X::Syntax::Confused does X::Syntax
405+
class X::Syntax::Extension::Category does X::Syntax
406+
class X::Syntax::InfixInTermPosition does X::Syntax
379407
class X::Syntax::Malformed does X::Syntax
380408
class X::Syntax::Missing does X::Syntax
381-
class X::Syntax::SigilWithoutName does X::Syntax
382-
class X::Syntax::Self::WithoutObject does X::Syntax
383-
class X::Syntax::VirtualCall does X::Syntax
409+
class X::Syntax::Name::Null does X::Syntax
410+
class X::Syntax::NegatedPair does X::Syntax
384411
class X::Syntax::NoSelf does X::Syntax
385412
class X::Syntax::Number::RadixOutOfRange does X::Syntax
413+
class X::Syntax::P5 does X::Syntax
414+
class X::Syntax::Pod::BeginWithoutEnd does X::Syntax does X::Pod
415+
class X::Syntax::Pod::BeginWithoutIdentifier does X::Syntax does X::Pod
386416
class X::Syntax::Regex::Adverb does X::Syntax
387417
class X::Syntax::Regex::SolitaryQuantifier does X::Syntax
418+
class X::Syntax::Reserved does X::Syntax
419+
class X::Syntax::Self::WithoutObject does X::Syntax
420+
class X::Syntax::SigilWithoutName does X::Syntax
388421
class X::Syntax::Signature::InvocantMarker does X::Syntax
389422
class X::Syntax::Term::MissingInitializer does X::Syntax
390-
class X::Syntax::AddCategorial::MissingSeparator does X::Syntax
391-
class X::Syntax::Extension::Category does X::Syntax
392-
class X::Syntax::InfixInTermPosition does X::Syntax
393-
class X::Syntax::Pod::BeginWithoutIdentifier does X::Syntax does X::Pod
394-
class X::Syntax::Pod::BeginWithoutEnd does X::Syntax does X::Pod
423+
class X::Syntax::UnlessElse does X::Syntax
424+
class X::Syntax::Variable::IndirectDeclaration does X::Syntax
425+
class X::Syntax::Variable::Match does X::Syntax
426+
class X::Syntax::Variable::Numeric does X::Syntax
427+
class X::Syntax::Variable::Twigil does X::Syntax
428+
class X::Syntax::VirtualCall does X::Syntax

0 commit comments

Comments
 (0)