Skip to content

Commit c473a1b

Browse files
committed
Basic support for definitions via X<>
1 parent fbacd28 commit c473a1b

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

htmlify.p6

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ sub find-definitions (:$pod, :$origin, :$dr, :$min-level = -1) {
305305
my @header := $c.contents[0].contents;
306306
my @words;
307307
given @header {
308+
when :("", Pod::FormattingCode $, "") {
309+
proceed unless .[1].type eq "X";
310+
@words = .[1].meta[0][0,1]; # XXX Multiple definitions
311+
}
308312
when :(Str $ where /^The \s \S+ \s \w+$/) {
309313
# The Foo Infix
310314
@words = .[0].words[2,1];
@@ -339,7 +343,7 @@ sub find-definitions (:$pod, :$origin, :$dr, :$min-level = -1) {
339343
%attr = :kind<type>,
340344
:categories($tg.types{$name}.?categories//''),
341345
}
342-
when 'variable'|'sigil'|'twigil'|'declarator' {
346+
when 'variable'|'sigil'|'twigil'|'declarator'|'quote' {
343347
# TODO: More types of syntactic features
344348
%attr = :kind<syntax>,
345349
:categories($subkinds),

lib/Language/grammars.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ L<JSON::Simple module|https://github.com/moritz/json>, which can
1414
deserialize any valid JSON file, and yet the deserializing code is
1515
written in less than 100 lines of simple, extensible code.
1616
17-
=head1 Named Regexes
17+
=head1 X<Named Regexes|declarator,regex;declarator,token;declarator,rule>
1818
1919
The main ingredient of grammars is named L<regexes|/language/regexes>. While
2020
the syntax of L<Perl 6 Regexes|/language/regexes> is outside the scope of this
@@ -61,7 +61,7 @@ effect for the Regex:
6161
say 'once upon a time' ~~ &space-y;
6262
=end code
6363
64-
=head1 class Grammar
64+
=head1 X<Creating Grammars|class,Grammar;declarator,grammar>
6565
6666
class Grammar is Cursor { }
6767

lib/Language/objects.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ if $type B<L<~~>> L<Real> {
115115
say '$type contains Real or a subtype thereof';
116116
}
117117
118-
=head1 Classes
118+
=head1 X<Classes|declarator,class>
119119
120120
Classes are declared using the C<class> keyword, typically followed by a
121121
name.
@@ -416,7 +416,7 @@ Another thing to note is that the name C<new> is not special in Perl 6. It is
416416
merely a common convention. You can call C<bless> from any method at all, or
417417
use C<CREATE> to fiddle around with low-level workings.
418418
419-
=head1 Roles
419+
=head1 X<Roles|declarator,role>
420420
421421
Roles are in some ways similar to classes, in that they are a collection of
422422
attributes and methods. They differ in that roles are also meant for

lib/Language/quoting.pod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ shortcut C<「…」>, or via C<Q> followed by any pair of delimiters
1212
surrounding your text. Most of the time, though, the most you'll need
1313
is C<'…'> or C<"…">, described in more detail in the next sections.
1414
15-
=head2 Literal strings: Q
15+
=head2 X<Literal strings: Q|quote,Q;quote,「 」>
1616
1717
=for code :allow<B>
1818
B<Q[>A literal stringB<]>
@@ -37,7 +37,7 @@ These examples produce:
3737
3838
The other quote forms add on to this basic functionality:
3939
40-
=head2 Escaping: q
40+
=head2 X<Escaping: q|quote,q;quote,' '>
4141
4242
=for code :allow<B>
4343
B<'>Very plainB<'>
@@ -66,7 +66,7 @@ These examples produce:
6666
No $interpolation {here}!
6767
Just a literal "\n" here
6868
69-
=head2 Interpolation: qq
69+
=head2 X<Interpolation: qq|quote,qq;quote," ">
7070
7171
=for code :allow<B L>
7272
my $color = 'blue';
@@ -116,7 +116,7 @@ say "@neighborsB<.L<join>(', ')>, and I try our best to coexist peacefully."
116116
117117
Felix, Danielle, Lucinda, and I try our best to coexist peacefully.
118118
119-
=head2 Word quoting: qw
119+
=head2 X«Word quoting: qw|quote,qw;quote,< >»
120120
121121
=for code :allow<B L>
122122
B«<»a b cB«>» L<eqv> ('a', 'b', 'c')
@@ -139,7 +139,7 @@ It's easier to write and to read this:
139139
140140
my @directions = <left right up down>;
141141
142-
=head2 Shell quoting: qqw
142+
=head2 X<Shell quoting: qqw|quote,qqw;quote,« »>
143143
144144
TODO
145145

lib/Language/regexes.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ I<regular expression-like pattern matching>.
1616
In Perl 6, although they are capable of much more than regular languages, we
1717
continue to call them I<regex>.
1818
19-
=head1 Lexical conventions
19+
=head1 X<Lexical conventions|quote,/ /;quote,rx;quote,m>
2020
2121
Perl 6 has special syntax for writing regexes:
2222

0 commit comments

Comments
 (0)