-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Pod 6 to the languages.yml #4083
Changes from 7 commits
be25d7e
239efea
c0858ae
75b8af9
213691f
492f404
e7d8726
af10151
d537a24
ab6fc85
1f2eed1
1550a25
14b924d
411504d
408b35f
4732f9b
81cc320
72caea2
e62e39c
3d7245d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -380,6 +380,22 @@ def call(data) | |
end | ||
end | ||
|
||
disambiguate ".pod" do |data| | ||
if /^\s*=\w+$/.match(data) | ||
if /^=pod|=cut/.match(data) | ||
Language["Pod"] | ||
elsif /^\s*=begin pod/.match(data) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be worth testing Perl 6 against To my understanding, Perl 6 allows whitespace to precede Pod lines, whereas Perl 5 doesn't. Testing for leading whitespace would be a good disambiguation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated to use your suggested regex. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pretty sure we can consolidate these regexes into one or two, depending on the answer to my first question. |
||
Language["Perl 6"] | ||
else | ||
Language["Pod"] | ||
end | ||
elsif Perl6Regex.match(data) | ||
Language["Perl 6"] | ||
elsif /^\s*\/\* XPM \*\//.match(data) | ||
Language["XPM"] | ||
end | ||
end | ||
|
||
disambiguate ".pro" do |data| | ||
if /^[^\[#]+:-/.match(data) | ||
Language["Prolog"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3471,6 +3471,17 @@ Pod: | |
- perl | ||
tm_scope: none | ||
language_id: 288 | ||
Pod 6: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I guess not, we're having finally Pod 6 as a language, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup |
||
type: prose | ||
ace_mode: perl6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should add this line to enable Perl/Pod 6 highlighting: + tm_scope: source.perl6fe Perl 6's grammar includes support for Pod6 markup, judging by the comments and pattern blocks. |
||
tm_scope: source.perl6fe | ||
wrap: true | ||
extensions: | ||
- ".pod" | ||
- ".pod6" | ||
interpreters: | ||
- perl6 | ||
language_id: 155357471 | ||
PogoScript: | ||
type: programming | ||
color: "#d80074" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible (and I would even say common) for a Pod file to consist only of multi-word directives (e.g.
=head1 NAME
), which would cause this entire condition to be skipped (even after fixing the whitespace/anchoring issues). Is this supposed to disambiguate from XPM? What is that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Grinnz are you referring to Pod5? So that would mean it would lack
=pod
and=cut
designations? Is that what you mean?If so, then I think we should add a sample which doesn't contain
=pod
or=cut
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Though in most of the examples I can find in the wild of
.pod
either end in=cut
or contain a list which always must end in=back
. It's easy to imagine that some may do neither of these things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The easy fix for this would be to change the
\w+
in the regex to.+
which would match anything except newlines.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example where the only single-word declarations are the
=back
ending the lists in the pod: https://github.com/chansen/p5-time-moment/blob/master/lib/Time/Moment.podThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example with no single-word directives: https://github.com/bingos/poe-component-irc/blob/master/lib/POE/Component/IRC/Cookbook.pod (not sure if the Perl 5 license is acceptable for samples)